File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ node_js: 6
55env :
66 - PATH=$HOME/purescript:$PATH
77install :
8- - TAG=$(basename $(curl --location --silent --output /dev/null -w %{url_effective} https://github.com/purescript/purescript/releases/latest))
8+ - TAG=v0.14.0-rc2
9+ # - TAG=$(basename $(curl --location --silent --output /dev/null -w %{url_effective} https://github.com/purescript/purescript/releases/latest))
910 - curl --location --output $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
1011 - tar -xvf $HOME/purescript.tar.gz -C $HOME/
1112 - chmod a+x $HOME/purescript
Original file line number Diff line number Diff line change 22
33// module Partial
44
5- exports . crashWith = function ( ) {
6- return function ( msg ) {
7- throw new Error ( msg ) ;
8- } ;
5+ exports . _crashWith = function ( msg ) {
6+ throw new Error ( msg ) ;
97} ;
Original file line number Diff line number Diff line change @@ -9,4 +9,7 @@ crash :: forall a. Partial => a
99crash = crashWith " Partial.crash: partial function"
1010
1111-- | A partial function which crashes on any input with the specified message.
12- foreign import crashWith :: forall a . Partial => String -> a
12+ crashWith :: forall a . Partial => String -> a
13+ crashWith = _crashWith
14+
15+ foreign import _crashWith :: forall a . String -> a
Original file line number Diff line number Diff line change 22
33// module Partial.Unsafe
44
5- exports . unsafePartial = function ( f ) {
5+ exports . _unsafePartial = function ( f ) {
66 return f ( ) ;
77} ;
Original file line number Diff line number Diff line change 22-- | See the README for more documentation.
33module Partial.Unsafe
44 ( unsafePartial
5- , unsafePartialBecause
65 , unsafeCrashWith
76 ) where
87
98import Partial (crashWith )
109
11- -- | Discharge a partiality constraint, unsafely.
12- foreign import unsafePartial :: forall a . (Partial => a ) -> a
10+ -- Note: this function's type signature is more like
11+ -- `(Unit -> a) -> a`. However, we would need to use
12+ -- `unsafeCoerce` to make this compile, incurring
13+ -- either a dependency or reimplementing it here.
14+ -- Rather than doing that, we'll use a type signature
15+ -- of `a -> b` instead.
16+ foreign import _unsafePartial :: forall a b . a -> b
1317
14- -- | *deprecated:* use `unsafePartial` instead .
15- unsafePartialBecause :: forall a . String -> (Partial => a ) -> a
16- unsafePartialBecause _ x = unsafePartial x
18+ -- | Discharge a partiality constraint, unsafely .
19+ unsafePartial :: forall a . (Partial => a ) -> a
20+ unsafePartial = _unsafePartial
1721
1822-- | A function which crashes with the specified error message.
1923unsafeCrashWith :: forall a . String -> a
Original file line number Diff line number Diff line change 11module Test.Main where
22
33import Partial (crashWith )
4- import Partial.Unsafe (unsafePartial , unsafePartialBecause )
4+ import Partial.Unsafe (unsafePartial )
55
66f :: Partial => Int -> Int
77f 0 = 0
@@ -10,8 +10,5 @@ f _ = crashWith "f: partial function"
1010safely :: Int
1111safely = unsafePartial (f 0 )
1212
13- safely2 :: Int
14- safely2 = unsafePartialBecause " calling f with argument 0 is guaranteed to be safe" (f 0 )
15-
1613main :: forall a . a -> { }
1714main _ = {}
You can’t perform that action at this time.
0 commit comments