]> Git — Sourcephile - haskell/symantic.git/blob - symantic-lib/test/HUnit/Applicative.hs
Move symantic-document to its own Git repository.
[haskell/symantic.git] / symantic-lib / test / HUnit / Applicative.hs
1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 module HUnit.Applicative where
3
4 import Test.Tasty
5 import Control.Applicative (Applicative)
6 import Data.Bool
7 import Data.Either (Either(..))
8 import Data.Functor (Functor)
9 import Data.Maybe (Maybe(..))
10 import Data.Proxy (Proxy(..))
11 import Prelude (Integer)
12
13 import Language.Symantic.Lib
14 import Testing.Compiling
15 import HUnit.Bool ()
16
17 type SS =
18 [ Proxy (->)
19 , Proxy Integer
20 , Proxy Bool
21 , Proxy Maybe
22 , Proxy Functor
23 , Proxy Applicative
24 ]
25 (==>) = readTe @() @SS
26
27 hunits :: TestTree
28 hunits = testGroup "Applicative"
29 [ "Just (xor True) <*> Just True" ==> Right (tyMaybe tyBool, Just False, "Just (\\x0 -> True `xor` x0) <*> Just True")
30 , "Just (xor True) <*> Nothing" ==> Right (tyMaybe tyBool, Nothing , "Just (\\x0 -> True `xor` x0) <*> Nothing")
31 , "xor <$> Just True <*> Just False" ==> Right (tyMaybe tyBool, Just True , "(\\x0 -> (\\x1 -> x0 `xor` x1)) <$> Just True <*> Just False")
32 , "Just False <* Just True" ==> Right (tyMaybe tyBool, Just False, "Just False <* Just True")
33 , "Just False *> Just True" ==> Right (tyMaybe tyBool, Just True , "Just False *> Just True")
34 ]