Skip to content

Commit 8e7fa3d

Browse files
committed
Implemented todo
1 parent b1484b8 commit 8e7fa3d

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
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
}

src/Debug/Todo.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"use strict";
2+
3+
// module Todo
4+
5+
exports.crashWith = function () {
6+
return function (msg) {
7+
throw new Error(msg);
8+
};
9+
};

src/Debug/Todo.purs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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

test/Main.purs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
module Test.Main where
22

3+
import Debug.Todo
34
import Prelude
5+
46
import Debug.Trace (spy, trace, traceM)
57
import Effect (Effect)
8+
import Effect.Exception (try)
69

710
main :: Effect Unit
811
main = 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

0 commit comments

Comments
 (0)