git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Improve documentation generation using new prettyPrintTypeAtom
commit6f56560bf67fd206cac4021f0bc3cdf9ba8dadb7 authorPhil Freeman <paf31@cantab.net> dateThu 6 Mar 2014, 23:02 (13 years ago) parent2e0c57d
4 files changed+61−60
docgen/Main.hs+2−2 docs/source/prelude.rst+29−29 prelude/README.md+29−29 src/Language/PureScript/Pretty/Types.hs+1
docgen/Main.hs+2−2
@@ -128,8 +128,8 @@ renderDeclaration n exps (P.TypeClassDeclaration name args ds) = do
128128renderDeclaration n _ (P.TypeInstanceDeclaration name constraints className tys _) = do
129129 let constraintsText = case constraints of
130130 [] -> ""
131− cs -> "(" ++ intercalate "," (map (\(pn, tys') -> show pn ++ " (" ++ unwords (map (("(" ++) . (++ ")") . P.prettyPrintType) tys') ++ ")") cs) ++ ") => "
132− atIndent n $ constraintsText ++ "instance " ++ show name ++ " :: " ++ show className ++ " " ++ unwords (map (("(" ++) . (++ ")") . P.prettyPrintType) tys)
131+ cs -> "(" ++ intercalate ", " (map (\(pn, tys') -> show pn ++ " " ++ unwords (map P.prettyPrintTypeAtom tys')) cs) ++ ") => "
132+ atIndent n $ "instance " ++ show name ++ " :: " ++ constraintsText ++ show className ++ " " ++ unwords (map P.prettyPrintTypeAtom tys)
133133renderDeclaration _ _ _ = return ()
134134
135135getName :: P.Declaration -> String
docs/source/prelude.rst+29−29
@@ -75,39 +75,39 @@ Type Class Instances
7575
7676::
7777
78− (Monad ((m))) => instance applicativeFromMonad :: Applicative (m)
78+ instance applicativeFromMonad :: (Monad m) => Applicative m
7979
80− instance bitsNumber :: Bits (Prim.Number)
80+ instance bitsNumber :: Bits Prim.Number
8181
82− instance boolLikeBoolean :: BoolLike (Prim.Boolean)
82+ instance boolLikeBoolean :: BoolLike Prim.Boolean
8383
84− instance categoryArr :: Category (Prim.Function)
84+ instance categoryArr :: Category Prim.Function
8585
86− (Eq ((a))) => instance eqArray :: Eq ([a])
86+ instance eqArray :: (Eq a) => Eq [a]
8787
88− instance eqBoolean :: Eq (Prim.Boolean)
88+ instance eqBoolean :: Eq Prim.Boolean
8989
90− instance eqNumber :: Eq (Prim.Number)
90+ instance eqNumber :: Eq Prim.Number
9191
92− instance eqString :: Eq (Prim.String)
92+ instance eqString :: Eq Prim.String
9393
94− (Applicative ((f))) => instance functorFromApplicative :: Functor (f)
94+ instance functorFromApplicative :: (Applicative f) => Functor f
9595
96− instance numNumber :: Num (Prim.Number)
96+ instance numNumber :: Num Prim.Number
9797
98− instance ordNumber :: Ord (Prim.Number)
98+ instance ordNumber :: Ord Prim.Number
9999
100− instance readBoolean :: Read (Prim.Boolean)
100+ instance readBoolean :: Read Prim.Boolean
101101
102− instance readNumber :: Read (Prim.Number)
102+ instance readNumber :: Read Prim.Number
103103
104− instance readString :: Read (Prim.String)
104+ instance readString :: Read Prim.String
105105
106− instance showBoolean :: Show (Prim.Boolean)
106+ instance showBoolean :: Show Prim.Boolean
107107
108− instance showNumber :: Show (Prim.Number)
108+ instance showNumber :: Show Prim.Number
109109
110− instance showString :: Show (Prim.String)
110+ instance showString :: Show Prim.String
111111
112112Values
113113~~~~~~
@@ -194,9 +194,9 @@ Type Class Instances
194194
195195::
196196
197− instance monoidArray :: Monoid ([a])
197+ instance monoidArray :: Monoid [a]
198198
199− instance monoidString :: Monoid (Prim.String)
199+ instance monoidString :: Monoid Prim.String
200200
201201Values
202202~~~~~~
@@ -260,13 +260,13 @@ Type Class Instances
260260
261261::
262262
263− instance applicativeMaybe :: Applicative (Maybe)
263+ instance applicativeMaybe :: Applicative Maybe
264264
265− instance functorMaybe :: Functor (Maybe)
265+ instance functorMaybe :: Functor Maybe
266266
267− instance monadMaybe :: Monad (Maybe)
267+ instance monadMaybe :: Monad Maybe
268268
269− (Show ((a))) => instance showMaybe :: Show (Maybe a)
269+ instance showMaybe :: (Show a) => Show (Maybe a)
270270
271271Values
272272~~~~~~
@@ -303,7 +303,7 @@ Type Class Instances
303303
304304 instance monadEither :: Monad (Either e)
305305
306− (Show ((a)),Show ((b))) => instance showEither :: Show (Either a b)
306+ instance showEither :: (Show a, Show b) => Show (Either a b)
307307
308308Values
309309~~~~~~
@@ -326,13 +326,13 @@ Type Class Instances
326326
327327::
328328
329− instance alternativeArray :: Alternative (Prim.Array)
329+ instance alternativeArray :: Alternative Prim.Array
330330
331− instance functorArray :: Functor (Prim.Array)
331+ instance functorArray :: Functor Prim.Array
332332
333− instance monadArray :: Monad (Prim.Array)
333+ instance monadArray :: Monad Prim.Array
334334
335− (Show ((a))) => instance showArray :: Show ([a])
335+ instance showArray :: (Show a) => Show [a]
336336
337337Values
338338~~~~~~
@@ -473,7 +473,7 @@ Type Class Instances
473473
474474::
475475
476− (Show ((a)),Show ((b))) => instance showTuple :: Show (Tuple a b)
476+ instance showTuple :: (Show a, Show b) => Show (Tuple a b)
477477
478478Values
479479~~~~~~
prelude/README.md+29−29
@@ -67,39 +67,39 @@
6767
6868### Type Class Instances
6969
70− (Monad ((m))) => instance applicativeFromMonad :: Applicative (m)
70+ instance applicativeFromMonad :: (Monad m) => Applicative m
7171
72− instance bitsNumber :: Bits (Prim.Number)
72+ instance bitsNumber :: Bits Prim.Number
7373
74− instance boolLikeBoolean :: BoolLike (Prim.Boolean)
74+ instance boolLikeBoolean :: BoolLike Prim.Boolean
7575
76− instance categoryArr :: Category (Prim.Function)
76+ instance categoryArr :: Category Prim.Function
7777
78− (Eq ((a))) => instance eqArray :: Eq ([a])
78+ instance eqArray :: (Eq a) => Eq [a]
7979
80− instance eqBoolean :: Eq (Prim.Boolean)
80+ instance eqBoolean :: Eq Prim.Boolean
8181
82− instance eqNumber :: Eq (Prim.Number)
82+ instance eqNumber :: Eq Prim.Number
8383
84− instance eqString :: Eq (Prim.String)
84+ instance eqString :: Eq Prim.String
8585
86− (Applicative ((f))) => instance functorFromApplicative :: Functor (f)
86+ instance functorFromApplicative :: (Applicative f) => Functor f
8787
88− instance numNumber :: Num (Prim.Number)
88+ instance numNumber :: Num Prim.Number
8989
90− instance ordNumber :: Ord (Prim.Number)
90+ instance ordNumber :: Ord Prim.Number
9191
92− instance readBoolean :: Read (Prim.Boolean)
92+ instance readBoolean :: Read Prim.Boolean
9393
94− instance readNumber :: Read (Prim.Number)
94+ instance readNumber :: Read Prim.Number
9595
96− instance readString :: Read (Prim.String)
96+ instance readString :: Read Prim.String
9797
98− instance showBoolean :: Show (Prim.Boolean)
98+ instance showBoolean :: Show Prim.Boolean
9999
100− instance showNumber :: Show (Prim.Number)
100+ instance showNumber :: Show Prim.Number
101101
102− instance showString :: Show (Prim.String)
102+ instance showString :: Show Prim.String
103103
104104
105105### Values
@@ -179,9 +179,9 @@
179179
180180### Type Class Instances
181181
182− instance monoidArray :: Monoid ([a])
182+ instance monoidArray :: Monoid [a]
183183
184− instance monoidString :: Monoid (Prim.String)
184+ instance monoidString :: Monoid Prim.String
185185
186186
187187### Values
@@ -235,13 +235,13 @@
235235
236236### Type Class Instances
237237
238− instance applicativeMaybe :: Applicative (Maybe)
238+ instance applicativeMaybe :: Applicative Maybe
239239
240− instance functorMaybe :: Functor (Maybe)
240+ instance functorMaybe :: Functor Maybe
241241
242− instance monadMaybe :: Monad (Maybe)
242+ instance monadMaybe :: Monad Maybe
243243
244− (Show ((a))) => instance showMaybe :: Show (Maybe a)
244+ instance showMaybe :: (Show a) => Show (Maybe a)
245245
246246
247247### Values
@@ -271,7 +271,7 @@
271271
272272 instance monadEither :: Monad (Either e)
273273
274− (Show ((a)),Show ((b))) => instance showEither :: Show (Either a b)
274+ instance showEither :: (Show a, Show b) => Show (Either a b)
275275
276276
277277### Values
@@ -289,13 +289,13 @@
289289
290290### Type Class Instances
291291
292− instance alternativeArray :: Alternative (Prim.Array)
292+ instance alternativeArray :: Alternative Prim.Array
293293
294− instance functorArray :: Functor (Prim.Array)
294+ instance functorArray :: Functor Prim.Array
295295
296− instance monadArray :: Monad (Prim.Array)
296+ instance monadArray :: Monad Prim.Array
297297
298− (Show ((a))) => instance showArray :: Show ([a])
298+ instance showArray :: (Show a) => Show [a]
299299
300300
301301### Values
@@ -419,7 +419,7 @@
419419
420420### Type Class Instances
421421
422− (Show ((a)),Show ((b))) => instance showTuple :: Show (Tuple a b)
422+ instance showTuple :: (Show a, Show b) => Show (Tuple a b)
423423
424424
425425### Values
src/Language/PureScript/Pretty/Types.hs+1
@@ -15,6 +15,7 @@
1515
1616module Language.PureScript.Pretty.Types (
1717 prettyPrintType,
18+ prettyPrintTypeAtom,
1819 prettyPrintRow
1920) where
2021