Skip to content

Commit

Permalink
Added some number conversion instances.
Browse files Browse the repository at this point in the history
  • Loading branch information
JustusAdam committed Nov 7, 2015
1 parent 624ee91 commit 75d73f0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib/Text/Mustache/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ class ToMustache ω where
listToMustache [ω] Value
listToMustache = Array V.fromList fmap toMustache

instance ToMustache Float where
toMustache = Number fromFloatDigits

instance ToMustache Double where
toMustache = Number fromFloatDigits

instance ToMustache Integer where
toMustache = Number flip scientific 0

instance ToMustache Int where
toMustache = toMustache . toInteger

instance ToMustache Char where
toMustache = toMustache (:[])
listToMustache = String pack
Expand Down

0 comments on commit 75d73f0

Please sign in to comment.