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