]> Git — Sourcephile - haskell/symantic.git/blob - symantic-lib/Language/Symantic/Lib/Foldable/Test.hs
Use AllowAmbiguousTypes to avoid using Proxy.
[haskell/symantic.git] / symantic-lib / Language / Symantic / Lib / Foldable / Test.hs
1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 {-# OPTIONS_GHC -O0 -fmax-simplifier-iterations=0 #-}
3 module Lib.Foldable.Test where
4
5 import Test.Tasty
6
7 import Data.Proxy (Proxy(..))
8 import Prelude hiding ((&&), not, (||))
9
10 import Language.Symantic.Typing
11 import Compiling.Term.Test
12
13 type Ifaces =
14 [ Proxy (->)
15 , Proxy Int
16 , Proxy Integer
17 , Proxy []
18 , Proxy ()
19 , Proxy (,)
20 , Proxy Foldable
21 ]
22 (==>) = test_compile @Ifaces
23
24 tests :: TestTree
25 tests = testGroup "Foldable"
26 [ "[] @Integer" ==> Right
27 ( ty @[] :$ ty @Integer
28 , []
29 , "[]" )
30 , "[1, 2, 3]" ==> Right
31 ( ty @[] :$ ty @Integer
32 , [1, 2, 3]
33 , "1 : 2 : 3 : []" )
34 , "foldMap (\\(x0:Integer) -> [x0, x0]) [1, 2, 3]" ==> Right
35 ( ty @[] :$ ty @Integer
36 , [1, 1, 2, 2, 3, 3]
37 , "foldMap (\\x0 -> x0 : x0 : []) (1 : 2 : 3 : [])" )
38 ]