Skip to content

Commit b07f320

Browse files
authored
Merge pull request #20 from purescript-contrib/jnull
Add JNull value
2 parents 9dbc734 + 351a722 commit b07f320

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Data/Argonaut/Core.purs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module Data.Argonaut.Core
3535
, toString
3636
, toArray
3737
, toObject
38+
, jNull
3839
, jsonNull
3940
, jsonTrue
4041
, jsonFalse
@@ -49,11 +50,12 @@ module Data.Argonaut.Core
4950

5051
import Prelude
5152

52-
import Data.Tuple (Tuple)
53-
import Data.Maybe (Maybe(..))
5453
import Data.Function.Uncurried (Fn5, runFn5, Fn7, runFn7)
55-
54+
import Data.Maybe (Maybe(..))
5655
import Data.StrMap as M
56+
import Data.Tuple (Tuple)
57+
58+
import Unsafe.Coerce (unsafeCoerce)
5759

5860
-- | A Boolean value inside some JSON data. Note that this type is exactly the
5961
-- | same as the primitive `Boolean` type; this synonym acts only to help
@@ -195,6 +197,9 @@ foreign import fromObject :: JObject -> Json
195197

196198
-- Defaults
197199

200+
jNull :: JNull
201+
jNull = (unsafeCoerce :: Json -> JNull) jsonNull
202+
198203
foreign import jsonNull :: Json
199204

200205
jsonTrue :: Json

0 commit comments

Comments
 (0)