]> Git — Sourcephile - haskell/symantic.git/blob - symantic-lib/Language/Symantic/Lib/Foldable/Test.hs
Add Lib.{Bounded,Enum,Ratio,Rational,Real,Semigroup}.
[haskell/symantic.git] / symantic-lib / Language / Symantic / Lib / Foldable / Test.hs
1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 module Lib.Foldable.Test where
3
4 import Test.Tasty
5
6 import Data.Proxy (Proxy(..))
7 import Prelude hiding ((&&), not, (||))
8
9 import Language.Symantic.Typing
10 import Compiling.Term.Test
11
12 type Ifaces =
13 [ Proxy (->)
14 , Proxy Int
15 , Proxy Integer
16 , Proxy []
17 , Proxy ()
18 , Proxy (,)
19 , Proxy Foldable
20 ]
21 (==>) = test_compile @Ifaces
22
23 tests :: TestTree
24 tests = testGroup "Foldable"
25 [ "[] @Integer" ==> Right (ty @[] :$ ty @Integer, [], "[]")
26 , "[1, 2, 3]" ==> Right (ty @[] :$ ty @Integer, [1, 2, 3], "1 : 2 : 3 : []")
27 , "foldMap (\\(x0:Integer) -> [x0, x0]) [1, 2, 3]" ==> Right
28 ( ty @[] :$ ty @Integer
29 , [1, 1, 2, 2, 3, 3]
30 , "foldMap (\\x0 -> x0 : x0 : []) (1 : 2 : 3 : [])" )
31 ]