Skip to content

Commit

Permalink
Parse command symbols into the void.
Browse files Browse the repository at this point in the history
  • Loading branch information
robrix committed Oct 19, 2020
1 parent 114e6d5 commit d6773ba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Facet/REPL/Parser.hs
Expand Up @@ -8,6 +8,7 @@ module Facet.REPL.Parser
) where

import Control.Applicative (Alternative(..))
import Data.Functor (void)
import Text.Parser.Char
import Text.Parser.Combinators
import Text.Parser.Position
Expand All @@ -34,9 +35,9 @@ parseCommands = choice . map go
where
go c = parseSymbols (symbols c) *> parseValue (value c)
parseSymbols = \case
[] -> pure ""
[] -> pure ()
ss -> choice (map parseSymbol ss)
parseSymbol s = token (try (string (':':s) <* (eof <|> someSpace))) <?> (':':s)
parseSymbol s = void $ token (try (string (':':s) <* (eof <|> someSpace))) <?> (':':s)
parseValue = \case
Pure a -> pure a
Meta _ p -> p

0 comments on commit d6773ba

Please sign in to comment.