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