]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Compiling/Foldable/Test.hs
Add Compiling.MonoFoldable.
[haskell/symantic.git] / Language / Symantic / Compiling / Foldable / Test.hs
1 {-# LANGUAGE DataKinds #-}
2 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
3 {-# OPTIONS_GHC -O0 #-} -- speedup compile-time…
4 module Compiling.Foldable.Test where
5
6 import Test.Tasty
7
8 import Data.Proxy (Proxy(..))
9
10 import Language.Symantic.Typing
11 import Language.Symantic.Compiling
12 import Compiling.Term.Test
13
14 -- * Tests
15 type Ifaces =
16 [ Proxy (->)
17 , Proxy []
18 , Proxy Int
19 , Proxy Foldable
20 ]
21 (==>) = test_term_from (Proxy::Proxy Ifaces)
22
23 tests :: TestTree
24 tests = testGroup "Foldable"
25 [ Syntax "foldMap"
26 [ syLam (Syntax "x" []) syInt $
27 Syntax "list"
28 [ syInt
29 , Syntax "x" []
30 , Syntax "x" []
31 ]
32 , Syntax "list"
33 [ syInt
34 , Syntax "int" [Syntax "1" []]
35 , Syntax "int" [Syntax "2" []]
36 , Syntax "int" [Syntax "3" []]
37 ]
38 ] ==> Right
39 ( tyList :$ tyInt
40 , [1, 1, 2, 2, 3, 3]
41 , "foldMap (\\x0 -> [x0, x0]) [1, 2, 3]" )
42 ]