Skip to content

Instantly share code, notes, and snippets.

@hvr
Created October 3, 2010 15:37
Show Gist options
  • Save hvr/608671 to your computer and use it in GitHub Desktop.
Save hvr/608671 to your computer and use it in GitHub Desktop.
NFData instance for Text.JSON intermediate parse-tree types
import Text.JSON
import Text.JSON.Types
import Control.DeepSeq
instance NFData JSValue where
rnf JSNull = ()
rnf (JSBool _) = ()
rnf (JSRational b _) = rnf b
rnf (JSString s) = rnf s
rnf (JSArray a) = rnf a
rnf (JSObject obj) = rnf obj
instance NFData JSString where
rnf = rnf . fromJSString
instance NFData t => NFData (JSObject t) where
rnf = rnf . fromJSObject
@hvr
Copy link
Author

hvr commented Oct 3, 2010

NFData instance for Text.JSON intermediate parse-tree types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment