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