File tree Expand file tree Collapse file tree 4 files changed +35
-1
lines changed
Expand file tree Collapse file tree 4 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 1919 "purescript-prelude" : " ^4.0.0"
2020 },
2121 "devDependencies" : {
22- "purescript-effect" : " ^2.0.0"
22+ "purescript-effect" : " ^2.0.0" ,
23+ "purescript-exceptions" : " ^4.0.0"
2324 }
2425}
Original file line number Diff line number Diff line change 1+ "use strict" ;
2+
3+ // module Todo
4+
5+ exports . crashWith = function ( ) {
6+ return function ( msg ) {
7+ throw new Error ( msg ) ;
8+ } ;
9+ } ;
Original file line number Diff line number Diff line change 1+ module Debug.Todo
2+ ( notImplementedYet
3+ , (???)
4+ , todo
5+ ) where
6+
7+ import Data.Symbol (class IsSymbol , SProxy , reflectSymbol )
8+ import Prim.TypeError (class Warn , Text )
9+
10+ notImplementedYet :: forall a . Warn (Text " not implemented yet" ) => a
11+ notImplementedYet = crashWith " not implemented yet"
12+
13+ infix 5 notImplementedYet as ???
14+
15+ todo :: forall a s . IsSymbol s => Warn (Text s ) => SProxy s -> a
16+ todo s = crashWith (reflectSymbol s)
17+
18+ foreign import crashWith :: forall a . String -> a
Original file line number Diff line number Diff line change 11module Test.Main where
22
3+ import Debug.Todo
34import Prelude
5+
46import Debug.Trace (spy , trace , traceM )
57import Effect (Effect )
8+ import Effect.Exception (try )
69
710main :: Effect Unit
811main = do
@@ -25,6 +28,9 @@ main = do
2528 let dummy = spy " dummy" { foo: 1 , bar: [1 , 2 ] }
2629 traceM dummy
2730
31+ result :: _ String <- try (pure (???))
32+ traceM result
33+
2834 where
2935 effInt :: Effect Int
3036 effInt = pure 0
You can’t perform that action at this time.
0 commit comments