1 {-# LANGUAGE UndecidableInstances #-}
2 {-# OPTIONS_GHC -fno-warn-orphans #-}
3 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
4 {-# OPTIONS_GHC -O0 #-} -- speedup compile-time…
5 module Compiling.Foldable.Test where
9 import Data.Proxy (Proxy(..))
10 import Data.Text (Text)
12 import Language.Symantic.Parsing
13 import Language.Symantic.Typing
14 import Language.Symantic.Compiling
15 import Compiling.Term.Test
25 (==>) = test_compile (Proxy::Proxy Ifaces)
28 ( Inj_Token (Syntax Text) ts Foldable
29 , Tokenize (Syntax Text) (Syntax Text) ts ) =>
30 TokenizeT (Syntax Text) (Syntax Text) ts (Proxy Foldable) where
31 tokenizeT _t (Syntax "foldMap" (ast_f : ast_m : as)) = Just $ do
34 Right $ (as,) $ EToken $ inj_token (Syntax "foldMap" [ast_f, ast_m]) $
35 Token_Term_Foldable_foldMap f m
36 tokenizeT _t _sy = Nothing
39 tests = testGroup "Foldable"
41 [ syLam "x" (sy @Int) $
56 , "foldMap (\\x0 -> [x0, x0]) [1, 2, 3]" )