Skip to content

Instantly share code, notes, and snippets.

@kuk0
kuk0 / GenericInstances.hs
Last active February 18, 2016 14:50
Generic instances for various common data types
{-# LANGUAGE TypeFamilies, DeriveGeneric, TypeOperators, RankNTypes, OverloadedStrings, StandaloneDeriving #-}
module GenericInstances where
-- Generic instances for various common data types
--
-- > runhaskell GenericInstances.hs
-- Test {i = 3, t = "a", v = Vector.fromList [1,2,3], s = HashSet.fromList ["foo","baz","bar"], h = HashMap.fromList [("a",3),("b",4),("c",-1)], os = Set.fromList ["nay","yay"], om = Map.fromList [("f",False),("t",True)], is = IntSet [1,2,3], im = IntMap.fromList [(-3,[]),(0,[("a",True),("b",False)]),(5,[("aaaa",True)])], j = Object (HashMap.fromList [("num",Number 1.000),("array",Array (Vector.fromList [Number 7.000,Null,String "meh"])),("str",String "foo"),("bool",Bool True)])}
import GHC.Generics hiding (Prefix, prec)