{-# LANGUAGE DataKinds #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# OPTIONS_GHC -O0 #-} -- speedup compile-timeā€¦ module Compiling.MonoFunctor.Test where import Test.Tasty import qualified Data.MonoTraversable as MT import Data.Proxy (Proxy(..)) import Data.Text (Text) import Prelude hiding (zipWith) import Language.Symantic.Typing import Language.Symantic.Compiling import Compiling.Term.Test -- * Tests type Ifaces = [ Proxy (->) , Proxy [] , Proxy Bool , Proxy Char , Proxy Text , Proxy MT.MonoFunctor , Proxy Maybe ] (==>) = test_term_from (Proxy::Proxy Ifaces) tests :: TestTree tests = testGroup "MonoFunctor" [ Syntax "omap" [ syLam (Syntax "x" []) syBool (Syntax "not" [Syntax "x" []]) , syJust [syTrue] ] ==> Right (tyMaybe :$ tyBool, Just False, "omap (\\x0 -> (\\x1 -> not x1) x0) (Just True)") , Syntax "omap" [ syLam (Syntax "x" []) syChar (Syntax "Char.toUpper" [Syntax "x" []]) , Syntax "text" [Syntax "\"abc\"" []] ] ==> Right (tyText, "ABC", "omap (\\x0 -> (\\x1 -> Char.toUpper x1) x0) \"abc\"") ]