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