1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 module Lib.Applicative.Test where
6 import Data.Proxy (Proxy(..))
7 import Prelude hiding ((&&), not, (||))
9 import Language.Symantic.Typing
10 import Compiling.Term.Test
11 import Lib.Bool.Test ()
21 (==>) = test_compile (Proxy::Proxy Ifaces)
24 tests = testGroup "Applicative"
25 [ "Just (xor True) <*> Just True" ==> Right
26 ( ty @Maybe :$ ty @Bool
28 , "(\\x0 -> Just ((\\x1 -> (\\x2 -> x1 `xor` x2)) True) <*> x0) (Just True)" )
29 , "Just (xor True) <*> Nothing @Bool" ==> Right
30 ( ty @Maybe :$ ty @Bool
32 , "(\\x0 -> Just ((\\x1 -> (\\x2 -> x1 `xor` x2)) True) <*> x0) Nothing" )
33 , "xor <$> Just True <*> Just False" ==> Right
34 ( ty @Maybe :$ ty @Bool
36 , "(\\x0 -> fmap (\\x1 -> (\\x2 -> x1 `xor` x2)) (Just True) <*> x0) (Just False)" )
37 , "Just False <* Just True" ==> Right
38 ( ty @Maybe :$ ty @Bool
40 , "Just False <* Just True" )
41 , "Just False *> Just True" ==> Right
42 ( ty @Maybe :$ ty @Bool
44 , "Just False *> Just True" )