Keep strict.
parent
6f1e8de814
commit
6eab07e732
|
@ -119,6 +119,10 @@ parseSingle = expr >>= either (fail . unpack) pure
|
|||
-- Strict
|
||||
-- ========================================
|
||||
|
||||
instance NFData Result where
|
||||
rnf (RInt e) = e `seq` ()
|
||||
rnf (RBool e) = e `seq` ()
|
||||
|
||||
parseStrict :: Parser Result
|
||||
parseStrict = term >>= expr
|
||||
where
|
||||
|
@ -144,7 +148,7 @@ parseStrict = term >>= expr
|
|||
lhs <- cast t
|
||||
rhs <- cast t'
|
||||
toResult $ bin (f lhs) (f rhs)
|
||||
a `seq` expr a
|
||||
a `deepseq` expr a
|
||||
|
||||
term = do
|
||||
p <- M.option Nothing $ Just <$> symbol "("
|
||||
|
|
|
@ -130,9 +130,9 @@ binDyn bin lhs rhs = do
|
|||
pure . Dynamic type' $ bin lhs' rhs'
|
||||
|
||||
parseSingle :: forall repr. Symantics repr => Parser (Dynamic repr)
|
||||
parseSingle = expr >>= \case
|
||||
Left (offset, msg) -> M.setOffset offset >> fail msg
|
||||
Right a -> pure a
|
||||
parseSingle =
|
||||
let ferr (offset, msg) = M.setOffset offset >> fail msg
|
||||
in expr >>= either ferr pure
|
||||
where
|
||||
expr = E.makeExprParser term
|
||||
[ [binary "+" eAdd, binary "-" eSub]
|
||||
|
|
Loading…
Reference in New Issue