]> Git — Sourcephile - haskell/symantic.git/blob - symantic-lib/Language/Symantic/Lib/Applicative/Test.hs
Gather type declarations and infix declarations.
[haskell/symantic.git] / symantic-lib / Language / Symantic / Lib / Applicative / Test.hs
1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 {-# OPTIONS_GHC -O0 -fmax-simplifier-iterations=0 #-}
3 module Lib.Applicative.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 import Lib.Bool.Test ()
13
14 type Ifaces =
15 [ Proxy (->)
16 , Proxy Integer
17 , Proxy Bool
18 , Proxy Maybe
19 , Proxy Functor
20 , Proxy Applicative
21 ]
22 (==>) = test_compile @Ifaces
23
24 tests :: TestTree
25 tests = testGroup "Applicative"
26 [ "Just (xor True) <*> Just True" ==> Right
27 ( ty @Maybe :$ ty @Bool
28 , Just False
29 , "(\\x0 -> Just ((\\x1 -> (\\x2 -> x1 `xor` x2)) True) <*> x0) (Just True)" )
30 , "Just (xor True) <*> Nothing @Bool" ==> Right
31 ( ty @Maybe :$ ty @Bool
32 , Nothing
33 , "(\\x0 -> Just ((\\x1 -> (\\x2 -> x1 `xor` x2)) True) <*> x0) Nothing" )
34 , "xor <$> Just True <*> Just False" ==> Right
35 ( ty @Maybe :$ ty @Bool
36 , Just True
37 , "(\\x0 -> fmap (\\x1 -> (\\x2 -> x1 `xor` x2)) (Just True) <*> x0) (Just False)" )
38 , "Just False <* Just True" ==> Right
39 ( ty @Maybe :$ ty @Bool
40 , Just False
41 , "Just False <* Just True" )
42 , "Just False *> Just True" ==> Right
43 ( ty @Maybe :$ ty @Bool
44 , Just True
45 , "Just False *> Just True" )
46 ]