]> Git — Sourcephile - haskell/symantic.git/blob - symantic-lib/Language/Symantic/Lib/Applicative/Test.hs
Add term Function.($).
[haskell/symantic.git] / symantic-lib / 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.Lib
10 import Compiling.Test
11 import Lib.Bool.Test ()
12
13 type SS =
14 [ Proxy (->)
15 , Proxy Integer
16 , Proxy Bool
17 , Proxy Maybe
18 , Proxy Functor
19 , Proxy Applicative
20 ]
21 (==>) = readTe @() @SS
22
23 tests :: TestTree
24 tests = testGroup "Applicative"
25 [ "Just (xor True) <*> Just True" ==> Right (tyMaybe tyBool, Just False, "Just (\\x0 -> True `xor` x0) <*> Just True")
26 , "Just (xor True) <*> Nothing" ==> Right (tyMaybe tyBool, Nothing , "Just (\\x0 -> True `xor` x0) <*> Nothing")
27 , "xor <$> Just True <*> Just False" ==> Right (tyMaybe tyBool, Just True , "(\\x0 -> (\\x1 -> x0 `xor` x1)) <$> Just True <*> Just False")
28 , "Just False <* Just True" ==> Right (tyMaybe tyBool, Just False, "Just False <* Just True")
29 , "Just False *> Just True" ==> Right (tyMaybe tyBool, Just True , "Just False *> Just True")
30 ]