]> Git — Sourcephile - haskell/symantic.git/blob - Language/Symantic/Compiling/Functor/Test.hs
Add tests for Compiling.
[haskell/symantic.git] / Language / Symantic / Compiling / Functor / Test.hs
1 {-# LANGUAGE DataKinds #-}
2 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
3 module Compiling.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 Language.Symantic.Compiling
12 import Compiling.Term.Test
13
14 -- * Tests
15 type Ifaces =
16 [ Proxy (->)
17 , Proxy Bool
18 , Proxy Maybe
19 , Proxy Functor
20 ]
21 (==>) = test_term_from (Proxy::Proxy Ifaces)
22
23 tests :: TestTree
24 tests = testGroup "Functor"
25 [ Syntax "fmap"
26 [ syLam (Syntax "x" []) syBool
27 (Syntax "not" [Syntax "x" []])
28 , syJust [syTrue]
29 ] ==> Right (tyMaybe :$ tyBool, Just False, "fmap (\\x0 -> (\\x1 -> not x1) x0) (Just True)")
30 , Syntax "<$"
31 [ syFalse
32 , syJust [syTrue]
33 ] ==> Right (tyMaybe :$ tyBool, Just False, "False <$ Just True")
34 ]