]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Compiling/MonoFunctor/Test.hs
Add Compiling.MonoFoldable.
[haskell/symantic.git] / Language / Symantic / Compiling / MonoFunctor / Test.hs
1 {-# LANGUAGE DataKinds #-}
2 {-# LANGUAGE NoMonomorphismRestriction #-}
3 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
4 {-# OPTIONS_GHC -O0 #-} -- speedup compile-time…
5 module Compiling.MonoFunctor.Test where
6
7 import Test.Tasty
8
9 import qualified Data.MonoTraversable as MT
10 import Data.Proxy (Proxy(..))
11 import Data.Text (Text)
12 import Prelude hiding (zipWith)
13
14 import Language.Symantic.Typing
15 import Language.Symantic.Compiling
16 import Compiling.Term.Test
17
18 -- * Tests
19 type Ifaces =
20 [ Proxy (->)
21 , Proxy []
22 , Proxy Bool
23 , Proxy Char
24 , Proxy Text
25 , Proxy MT.MonoFunctor
26 , Proxy Maybe
27 ]
28 (==>) = test_term_from (Proxy::Proxy Ifaces)
29
30 tests :: TestTree
31 tests = testGroup "MonoFunctor"
32 [ Syntax "omap"
33 [ syLam (Syntax "x" []) syBool
34 (Syntax "not" [Syntax "x" []])
35 , syJust [syTrue]
36 ] ==> Right (tyMaybe :$ tyBool, Just False, "omap (\\x0 -> (\\x1 -> not x1) x0) (Just True)")
37 , Syntax "omap"
38 [ syLam (Syntax "x" []) syChar
39 (Syntax "Char.toUpper" [Syntax "x" []])
40 , Syntax "text" [Syntax "\"abc\"" []]
41 ] ==> Right (tyText, "ABC", "omap (\\x0 -> (\\x1 -> Char.toUpper x1) x0) \"abc\"")
42 ]