Created
February 12, 2015 10:59
-
-
Save chadaustin/af10b5214f6adf9b8ead to your computer and use it in GitHub Desktop.
This file contains hidden or 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
vector :: (GVector.Vector v a, ToJson a) => v a -> JsonBuilder | |
vector !vec = JsonBuilder $ do | |
BB.appendChar8 '[' | |
when (GVector.length vec /= 0) $ do | |
unJsonBuilder $ appendJson (vec `GVector.unsafeIndex` 0) | |
GVector.forM_ vec $ \e -> do | |
BB.appendChar8 ',' | |
unJsonBuilder $ appendJson e | |
BB.appendChar8 ']' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment