@@ -4,6 +4,7 @@ import Prelude
44
55import Control.Monad.Eff (Eff )
66import Control.Monad.Eff.Console (CONSOLE , logShow )
7+ import Control.Monad.Except (runExcept )
78
89import Data.Foreign (F )
910import Data.Foreign.Class (class IsForeign , readJSON , readProp )
@@ -26,15 +27,15 @@ main = do
2627
2728 -- When trying to parse invalid JSON we catch an exception from
2829 -- `JSON.parse` and pass it on.
29- logShow $ readJSON " not even JSON" :: F String
30+ logShow $ runExcept $ readJSON " not even JSON" :: F String
3031
3132 -- When attempting to coerce one type to another we get an error.
32- logShow $ readJSON " 26" :: F Boolean
33+ logShow $ runExcept $ readJSON " 26" :: F Boolean
3334
3435 -- When parsing fails in an array, we're told at which index the value that
3536 -- failed to parse was, along with the reason the value didn't parse.
36- logShow $ readJSON " [1, true, 3]" :: F (Array Boolean )
37+ logShow $ runExcept $ readJSON " [1, true, 3]" :: F (Array Boolean )
3738
3839 -- When parsing fails in an object, we're the name of the property which
3940 -- failed to parse was, along with the reason the value didn't parse.
40- logShow $ readJSON """ { "x": 1, "y": false }""" :: F Point
41+ logShow $ runExcept $ readJSON """ { "x": 1, "y": false }""" :: F Point
0 commit comments