1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 module Lib.Map.Test where
6 import Data.Map.Strict (Map)
7 import qualified Data.Map.Strict as Map
8 import Data.Proxy (Proxy(..))
9 import Data.Text as Text
10 import Prelude hiding (zipWith)
12 import Language.Symantic.Typing
13 import Compiling.Term.Test
26 (==>) = test_compile @Ifaces
29 tests = testGroup "Map"
30 [ "Map.fromList (zipWith (\\(x:Integer) (y:Char) -> (x, y)) [1, 2, 3] ['a', 'b', 'c'])" ==> Right
31 ( (ty @Map :$ ty @Integer) :$ ty @Char
32 , Map.fromList [(1, 'a'), (2, 'b'), (3, 'c')]
33 , "Map.fromList (((\\x0 -> (\\x1 -> zipWith (\\x2 -> (\\x3 -> (x2, x3))) x0 x1)) (1 : 2 : 3 : [])) ('a' : 'b' : 'c' : []))" )
36 , " (\\(k:Integer) (v:Char) (acc:(Integer,[Char])) ->"
37 , " (k + fst acc, v : snd acc))"
39 , " (Map.fromList (zipWith (\\(x:Integer) (y:Char) -> (x,y)) [1, 2, 3] ['a', 'b', 'c']))"
41 ( (ty @(,) :$ ty @Integer) :$ (ty @[] :$ ty @Char)
43 , "((\\x0 -> (\\x1 -> Map.foldrWithKey (\\x2 -> (\\x3 -> (\\x4 -> ((\\x5 -> x2 + x5) (fst x4), x3 : snd x4)))) x0 x1)) (0, [])) (Map.fromList (((\\x0 -> (\\x1 -> zipWith (\\x2 -> (\\x3 -> (x2, x3))) x0 x1)) (1 : 2 : 3 : [])) ('a' : 'b' : 'c' : [])))" )