1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 {-# OPTIONS_GHC -O0 -fmax-simplifier-iterations=0 #-}
3 module Lib.Applicative.Test where
7 import Data.Proxy (Proxy(..))
8 import Prelude hiding ((&&), not, (||))
10 import Language.Symantic.Typing
11 import Compiling.Term.Test
12 import Lib.Bool.Test ()
22 (==>) = test_compile @Ifaces
25 tests = testGroup "Applicative"
26 [ "Just (xor True) <*> Just True" ==> Right
27 ( ty @Maybe :$ ty @Bool
29 , "(\\x0 -> Just ((\\x1 -> (\\x2 -> x1 `xor` x2)) True) <*> x0) (Just True)" )
30 , "Just (xor True) <*> Nothing @Bool" ==> Right
31 ( ty @Maybe :$ ty @Bool
33 , "(\\x0 -> Just ((\\x1 -> (\\x2 -> x1 `xor` x2)) True) <*> x0) Nothing" )
34 , "xor <$> Just True <*> Just False" ==> Right
35 ( ty @Maybe :$ ty @Bool
37 , "(\\x0 -> fmap (\\x1 -> (\\x2 -> x1 `xor` x2)) (Just True) <*> x0) (Just False)" )
38 , "Just False <* Just True" ==> Right
39 ( ty @Maybe :$ ty @Bool
41 , "Just False <* Just True" )
42 , "Just False *> Just True" ==> Right
43 ( ty @Maybe :$ ty @Bool
45 , "Just False *> Just True" )