Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"purescript-prelude": "^4.0.0"
},
"devDependencies": {
"purescript-effect": "^2.0.0"
"purescript-effect": "^2.0.0",
"purescript-exceptions": "^4.0.0"
}
}
9 changes: 9 additions & 0 deletions src/Debug/Todo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use strict";

// module Todo

exports.crashWith = function () {
return function (msg) {
throw new Error(msg);
};
};
18 changes: 18 additions & 0 deletions src/Debug/Todo.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module Debug.Todo
( notImplementedYet
, (???)
, todo
) where

import Data.Symbol (class IsSymbol, SProxy, reflectSymbol)
import Prim.TypeError (class Warn, Beside, Text)

notImplementedYet :: forall a. Warn (Text "not implemented yet") => a
notImplementedYet = crashWith "not implemented yet"

infix 5 notImplementedYet as ???

todo :: forall a s. IsSymbol s => Warn (Beside (Text "TODO: ") (Text s)) => SProxy s -> a
todo s = crashWith (reflectSymbol s)

foreign import crashWith :: forall a. String -> a
6 changes: 6 additions & 0 deletions test/Main.purs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
module Test.Main where

import Debug.Todo
import Prelude

import Debug.Trace (spy, trace, traceM)
import Effect (Effect)
import Effect.Exception (try)

main :: Effect Unit
main = do
Expand All @@ -25,6 +28,9 @@ main = do
let dummy = spy "dummy" { foo: 1, bar: [1, 2] }
traceM dummy

result :: _ String <- try (pure unit >>= \_ -> (???))
traceM (show result)

where
effInt :: Effect Int
effInt = pure 0
Expand Down