Quick actions

cmd+k|ctrl+k

Navigation

Languages

Existential Types Heterogeneous Map

Snippet info

Language

Haskell

Visibility

public

Author

homam

Created

2016-08-22T20:40:06Z

Updated

2016-08-22T20:42:14Z

{-# LANGUAGE ExistentialQuantification #-}

import qualified Data.Map as M

data Elem = forall e. Show e => Elem e 

instance Show Elem where
  show (Elem e) = "Elem " ++ show e

type HMap = M.Map String Elem

myMap = M.fromList [("a", Elem "a"), ("b", Elem 1), ("c", Elem [1,2,3])]

main = print (M.lookup "c" myMap)
INFO