newtype RuleDef a = RuleDef { unRuleDef :: EBNF a }
deriving (Functor, Applicative)
deriving instance Gram_RuleDef RuleDef
+deriving instance Try RuleDef
instance Gram_Rule RuleDef where
rule n = rule_def (ebnf_const n)
rule1 n g a = rule_def (ebnf_const n `ebnf_arg` unRuleDef a) (g a)
case mo of
RuleMode_Ref -> unEBNF call mo po
RuleMode_Body ->
- Text.intercalate " " $
+ Text.intercalate " "
[ unEBNF call RuleMode_Ref (infixN0, L)
, "="
, unEBNF body RuleMode_Ref (infixN0, R)
= L -- ^ Left
| R -- ^ Right
deriving (Eq, Show)
+
+-- * Type 'Try'
+class Try g where
+ try :: g a -> g a
+instance Try EBNF where
+ try = id