summaryrefslogtreecommitdiff
path: root/paper/While/Yard.dcl
blob: f848666b839bb5f4efd37bd56328e6dc79dd768d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
definition module Yard

// Stolen from https://github.com/dopefishh/cc1516/blob/master/yard.dcl;
// minor changes made to not depend on clean-platform

from StdString import class toString
from StdClass import class ==

import Common

:: Parser a b = Parser ([a] -> (Either Error b, [a]))

instance Functor (Parser a)
instance Applicative (Parser a)
instance Monad (Parser a)
instance Alternative (Parser a)

runParser :: (Parser a b) [a] -> (Either Error b, [a])
(<?>) :: (Parser a b) Error -> Parser a b
fail :: Parser a b
top :: Parser a a
peek :: Parser a a
satisfy :: (a -> Bool) -> Parser a a
check :: (a -> Bool) -> Parser a a
(until) infix 2 :: (Parser a b) (Parser a c) -> Parser a [b]
item :: a -> Parser a a | == a
list :: [a] -> Parser a [a] | == a