Skip to content

Instantly share code, notes, and snippets.

@codedmart
Created November 5, 2014 18:13
Show Gist options
  • Save codedmart/a029c7edef5e73a799ff to your computer and use it in GitHub Desktop.
Save codedmart/a029c7edef5e73a799ff to your computer and use it in GitHub Desktop.
Possible solution for run h $ line [[1, 2],[3,4],[5,6]] :: IO Line
-- Looks like run h $ line [[1,2],[3,4],[5,6]] :: IO Line was not matching on Array v so was falling to mempty
-- This solution return (in Show form) fromList [LonLat 1 2,LonLat 3 4,LonLat 5 6]
instance FromDatum a => FromDatum (Vector a) where
parseDatum (Array v) = fmap V.fromList . mapM parseDatum $ V.toList v
parseDatum (Line l) = fmap V.fromList . mapM (parseDatum . toDatum) $ V.toList l
parseDatum _ = mempty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment