on master help sign in
Update names and some comment.
43a9e32Paweł Nowak
Data/Syntax.hs+4−3
@@ -22,6 +22,7 @@ module Data.Syntax (
22import Prelude hiding (take, takeWhile)
22import Prelude hiding (take, takeWhile)
23
23
24import Control.Category.Reader
24import Control.Category.Reader
25+import Control.Category.Structures
25import Control.Lens.Iso
26import Control.Lens.Iso
26import Control.Lens.SemiIso
27import Control.Lens.SemiIso
27import Control.SIArrow
28import Control.SIArrow
@@ -34,11 +35,11 @@ packed = iso otoList fromList
34
35
35-- | An abstract syntax description based on semi-isomorphisms.
36-- | An abstract syntax description based on semi-isomorphisms.
36--
37--
37−-- This class can be implemented by both parsers and printers (and maybe more?).
38+-- This class can be implemented by both parsers and printers.
38--
39--
39-- The usual use is to write a polymorphic syntax description and instantiate it
40-- The usual use is to write a polymorphic syntax description and instantiate it
40−-- both as a parser and a printer. An example is available in the 'syntax-example'
41+-- both as a parser and a printer. Examples are available in 'syntax-example' and
41−-- package.
42+-- 'syntax-example-json' packages.
42--
43--
43-- Methods of this class try to mimic "Data.Attoparsec.Text" interface.
44-- Methods of this class try to mimic "Data.Attoparsec.Text" interface.
44class ( SIArrow syn
45class ( SIArrow syn
Data/Syntax/Char.hs+1
@@ -26,6 +26,7 @@ module Data.Syntax.Char (
26 ) where
26 ) where
27
27
28import Control.Category.Reader
28import Control.Category.Reader
29+import Control.Category.Structures
29import Control.Lens.SemiIso
30import Control.Lens.SemiIso
30import Control.SIArrow
31import Control.SIArrow
31import Data.Bits
32import Data.Bits
Data/Syntax/Combinator.hs+1
@@ -11,6 +11,7 @@ Combinators that work with any sequence type.
11-}
11-}
12module Data.Syntax.Combinator where
12module Data.Syntax.Combinator where
13
13
14+import Control.Category.Structures
14import Control.Lens
15import Control.Lens
15import Control.Lens.SemiIso
16import Control.Lens.SemiIso
16import Control.SIArrow
17import Control.SIArrow
Data/Syntax/Indent.hs+4−3
@@ -21,6 +21,7 @@ module Data.Syntax.Indent (
21
21
22import Control.Category
22import Control.Category
23import Control.Category.Reader
23import Control.Category.Reader
24+import Control.Category.Structures
24import Control.SIArrow
25import Control.SIArrow
25import Data.Syntax
26import Data.Syntax
26import Data.Syntax.Char
27import Data.Syntax.Char
@@ -28,10 +29,10 @@ import Data.Syntax.Combinator
28import Prelude hiding (takeWhile, take, id, (.))
29import Prelude hiding (takeWhile, take, id, (.))
29
30
30-- | Adds indentation to a syntax description.
31-- | Adds indentation to a syntax description.
31−newtype Indent cat a b = Indent { unIndent :: ReaderCT (Int, cat () ()) cat a b }
32+newtype Indent cat a b = Indent { getIndent :: ReaderCT (Int, cat () ()) cat a b }
32− deriving (Category, Products, Coproducts, CategoryPlus, SIArrow)
33+ deriving (Category, Products, Coproducts, CatPlus, SIArrow)
33
34
34−instance CategoryTrans Indent where
35+instance CatTrans Indent where
35 clift = Indent . clift
36 clift = Indent . clift
36
37
37-- Generalized newtype deriving cannot derive this :(
38-- Generalized newtype deriving cannot derive this :(