File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 1+ module GHCJS.Nullable ( Nullable (.. )
2+ , nullableToMaybe
3+ , maybeToNullable
4+ ) where
5+
6+ import GHCJS.Prim (JSRef (.. ))
7+ import GHCJS.Marshal.Pure (PToJSRef (.. ), PFromJSRef (.. ))
8+
9+ newtype Nullable a = Nullable JSRef
10+
11+ nullableToMaybe :: PFromJSRef a => Nullable a -> Maybe a
12+ nullableToMaybe (Nullable r) = pFromJSRef r
13+ {-# INLINE nullableToMaybe #-}
14+
15+ maybeToNullable :: PToJSRef a => Maybe a -> Nullable a
16+ maybeToNullable = Nullable . pToJSRef
17+ {-# INLINE maybeToNullable #-}
18+
19+
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ library
7070 GHCJS.Marshal
7171 GHCJS.Marshal.Internal
7272 GHCJS.Marshal.Pure
73+ GHCJS.Nullable
7374 GHCJS.Types
7475 JavaScript.Array
7576 JavaScript.Array.Internal
You can’t perform that action at this time.
0 commit comments