Blah
parent
57dfaef8a4
commit
96103ea665
|
@ -42,12 +42,18 @@ instance bindParser :: Bind Parser where
|
|||
let (Parser p2) = f x
|
||||
in p2 xs
|
||||
|
||||
charP :: Char -> Parser Boolean
|
||||
charP c = (_ == c) <$> itemP
|
||||
|
||||
isf :: Parser Boolean
|
||||
isf = (_ == 'f') <$> itemP
|
||||
|
||||
isf2 :: Parser Boolean
|
||||
isf2 = (==) <$> itemP <*> pure 'f'
|
||||
|
||||
isf3 :: Parser Boolean
|
||||
isf3 = charP 'f'
|
||||
|
||||
ishi :: Parser (Tuple Boolean Boolean)
|
||||
ishi = Tuple <$> ((_ == 'h') <$> itemP) <*> ((_ == 'i') <$> itemP)
|
||||
|
||||
|
@ -68,25 +74,25 @@ main :: Effect Unit
|
|||
main = do
|
||||
log "🍝"
|
||||
|
||||
case parse ishi2 "hi" of
|
||||
Just (Tuple x y) -> log ("parsing 'hi': " <> show x <> " " <> show y)
|
||||
Nothing -> log "coudn't parse two letters"
|
||||
log $ "parsing 'hi': " <> case parse ishi2 "hi" of
|
||||
Just (Tuple x y) -> show x <> " " <> show y
|
||||
Nothing -> "coudn't parse two letters"
|
||||
|
||||
case parse ishi2 "no" of
|
||||
Just (Tuple x y) -> log ("parsing 'no': " <> show x <> " " <> show y)
|
||||
Nothing -> log "coudn't parse two letters"
|
||||
log $ "parsing 'no': " <> case parse ishi2 "no" of
|
||||
Just (Tuple x y) -> show x <> " " <> show y
|
||||
Nothing -> "coudn't parse two letters"
|
||||
|
||||
case parse ishi2 "ho" of
|
||||
Just (Tuple x y) -> log ("parsing 'ho': " <> show x <> " " <> show y)
|
||||
Nothing -> log "coudn't parse two letters"
|
||||
log $ "parsing 'ho': " <> case parse ishi2 "ho" of
|
||||
Just (Tuple x y) -> show x <> " " <> show y
|
||||
Nothing -> "coudn't parse two letters"
|
||||
|
||||
case parse ishi2 "ni" of
|
||||
Just (Tuple x y) -> log ("parsing 'ni': " <> show x <> " " <> show y)
|
||||
Nothing -> log "coudn't parse two letters"
|
||||
log $ "parsing 'ni': " <> case parse ishi2 "ni" of
|
||||
Just (Tuple x y) -> show x <> " " <> show y
|
||||
Nothing -> "coudn't parse two letters"
|
||||
|
||||
case parse ishi2 "" of
|
||||
Just (Tuple x y) -> log ("parsing '': " <> show x <> " " <> show y)
|
||||
Nothing -> log "coudn't parse two letters"
|
||||
log $ "parsing '': " <> case parse ishi2 "" of
|
||||
Just (Tuple x y) -> show x <> " " <> show y
|
||||
Nothing -> "coudn't parse two letters"
|
||||
|
||||
|
||||
-- JUST WORKS
|
||||
|
|
Loading…
Reference in New Issue