Created
June 15, 2017 08:50
-
-
Save saurabhnanda/6b2eaa437be9a2fff14540e0dcbbc334 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newtype Money_ = Money_ (Reader Word8 Decimal) | |
instance FromJSON Money_ where | |
parseJSON = withNumber "a number" $ | |
\n -> return $ Money_ $ do | |
precision <- ask | |
return $ Data.Decimal.realFracToDecimal precision n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment