import Symantic.Parser.Grammar.Combinators
import Symantic.Parser.Grammar.Production
-import Symantic.Parser.Grammar.ObserveSharing hiding (def)
+import Symantic.Parser.Grammar.ObserveSharing
import Symantic.Derive
+import qualified Symantic.Class as Prod
import qualified Symantic.Data as Prod
-import qualified Symantic.Lang as Prod
{-
import Data.Function (($), flip)
instance LiftDerived (KnotComb letName repr) where
liftDerived x = KnotComb
{ knotCombOpens = HM.empty
- , knotCombOpen = \finals -> TiedComb
+ , knotCombOpen = \_final -> TiedComb
{ combSimpl = x
}
}
instance LiftDerived1 (KnotComb letName repr) where
liftDerived1 f a = a
- { knotCombOpen = \finals -> TiedComb
- { combSimpl = f (combSimpl (knotCombOpen a finals))
+ { knotCombOpen = \final -> TiedComb
+ { combSimpl = f (combSimpl (knotCombOpen a final))
}
}
instance (Eq letName, Hashable letName) => LiftDerived2 (KnotComb letName repr) where
liftDerived2 f a b = KnotComb
{ knotCombOpens = knotCombOpens a <> knotCombOpens b
- , knotCombOpen = \finals -> TiedComb
+ , knotCombOpen = \final -> TiedComb
{ combSimpl = f
- (combSimpl (knotCombOpen a finals))
- (combSimpl (knotCombOpen b finals))
+ (combSimpl (knotCombOpen a final))
+ (combSimpl (knotCombOpen b final))
}
}
instance (Eq letName, Hashable letName) => LiftDerived3 (KnotComb letName repr) where
, knotCombOpens b
, knotCombOpens c
]
- , knotCombOpen = \finals -> TiedComb
+ , knotCombOpen = \final -> TiedComb
{ combSimpl = f
- (combSimpl (knotCombOpen a finals))
- (combSimpl (knotCombOpen b finals))
- (combSimpl (knotCombOpen c finals))
+ (combSimpl (knotCombOpen a final))
+ (combSimpl (knotCombOpen b final))
+ (combSimpl (knotCombOpen c final))
}
}
instance (Eq letName, Hashable letName) => LiftDerived4 (KnotComb letName repr) where
, knotCombOpens c
, knotCombOpens d
]
- , knotCombOpen = \finals -> TiedComb
+ , knotCombOpen = \final -> TiedComb
{ combSimpl = f
- (combSimpl (knotCombOpen a finals))
- (combSimpl (knotCombOpen b finals))
- (combSimpl (knotCombOpen c finals))
- (combSimpl (knotCombOpen d finals))
+ (combSimpl (knotCombOpen a final))
+ (combSimpl (knotCombOpen b final))
+ (combSimpl (knotCombOpen c final))
+ (combSimpl (knotCombOpen d final))
}
}
$ knotCombOpens a
: knotCombOpens d
: ((\(_p, b) -> knotCombOpens b) F.<$> bs)
- , knotCombOpen = \finals -> TiedComb
+ , knotCombOpen = \final -> TiedComb
{ combSimpl = conditional
- (combSimpl (knotCombOpen a finals))
- ((\(p, b) -> (p, combSimpl (knotCombOpen b finals))) F.<$> bs)
- (combSimpl (knotCombOpen d finals))
+ (combSimpl (knotCombOpen a final))
+ ((\(p, b) -> (p, combSimpl (knotCombOpen b final))) F.<$> bs)
+ (combSimpl (knotCombOpen d final))
}
}
}
getUnscoped r = SimplComb
{ combData = GetUnscoped r
- , combInline = False -- FIXME: True
+ , combInline = True
, combRefs = HS.empty
}
putUnscoped r x = SimplComb
-- since there is only a single 'lets' at the top of the AST,
-- but well.
: ((\(SomeLet sub) -> knotCombOpens sub) F.<$> HM.elems defs)
- , knotCombOpen = \finals -> TiedComb
+ , knotCombOpen = \final -> TiedComb
{ combSimpl =
- let bodySimpl = combSimpl $ knotCombOpen body finals in
- let defsSimpl = (\(SomeLet sub) -> SomeLet $ combSimpl $ knotCombOpen sub finals) F.<$> defs in
+ let bodySimpl = combSimpl $ knotCombOpen body final in
+ let defsSimpl = (\(SomeLet sub) -> SomeLet $ combSimpl $ knotCombOpen sub final) F.<$> defs in
let defsUsed = HS.unions
$ combRefs bodySimpl
: ((\(SomeLet sub) -> combRefs sub) F.<$> HM.elems defsSimpl) in
Referenceable TH.Name (KnotComb TH.Name repr) where
ref isRec name = KnotComb
{ knotCombOpens = HM.empty
- , knotCombOpen = \finals ->
+ , knotCombOpen = \final ->
if isRec
then TiedComb
{ combSimpl = ref isRec name
}
- else case finals HM.! name of
+ else case final HM.! name of
SomeLet a@TiedComb
{ combSimpl = p@SimplComb{ combInline = True }
} -> a{combSimpl = unsafeSimplComb p}