Skip to content

Commit

Permalink
Apply Fourmolu.
Browse files Browse the repository at this point in the history
  • Loading branch information
noteed committed Aug 16, 2024
1 parent 9f59e07 commit c63bd3c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/Slab/Evaluate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,16 @@ evalFrag env stack name values args (Frag names capturedEnv body) = do
case map fst env' \\ names of
[] -> pure ()
["content"] -> pure ()
ns -> throwE . Error.EvaluateError $
"Unnecessary arguments to " <> name <> ": " <> T.pack (show ns)
ns ->
throwE . Error.EvaluateError $
"Unnecessary arguments to " <> name <> ": " <> T.pack (show ns)
let env'' = augmentVariables (removeFormalParams names capturedEnv) env'
arguments = zip names (map (thunk env) values)
env''' = augmentVariables env'' arguments
body' <- evaluate env''' ("frag " <> name : stack) body
pure body'

removeFormalParams names Env {..} = Env { envVariables = vars' }
removeFormalParams names Env {..} = Env {envVariables = vars'}
where
vars' = filter (not . (`elem` names) . fst) envVariables

Expand Down
3 changes: 2 additions & 1 deletion src/Slab/Execute.hs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ exec ctx@(Context {..}) = \case
Syntax.BlockRun cmd minput Nothing -> do
(code, out, err) <-
liftIO $
readCreateProcessWithExitCode (shell $ T.unpack cmd) $ maybe "" T.unpack minput
readCreateProcessWithExitCode (shell $ T.unpack cmd) $
maybe "" T.unpack minput
case code of
ExitSuccess ->
pure $
Expand Down
9 changes: 5 additions & 4 deletions src/Slab/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ parserElemBody ref header =
template <- parseInlines
case template of
[] -> do
s <- parserDotText ref
s <- parserDotText ref
pure $ L.IndentNone $ header [BlockText Dot [Lit s]]
_ -> pure $ L.IndentNone $ header [BlockText Dot template]
HasEqual -> do
Expand Down Expand Up @@ -386,9 +386,10 @@ parserClass =
parserAttrList :: Parser [Attr]
parserAttrList = (<?> "attribute") $ do
_ <- string "("
pairs <- sepBy
(uncurry Attr <$> try parserPair <|> Arg <$> parserExpr)
(lexeme $ string ",")
pairs <-
sepBy
(uncurry Attr <$> try parserPair <|> Arg <$> parserExpr)
(lexeme $ string ",")
_ <- string ")"
pure pairs

Expand Down

0 comments on commit c63bd3c

Please sign in to comment.