]> Git — Sourcephile - haskell/symantic-parser.git/blob - test/Machine.hs
bug: a ref outside its def must be supported
[haskell/symantic-parser.git] / test / Machine.hs
1 {-# LANGUAGE DataKinds #-}
2 {-# LANGUAGE ExistentialQuantification #-}
3 {-# LANGUAGE FlexibleContexts #-}
4 {-# LANGUAGE RankNTypes #-}
5 {-# LANGUAGE TypeFamilies #-}
6 module Machine where
7
8 import Data.Text (Text)
9 import Data.Functor ((<$>))
10
11 import qualified Symantic.Parser as P
12 import Grammar
13
14 -- | Existential type to gather machines
15 -- returning different values in the same @('machines')@ list.
16 data M = forall a. M (
17 forall repr inp. inp ~ Text =>
18 P.Machine (P.InputToken inp) repr =>
19 repr inp '[] a
20 )
21
22 machines :: [M]
23 machines = (\(G g) -> M (P.machine g)) <$> grammars