git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Improve documentation generation using new prettyPrintTypeAtom
6f56560Phil Freeman
docgen/Main.hs+2−2
@@ -128,8 +128,8 @@ renderDeclaration n exps (P.TypeClassDeclaration name args ds) = do
128renderDeclaration n _ (P.TypeInstanceDeclaration name constraints className tys _) = do
128renderDeclaration n _ (P.TypeInstanceDeclaration name constraints className tys _) = do
129 let constraintsText = case constraints of
129 let constraintsText = case constraints of
130 [] -> ""
130 [] -> ""
131− cs -> "(" ++ intercalate "," (map (\(pn, tys') -> show pn ++ " (" ++ unwords (map (("(" ++) . (++ ")") . P.prettyPrintType) tys') ++ ")") cs) ++ ") => "
131+ cs -> "(" ++ intercalate ", " (map (\(pn, tys') -> show pn ++ " " ++ unwords (map P.prettyPrintTypeAtom tys')) cs) ++ ") => "
132− atIndent n $ constraintsText ++ "instance " ++ show name ++ " :: " ++ show className ++ " " ++ unwords (map (("(" ++) . (++ ")") . P.prettyPrintType) tys)
132+ atIndent n $ "instance " ++ show name ++ " :: " ++ constraintsText ++ show className ++ " " ++ unwords (map P.prettyPrintTypeAtom tys)
133renderDeclaration _ _ _ = return ()
133renderDeclaration _ _ _ = return ()
134
134
135getName :: P.Declaration -> String
135getName :: P.Declaration -> String
docs/source/prelude.rst+29−29
@@ -75,39 +75,39 @@ Type Class Instances
75
75
76::
76::
77
77
78− (Monad ((m))) => instance applicativeFromMonad :: Applicative (m)
78+ instance applicativeFromMonad :: (Monad m) => Applicative m
79
79
80− instance bitsNumber :: Bits (Prim.Number)
80+ instance bitsNumber :: Bits Prim.Number
81
81
82− instance boolLikeBoolean :: BoolLike (Prim.Boolean)
82+ instance boolLikeBoolean :: BoolLike Prim.Boolean
83
83
84− instance categoryArr :: Category (Prim.Function)
84+ instance categoryArr :: Category Prim.Function
85
85
86− (Eq ((a))) => instance eqArray :: Eq ([a])
86+ instance eqArray :: (Eq a) => Eq [a]
87
87
88− instance eqBoolean :: Eq (Prim.Boolean)
88+ instance eqBoolean :: Eq Prim.Boolean
89
89
90− instance eqNumber :: Eq (Prim.Number)
90+ instance eqNumber :: Eq Prim.Number
91
91
92− instance eqString :: Eq (Prim.String)
92+ instance eqString :: Eq Prim.String
93
93
94− (Applicative ((f))) => instance functorFromApplicative :: Functor (f)
94+ instance functorFromApplicative :: (Applicative f) => Functor f
95
95
96− instance numNumber :: Num (Prim.Number)
96+ instance numNumber :: Num Prim.Number
97
97
98− instance ordNumber :: Ord (Prim.Number)
98+ instance ordNumber :: Ord Prim.Number
99
99
100− instance readBoolean :: Read (Prim.Boolean)
100+ instance readBoolean :: Read Prim.Boolean
101
101
102− instance readNumber :: Read (Prim.Number)
102+ instance readNumber :: Read Prim.Number
103
103
104− instance readString :: Read (Prim.String)
104+ instance readString :: Read Prim.String
105
105
106− instance showBoolean :: Show (Prim.Boolean)
106+ instance showBoolean :: Show Prim.Boolean
107
107
108− instance showNumber :: Show (Prim.Number)
108+ instance showNumber :: Show Prim.Number
109
109
110− instance showString :: Show (Prim.String)
110+ instance showString :: Show Prim.String
111
111
112Values
112Values
113~~~~~~
113~~~~~~
@@ -194,9 +194,9 @@ Type Class Instances
194
194
195::
195::
196
196
197− instance monoidArray :: Monoid ([a])
197+ instance monoidArray :: Monoid [a]
198
198
199− instance monoidString :: Monoid (Prim.String)
199+ instance monoidString :: Monoid Prim.String
200
200
201Values
201Values
202~~~~~~
202~~~~~~
@@ -260,13 +260,13 @@ Type Class Instances
260
260
261::
261::
262
262
263− instance applicativeMaybe :: Applicative (Maybe)
263+ instance applicativeMaybe :: Applicative Maybe
264
264
265− instance functorMaybe :: Functor (Maybe)
265+ instance functorMaybe :: Functor Maybe
266
266
267− instance monadMaybe :: Monad (Maybe)
267+ instance monadMaybe :: Monad Maybe
268
268
269− (Show ((a))) => instance showMaybe :: Show (Maybe a)
269+ instance showMaybe :: (Show a) => Show (Maybe a)
270
270
271Values
271Values
272~~~~~~
272~~~~~~
@@ -303,7 +303,7 @@ Type Class Instances
303
303
304 instance monadEither :: Monad (Either e)
304 instance monadEither :: Monad (Either e)
305
305
306− (Show ((a)),Show ((b))) => instance showEither :: Show (Either a b)
306+ instance showEither :: (Show a, Show b) => Show (Either a b)
307
307
308Values
308Values
309~~~~~~
309~~~~~~
@@ -326,13 +326,13 @@ Type Class Instances
326
326
327::
327::
328
328
329− instance alternativeArray :: Alternative (Prim.Array)
329+ instance alternativeArray :: Alternative Prim.Array
330
330
331− instance functorArray :: Functor (Prim.Array)
331+ instance functorArray :: Functor Prim.Array
332
332
333− instance monadArray :: Monad (Prim.Array)
333+ instance monadArray :: Monad Prim.Array
334
334
335− (Show ((a))) => instance showArray :: Show ([a])
335+ instance showArray :: (Show a) => Show [a]
336
336
337Values
337Values
338~~~~~~
338~~~~~~
@@ -473,7 +473,7 @@ Type Class Instances
473
473
474::
474::
475
475
476− (Show ((a)),Show ((b))) => instance showTuple :: Show (Tuple a b)
476+ instance showTuple :: (Show a, Show b) => Show (Tuple a b)
477
477
478Values
478Values
479~~~~~~
479~~~~~~
prelude/README.md+29−29
@@ -67,39 +67,39 @@
67
67
68### Type Class Instances
68### Type Class Instances
69
69
70− (Monad ((m))) => instance applicativeFromMonad :: Applicative (m)
70+ instance applicativeFromMonad :: (Monad m) => Applicative m
71
71
72− instance bitsNumber :: Bits (Prim.Number)
72+ instance bitsNumber :: Bits Prim.Number
73
73
74− instance boolLikeBoolean :: BoolLike (Prim.Boolean)
74+ instance boolLikeBoolean :: BoolLike Prim.Boolean
75
75
76− instance categoryArr :: Category (Prim.Function)
76+ instance categoryArr :: Category Prim.Function
77
77
78− (Eq ((a))) => instance eqArray :: Eq ([a])
78+ instance eqArray :: (Eq a) => Eq [a]
79
79
80− instance eqBoolean :: Eq (Prim.Boolean)
80+ instance eqBoolean :: Eq Prim.Boolean
81
81
82− instance eqNumber :: Eq (Prim.Number)
82+ instance eqNumber :: Eq Prim.Number
83
83
84− instance eqString :: Eq (Prim.String)
84+ instance eqString :: Eq Prim.String
85
85
86− (Applicative ((f))) => instance functorFromApplicative :: Functor (f)
86+ instance functorFromApplicative :: (Applicative f) => Functor f
87
87
88− instance numNumber :: Num (Prim.Number)
88+ instance numNumber :: Num Prim.Number
89
89
90− instance ordNumber :: Ord (Prim.Number)
90+ instance ordNumber :: Ord Prim.Number
91
91
92− instance readBoolean :: Read (Prim.Boolean)
92+ instance readBoolean :: Read Prim.Boolean
93
93
94− instance readNumber :: Read (Prim.Number)
94+ instance readNumber :: Read Prim.Number
95
95
96− instance readString :: Read (Prim.String)
96+ instance readString :: Read Prim.String
97
97
98− instance showBoolean :: Show (Prim.Boolean)
98+ instance showBoolean :: Show Prim.Boolean
99
99
100− instance showNumber :: Show (Prim.Number)
100+ instance showNumber :: Show Prim.Number
101
101
102− instance showString :: Show (Prim.String)
102+ instance showString :: Show Prim.String
103
103
104
104
105### Values
105### Values
@@ -179,9 +179,9 @@
179
179
180### Type Class Instances
180### Type Class Instances
181
181
182− instance monoidArray :: Monoid ([a])
182+ instance monoidArray :: Monoid [a]
183
183
184− instance monoidString :: Monoid (Prim.String)
184+ instance monoidString :: Monoid Prim.String
185
185
186
186
187### Values
187### Values
@@ -235,13 +235,13 @@
235
235
236### Type Class Instances
236### Type Class Instances
237
237
238− instance applicativeMaybe :: Applicative (Maybe)
238+ instance applicativeMaybe :: Applicative Maybe
239
239
240− instance functorMaybe :: Functor (Maybe)
240+ instance functorMaybe :: Functor Maybe
241
241
242− instance monadMaybe :: Monad (Maybe)
242+ instance monadMaybe :: Monad Maybe
243
243
244− (Show ((a))) => instance showMaybe :: Show (Maybe a)
244+ instance showMaybe :: (Show a) => Show (Maybe a)
245
245
246
246
247### Values
247### Values
@@ -271,7 +271,7 @@
271
271
272 instance monadEither :: Monad (Either e)
272 instance monadEither :: Monad (Either e)
273
273
274− (Show ((a)),Show ((b))) => instance showEither :: Show (Either a b)
274+ instance showEither :: (Show a, Show b) => Show (Either a b)
275
275
276
276
277### Values
277### Values
@@ -289,13 +289,13 @@
289
289
290### Type Class Instances
290### Type Class Instances
291
291
292− instance alternativeArray :: Alternative (Prim.Array)
292+ instance alternativeArray :: Alternative Prim.Array
293
293
294− instance functorArray :: Functor (Prim.Array)
294+ instance functorArray :: Functor Prim.Array
295
295
296− instance monadArray :: Monad (Prim.Array)
296+ instance monadArray :: Monad Prim.Array
297
297
298− (Show ((a))) => instance showArray :: Show ([a])
298+ instance showArray :: (Show a) => Show [a]
299
299
300
300
301### Values
301### Values
@@ -419,7 +419,7 @@
419
419
420### Type Class Instances
420### Type Class Instances
421
421
422− (Show ((a)),Show ((b))) => instance showTuple :: Show (Tuple a b)
422+ instance showTuple :: (Show a, Show b) => Show (Tuple a b)
423
423
424
424
425### Values
425### Values
src/Language/PureScript/Pretty/Types.hs+1
@@ -15,6 +15,7 @@
15
15
16module Language.PureScript.Pretty.Types (
16module Language.PureScript.Pretty.Types (
17 prettyPrintType,
17 prettyPrintType,
18+ prettyPrintTypeAtom,
18 prettyPrintRow
19 prettyPrintRow
19) where
20) where
20
21