1{-# LANGUAGE DataKinds, TypeOperators, TypeFamilies, MultiParamTypeClasses #-}
6-- Specify that key-value pairs on Ints combine to an Int
7type instance Combine Int Int = Int
8-- Specify that Int values for matching keys should be added
9instance Combinable Int Int where
12foo :: Map '["x" :-> Int, "z" :-> Bool, "w" :-> Int]
13foo = Ext (Var :: (Var "x")) 2
14 $ Ext (Var :: (Var "z")) True
15 $ Ext (Var :: (Var "w")) 5
18foo' :: Map (AsMap '["z" :-> Bool, "x" :-> Int, "w" :-> Int])
21bar :: Map '["y" :-> Int, "w" :-> Int]
22bar = Ext (Var :: (Var "y")) 3 $
23 Ext (Var :: (Var "w")) 1 $
26-- GHC can easily infer this type, so an explicit signature not necessary
27-- foobar :: Map '["w" :-> Int, "x" :-> Int, "y" :-> Integer, "z" :-> Int]
28foobar = foo `union` bar
30foobarToFoo :: Map '["w" :-> Int, "x" :-> Int, "z" :-> Bool]
31foobarToFoo = submap foobar
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list