Use AllowAmbiguousTypes to avoid using Proxy.
[haskell/symantic.git] / symantic-grammar / Language / Symantic / Grammar / EBNF.hs
index 44e08c35884e457635f698644bb86592656100d2..8731113af1b752e50232b3e4a729425b1aa0d904 100644 (file)
@@ -62,6 +62,7 @@ data RuleMode
 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)
@@ -110,7 +111,7 @@ instance Gram_RuleDef EBNF where
                        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)
@@ -182,3 +183,9 @@ data LR
  = L -- ^ Left
  | R -- ^ Right
  deriving (Eq, Show)
+
+-- * Type 'Try'
+class Try g where
+       try :: g a -> g a
+instance Try EBNF where
+       try = id