]> Git — Sourcephile - haskell/symantic.git/blob - symantic-lib/Language/Symantic/Lib/Functor/Test.hs
Add compileWithTyCtx.
[haskell/symantic.git] / symantic-lib / Language / Symantic / Lib / Functor / Test.hs
1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 module Lib.Functor.Test where
3
4 import Test.Tasty
5
6 import Data.Proxy (Proxy(..))
7 import Prelude hiding ((&&), not, (||))
8
9 import Language.Symantic.Typing
10 import Compiling.Term.Test
11
12 type Ifaces =
13 [ Proxy (->)
14 , Proxy Bool
15 , Proxy Functor
16 , Proxy Integer
17 , Proxy Maybe
18 ]
19 (==>) = test_compile @Ifaces
20
21 tests :: TestTree
22 tests = testGroup "Functor"
23 [ "fmap not (Just True)" ==> Right
24 ( ty @Maybe :$ ty @Bool
25 , Just False
26 , "fmap (\\x0 -> not x0) (Just True)")
27 , "not `fmap` Just True" ==> Right
28 ( ty @Maybe :$ ty @Bool
29 , Just False
30 , "fmap (\\x0 -> not x0) (Just True)")
31 , "not <$> Just True" ==> Right
32 ( ty @Maybe :$ ty @Bool
33 , Just False
34 , "fmap (\\x0 -> not x0) (Just True)")
35 , "False <$ Just True" ==> Right
36 ( ty @Maybe :$ ty @Bool
37 , Just False
38 , "False <$ Just True" )
39 ]