git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge remote-tracking branch 'joneshf/hierarchy'
f2dc269Phil Freeman
docgen/Main.hs+17−8
@@ -14,17 +14,17 @@
14
14
15module Main where
15module Main where
16
16
17−import qualified Language.PureScript as P
18−import System.Console.CmdTheLine
19import Control.Applicative
17import Control.Applicative
20import Control.Monad
18import Control.Monad
21import Control.Monad.Writer
19import Control.Monad.Writer
22−import System.Exit (exitSuccess, exitFailure)
23−import qualified System.IO.UTF8 as U
24−import qualified Paths_purescript as Paths
25−import Data.Version (showVersion)
26−import Data.List
27import Data.Function (on)
20import Data.Function (on)
21+import Data.List
22+import Data.Version (showVersion)
23+import qualified Language.PureScript as P
24+import qualified Paths_purescript as Paths
25+import qualified System.IO.UTF8 as U
26+import System.Console.CmdTheLine
27+import System.Exit (exitSuccess, exitFailure)
28
28
29docgen :: FilePath -> IO ()
29docgen :: FilePath -> IO ()
30docgen input = do
30docgen input = do
@@ -61,6 +61,7 @@ renderModules ms = do
61renderModule :: P.Module -> Docs
61renderModule :: P.Module -> Docs
62renderModule (P.Module moduleName ds exps) =
62renderModule (P.Module moduleName ds exps) =
63 let exported = filter (isExported exps) ds
63 let exported = filter (isExported exps) ds
64+ hasTypeclasses = any isTypeClassDeclaration ds
64 in do
65 in do
65 headerLevel 2 $ "Module " ++ P.runModuleName moduleName
66 headerLevel 2 $ "Module " ++ P.runModuleName moduleName
66 spacer
67 spacer
@@ -70,6 +71,9 @@ renderModule (P.Module moduleName ds exps) =
70 spacer
71 spacer
71 headerLevel 3 "Type Classes"
72 headerLevel 3 "Type Classes"
72 spacer
73 spacer
74+ when hasTypeclasses $ do
75+ renderTypeclassImage moduleName
76+ spacer
73 renderTopLevel exps (filter isTypeClassDeclaration exported)
77 renderTopLevel exps (filter isTypeClassDeclaration exported)
74 spacer
78 spacer
75 headerLevel 3 "Type Class Instances"
79 headerLevel 3 "Type Class Instances"
@@ -83,7 +87,7 @@ renderModule (P.Module moduleName ds exps) =
83
87
84isExported :: Maybe [P.DeclarationRef] -> P.Declaration -> Bool
88isExported :: Maybe [P.DeclarationRef] -> P.Declaration -> Bool
85isExported Nothing _ = True
89isExported Nothing _ = True
86−isExported _ (P.TypeInstanceDeclaration _ _ _ _ _) = True
90+isExported _ P.TypeInstanceDeclaration{} = True
87isExported exps (P.PositionedDeclaration _ d) = isExported exps d
91isExported exps (P.PositionedDeclaration _ d) = isExported exps d
88isExported (Just exps) decl = any (matches decl) exps
92isExported (Just exps) decl = any (matches decl) exps
89 where
93 where
@@ -108,6 +112,11 @@ renderTopLevel exps decls = forM_ (sortBy (compare `on` getName) decls) $ \decl
108 renderDeclaration 4 exps decl
112 renderDeclaration 4 exps decl
109 spacer
113 spacer
110
114
115+renderTypeclassImage :: P.ModuleName -> Docs
116+renderTypeclassImage name =
117+ let name' = P.runModuleName name
118+ in tell ["![" ++ name' ++ "](images/" ++ name' ++ ".png)"]
119+
111renderDeclaration :: Int -> Maybe [P.DeclarationRef] -> P.Declaration -> Docs
120renderDeclaration :: Int -> Maybe [P.DeclarationRef] -> P.Declaration -> Docs
112renderDeclaration n _ (P.TypeDeclaration ident ty) =
121renderDeclaration n _ (P.TypeDeclaration ident ty) =
113 atIndent n $ show ident ++ " :: " ++ P.prettyPrintType ty
122 atIndent n $ show ident ++ " :: " ++ P.prettyPrintType ty
docs/source/prelude.rst+97−19
@@ -17,16 +17,25 @@ Types
17Type Classes
17Type Classes
18~~~~~~~~~~~~
18~~~~~~~~~~~~
19
19
20+.. figure:: images/Prelude.png
21+ :alt: Prelude
22+
23+ Prelude
20::
24::
21
25
22 class Alternative f where
26 class Alternative f where
23 empty :: forall a. f a
27 empty :: forall a. f a
24 (<|>) :: forall a. f a -> f a -> f a
28 (<|>) :: forall a. f a -> f a -> f a
25
29
26− class Applicative f where
30+ class (Apply f) <= Applicative f where
27 pure :: forall a. a -> f a
31 pure :: forall a. a -> f a
32+
33+ class (Functor f) <= Apply f where
28 (<*>) :: forall a b. f (a -> b) -> f a -> f b
34 (<*>) :: forall a b. f (a -> b) -> f a -> f b
29
35
36+ class (Apply m) <= Bind m where
37+ (>>=) :: forall a b. m a -> (a -> m b) -> m b
38+
30 class Bits b where
39 class Bits b where
31 (&) :: b -> b -> b
40 (&) :: b -> b -> b
32 (|) :: b -> b -> b
41 (|) :: b -> b -> b
@@ -41,9 +50,8 @@ Type Classes
41 (||) :: b -> b -> b
50 (||) :: b -> b -> b
42 not :: b -> b
51 not :: b -> b
43
52
44− class Category a where
53+ class (Semigroupoid a) <= Category a where
45 id :: forall t. a t t
54 id :: forall t. a t t
46− (<<<) :: forall b c d. a c d -> a b c -> a b d
47
55
48 class Eq a where
56 class Eq a where
49 (==) :: a -> a -> Prim.Boolean
57 (==) :: a -> a -> Prim.Boolean
@@ -52,9 +60,7 @@ Type Classes
52 class Functor f where
60 class Functor f where
53 (<$>) :: forall a b. (a -> b) -> f a -> f b
61 (<$>) :: forall a b. (a -> b) -> f a -> f b
54
62
55− class Monad m where
63+ class (Applicative m, Bind m) <= Monad m where
56− return :: forall a. a -> m a
57− (>>=) :: forall a b. m a -> (a -> m b) -> m b
58
64
59 class Num a where
65 class Num a where
60 (+) :: a -> a -> a
66 (+) :: a -> a -> a
@@ -64,9 +70,15 @@ Type Classes
64 (%) :: a -> a -> a
70 (%) :: a -> a -> a
65 negate :: a -> a
71 negate :: a -> a
66
72
67− class Ord a where
73+ class (Eq a) <= Ord a where
68 compare :: a -> a -> Ordering
74 compare :: a -> a -> Ordering
69
75
76+ class Semigroup a where
77+ (<>) :: a -> a -> a
78+
79+ class Semigroupoid a where
80+ (<<<) :: forall b c d. a c d -> a b c -> a b d
81+
70 class Show a where
82 class Show a where
71 show :: a -> Prim.String
83 show :: a -> Prim.String
72
84
@@ -75,8 +87,6 @@ Type Class Instances
75
87
76::
88::
77
89
78− instance applicativeFromMonad :: (Monad m) => Applicative m
79−
80 instance bitsNumber :: Bits Prim.Number
90 instance bitsNumber :: Bits Prim.Number
81
91
82 instance boolLikeBoolean :: BoolLike Prim.Boolean
92 instance boolLikeBoolean :: BoolLike Prim.Boolean
@@ -89,14 +99,20 @@ Type Class Instances
89
99
90 instance eqNumber :: Eq Prim.Number
100 instance eqNumber :: Eq Prim.Number
91
101
92− instance eqString :: Eq Prim.String
102+ instance eqOrdering :: Eq Ordering
93
103
94− instance functorFromApplicative :: (Applicative f) => Functor f
104+ instance eqString :: Eq Prim.String
95
105
96 instance numNumber :: Num Prim.Number
106 instance numNumber :: Num Prim.Number
97
107
98 instance ordNumber :: Ord Prim.Number
108 instance ordNumber :: Ord Prim.Number
99
109
110+ instance semigroupString :: Semigroup Prim.String
111+
112+ instance semigroupoidArr :: Semigroupoid Prim.Function
113+
114+ instance showArray :: (Show a) => Show [a]
115+
100 instance showBoolean :: Show Prim.Boolean
116 instance showBoolean :: Show Prim.Boolean
101
117
102 instance showNumber :: Show Prim.Number
118 instance showNumber :: Show Prim.Number
@@ -110,13 +126,13 @@ Values
110
126
111::
127::
112
128
113− (!!) :: forall a. [a] -> Prim.Number -> a
114−
115 (#) :: forall a b. a -> (a -> b) -> b
129 (#) :: forall a b. a -> (a -> b) -> b
116
130
117 ($) :: forall a b. (a -> b) -> a -> b
131 ($) :: forall a b. (a -> b) -> a -> b
118
132
119− (++) :: Prim.String -> Prim.String -> Prim.String
133+ (++) :: forall s. (Semigroup s) => s -> s -> s
134+
135+ (:) :: forall a. a -> [a] -> [a]
120
136
121 (<) :: forall a. (Ord a) => a -> a -> Prim.Boolean
137 (<) :: forall a. (Ord a) => a -> a -> Prim.Boolean
122
138
@@ -126,7 +142,11 @@ Values
126
142
127 (>=) :: forall a. (Ord a) => a -> a -> Prim.Boolean
143 (>=) :: forall a. (Ord a) => a -> a -> Prim.Boolean
128
144
129− (>>>) :: forall a b c d. (Category a) => a b c -> a c d -> a b d
145+ (>>>) :: forall a b c d. (Semigroupoid a) => a b c -> a c d -> a b d
146+
147+ ap :: forall m a b. (Monad m) => m (a -> b) -> m a -> m b
148+
149+ asTypeOf :: forall a. a -> a -> a
130
150
131 boolAnd :: Prim.Boolean -> Prim.Boolean -> Prim.Boolean
151 boolAnd :: Prim.Boolean -> Prim.Boolean -> Prim.Boolean
132
152
@@ -134,10 +154,18 @@ Values
134
154
135 boolOr :: Prim.Boolean -> Prim.Boolean -> Prim.Boolean
155 boolOr :: Prim.Boolean -> Prim.Boolean -> Prim.Boolean
136
156
157+ concatString :: Prim.String -> Prim.String -> Prim.String
158+
159+ cons :: forall a. a -> [a] -> [a]
160+
137 const :: forall a b. a -> b -> a
161 const :: forall a b. a -> b -> a
138
162
139 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
163 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
140
164
165+ liftA1 :: forall f a b. (Applicative f) => (a -> b) -> f a -> f b
166+
167+ liftM1 :: forall m a b. (Monad m) => (a -> b) -> m a -> m b
168+
141 numAdd :: Prim.Number -> Prim.Number -> Prim.Number
169 numAdd :: Prim.Number -> Prim.Number -> Prim.Number
142
170
143 numAnd :: Prim.Number -> Prim.Number -> Prim.Number
171 numAnd :: Prim.Number -> Prim.Number -> Prim.Number
@@ -166,14 +194,37 @@ Values
166
194
167 numZshr :: Prim.Number -> Prim.Number -> Prim.Number
195 numZshr :: Prim.Number -> Prim.Number -> Prim.Number
168
196
169− on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c
170−
171 refEq :: forall a. a -> a -> Prim.Boolean
197 refEq :: forall a. a -> a -> Prim.Boolean
172
198
173 refIneq :: forall a. a -> a -> Prim.Boolean
199 refIneq :: forall a. a -> a -> Prim.Boolean
174
200
201+ return :: forall m a. (Monad m) => a -> m a
202+
203+ showArrayImpl :: forall a. (a -> Prim.String) -> [a] -> Prim.String
204+
175 showNumberImpl :: Prim.Number -> Prim.String
205 showNumberImpl :: Prim.Number -> Prim.String
176
206
207+ showStringImpl :: Prim.String -> Prim.String
208+
209+Module Data.Function
210+--------------------
211+
212+Types
213+~~~~~
214+
215+Type Classes
216+~~~~~~~~~~~~
217+
218+Type Class Instances
219+~~~~~~~~~~~~~~~~~~~~
220+
221+Values
222+~~~~~~
223+
224+::
225+
226+ on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c
227+
177Module Data.Eq
228Module Data.Eq
178--------------
229--------------
179
230
@@ -202,6 +253,25 @@ Values
202
253
203 liftRef :: forall a b. (a -> a -> b) -> Ref a -> Ref a -> b
254 liftRef :: forall a b. (a -> a -> b) -> Ref a -> Ref a -> b
204
255
256+Module Prelude.Unsafe
257+---------------------
258+
259+Types
260+~~~~~
261+
262+Type Classes
263+~~~~~~~~~~~~
264+
265+Type Class Instances
266+~~~~~~~~~~~~~~~~~~~~
267+
268+Values
269+~~~~~~
270+
271+::
272+
273+ unsafeIndex :: forall a. [a] -> Prim.Number -> a
274+
205Module Control.Monad.Eff
275Module Control.Monad.Eff
206------------------------
276------------------------
207
277
@@ -222,6 +292,14 @@ Type Class Instances
222
292
223::
293::
224
294
295+ instance applicativeEff :: Applicative (Eff e)
296+
297+ instance applyEff :: Apply (Eff e)
298+
299+ instance bindEff :: Bind (Eff e)
300+
301+ instance functorEff :: Functor (Eff e)
302+
225 instance monadEff :: Monad (Eff e)
303 instance monadEff :: Monad (Eff e)
226
304
227Values
305Values
@@ -229,13 +307,13 @@ Values
229
307
230::
308::
231
309
232− bindEff :: forall e a b. Eff e a -> (a -> Eff e b) -> Eff e b
310+ bindE :: forall e a b. Eff e a -> (a -> Eff e b) -> Eff e b
233
311
234 forE :: forall e. Prim.Number -> Prim.Number -> (Prim.Number -> Eff e { }) -> Eff e { }
312 forE :: forall e. Prim.Number -> Prim.Number -> (Prim.Number -> Eff e { }) -> Eff e { }
235
313
236 foreachE :: forall e a. [a] -> (a -> Eff e { }) -> Eff e { }
314 foreachE :: forall e a. [a] -> (a -> Eff e { }) -> Eff e { }
237
315
238− retEff :: forall e a. a -> Eff e a
316+ returnE :: forall e a. a -> Eff e a
239
317
240 runPure :: forall a. Pure a -> a
318 runPure :: forall a. Pure a -> a
241
319
hierarchy/Main.hsnew file+103
@@ -0,0 +1,103 @@
1+-----------------------------------------------------------------------------
2+--
3+-- Module : Main
4+-- Copyright : (c) Hardy Jones 2014
5+-- License : MIT
6+--
7+-- Maintainer : Hardy Jones <jones3.hardy@gmail.com>
8+-- Stability : experimental
9+-- Portability :
10+--
11+-- |
12+-- Generate Directed Graphs of PureScript TypeClasses
13+--
14+-----------------------------------------------------------------------------
15+
16+module Main where
17+
18+import Control.Applicative ((<*>), (<$>))
19+import Control.Monad (unless)
20+
21+import Data.List (intercalate,nub,sort)
22+import Data.Foldable (for_)
23+import Data.Version (showVersion)
24+
25+import System.Console.CmdTheLine
26+import System.Directory (createDirectoryIfMissing)
27+import System.FilePath ((</>))
28+import System.Exit (exitFailure, exitSuccess)
29+
30+import Text.Parsec (ParseError)
31+
32+import qualified Language.PureScript as P
33+import qualified Paths_purescript as Paths
34+import qualified System.IO.UTF8 as U
35+
36+newtype SuperMap = SuperMap { unSuperMap :: Either P.ProperName (P.ProperName, P.ProperName) }
37+ deriving Eq
38+
39+instance Show SuperMap where
40+ show (SuperMap (Left sub)) = show sub
41+ show (SuperMap (Right (super, sub))) = show super ++ " -> " ++ show sub
42+
43+instance Ord SuperMap where
44+ compare (SuperMap s) (SuperMap s') = getCls s `compare` getCls s'
45+ where
46+ getCls = either id snd
47+
48+runModuleName :: P.ModuleName -> String
49+runModuleName (P.ModuleName pns) = intercalate "_" (P.runProperName `map` pns)
50+
51+readInput :: FilePath -> IO (Either ParseError [P.Module])
52+readInput p = do
53+ text <- U.readFile p
54+ return $ P.runIndentParser p P.parseModules text
55+
56+compile :: FilePath -> Maybe FilePath -> IO ()
57+compile input mOutput = do
58+ modules <- readInput input
59+ case modules of
60+ Left err -> U.print err >> exitFailure
61+ Right ms -> do
62+ for_ ms $ \(P.Module moduleName decls _) ->
63+ let name = runModuleName moduleName
64+ tcs = filter P.isTypeClassDeclaration decls
65+ supers = sort . nub . filter (not . null) $ fmap superClasses tcs
66+ prologue = "digraph " ++ name ++ " {\n"
67+ body = intercalate "\n" (concatMap (fmap (\s -> " " ++ show s ++ ";")) supers)
68+ epilogue = "\n}"
69+ hier = prologue ++ body ++ epilogue
70+ in unless (null supers) $ case mOutput of
71+ Just output -> do
72+ createDirectoryIfMissing True output
73+ U.writeFile (output </> name) hier
74+ Nothing -> U.putStrLn hier
75+ exitSuccess
76+
77+superClasses :: P.Declaration -> [SuperMap]
78+superClasses (P.TypeClassDeclaration sub _ supers@(_:_) _) =
79+ fmap (\(P.Qualified _ super, _) -> SuperMap (Right (super, sub))) supers
80+superClasses (P.TypeClassDeclaration sub _ _ _) = [SuperMap (Left sub)]
81+superClasses (P.PositionedDeclaration _ decl) = superClasses decl
82+superClasses _ = []
83+
84+outputFile :: Term (Maybe FilePath)
85+outputFile = value $ opt Nothing $ (optInfo [ "o", "output" ])
86+ { optDoc = "The output directory" }
87+
88+inputFile :: Term FilePath
89+inputFile = value $ pos 0 "main.purs" $ posInfo
90+ { posDoc = "The input file to generate a hierarchy from" }
91+
92+term :: Term (IO ())
93+term = compile <$> inputFile <*> outputFile
94+
95+termInfo :: TermInfo
96+termInfo = defTI
97+ { termName = "hierarchy"
98+ , version = showVersion Paths.version
99+ , termDoc = "Creates a GraphViz directed graph of PureScript TypeClasses"
100+ }
101+
102+main :: IO ()
103+main = run (term, termInfo)
prelude/README.md+89−19
@@ -11,14 +11,21 @@
11
11
12### Type Classes
12### Type Classes
13
13
14+![Prelude](images/Prelude.png)
15+
14 class Alternative f where
16 class Alternative f where
15 empty :: forall a. f a
17 empty :: forall a. f a
16 (<|>) :: forall a. f a -> f a -> f a
18 (<|>) :: forall a. f a -> f a -> f a
17
19
18− class Applicative f where
20+ class (Apply f) <= Applicative f where
19 pure :: forall a. a -> f a
21 pure :: forall a. a -> f a
22+
23+ class (Functor f) <= Apply f where
20 (<*>) :: forall a b. f (a -> b) -> f a -> f b
24 (<*>) :: forall a b. f (a -> b) -> f a -> f b
21
25
26+ class (Apply m) <= Bind m where
27+ (>>=) :: forall a b. m a -> (a -> m b) -> m b
28+
22 class Bits b where
29 class Bits b where
23 (&) :: b -> b -> b
30 (&) :: b -> b -> b
24 (|) :: b -> b -> b
31 (|) :: b -> b -> b
@@ -33,9 +40,8 @@
33 (||) :: b -> b -> b
40 (||) :: b -> b -> b
34 not :: b -> b
41 not :: b -> b
35
42
36− class Category a where
43+ class (Semigroupoid a) <= Category a where
37 id :: forall t. a t t
44 id :: forall t. a t t
38− (<<<) :: forall b c d. a c d -> a b c -> a b d
39
45
40 class Eq a where
46 class Eq a where
41 (==) :: a -> a -> Prim.Boolean
47 (==) :: a -> a -> Prim.Boolean
@@ -44,9 +50,7 @@
44 class Functor f where
50 class Functor f where
45 (<$>) :: forall a b. (a -> b) -> f a -> f b
51 (<$>) :: forall a b. (a -> b) -> f a -> f b
46
52
47− class Monad m where
53+ class (Applicative m, Bind m) <= Monad m where
48− return :: forall a. a -> m a
49− (>>=) :: forall a b. m a -> (a -> m b) -> m b
50
54
51 class Num a where
55 class Num a where
52 (+) :: a -> a -> a
56 (+) :: a -> a -> a
@@ -56,17 +60,21 @@
56 (%) :: a -> a -> a
60 (%) :: a -> a -> a
57 negate :: a -> a
61 negate :: a -> a
58
62
59− class Ord a where
63+ class (Eq a) <= Ord a where
60 compare :: a -> a -> Ordering
64 compare :: a -> a -> Ordering
61
65
66+ class Semigroup a where
67+ (<>) :: a -> a -> a
68+
69+ class Semigroupoid a where
70+ (<<<) :: forall b c d. a c d -> a b c -> a b d
71+
62 class Show a where
72 class Show a where
63 show :: a -> Prim.String
73 show :: a -> Prim.String
64
74
65
75
66### Type Class Instances
76### Type Class Instances
67
77
68− instance applicativeFromMonad :: (Monad m) => Applicative m
69−
70 instance bitsNumber :: Bits Prim.Number
78 instance bitsNumber :: Bits Prim.Number
71
79
72 instance boolLikeBoolean :: BoolLike Prim.Boolean
80 instance boolLikeBoolean :: BoolLike Prim.Boolean
@@ -79,14 +87,20 @@
79
87
80 instance eqNumber :: Eq Prim.Number
88 instance eqNumber :: Eq Prim.Number
81
89
82− instance eqString :: Eq Prim.String
90+ instance eqOrdering :: Eq Ordering
83
91
84− instance functorFromApplicative :: (Applicative f) => Functor f
92+ instance eqString :: Eq Prim.String
85
93
86 instance numNumber :: Num Prim.Number
94 instance numNumber :: Num Prim.Number
87
95
88 instance ordNumber :: Ord Prim.Number
96 instance ordNumber :: Ord Prim.Number
89
97
98+ instance semigroupString :: Semigroup Prim.String
99+
100+ instance semigroupoidArr :: Semigroupoid Prim.Function
101+
102+ instance showArray :: (Show a) => Show [a]
103+
90 instance showBoolean :: Show Prim.Boolean
104 instance showBoolean :: Show Prim.Boolean
91
105
92 instance showNumber :: Show Prim.Number
106 instance showNumber :: Show Prim.Number
@@ -98,13 +112,13 @@
98
112
99### Values
113### Values
100
114
101− (!!) :: forall a. [a] -> Prim.Number -> a
102−
103 (#) :: forall a b. a -> (a -> b) -> b
115 (#) :: forall a b. a -> (a -> b) -> b
104
116
105 ($) :: forall a b. (a -> b) -> a -> b
117 ($) :: forall a b. (a -> b) -> a -> b
106
118
107− (++) :: Prim.String -> Prim.String -> Prim.String
119+ (++) :: forall s. (Semigroup s) => s -> s -> s
120+
121+ (:) :: forall a. a -> [a] -> [a]
108
122
109 (<) :: forall a. (Ord a) => a -> a -> Prim.Boolean
123 (<) :: forall a. (Ord a) => a -> a -> Prim.Boolean
110
124
@@ -114,7 +128,11 @@
114
128
115 (>=) :: forall a. (Ord a) => a -> a -> Prim.Boolean
129 (>=) :: forall a. (Ord a) => a -> a -> Prim.Boolean
116
130
117− (>>>) :: forall a b c d. (Category a) => a b c -> a c d -> a b d
131+ (>>>) :: forall a b c d. (Semigroupoid a) => a b c -> a c d -> a b d
132+
133+ ap :: forall m a b. (Monad m) => m (a -> b) -> m a -> m b
134+
135+ asTypeOf :: forall a. a -> a -> a
118
136
119 boolAnd :: Prim.Boolean -> Prim.Boolean -> Prim.Boolean
137 boolAnd :: Prim.Boolean -> Prim.Boolean -> Prim.Boolean
120
138
@@ -122,10 +140,18 @@
122
140
123 boolOr :: Prim.Boolean -> Prim.Boolean -> Prim.Boolean
141 boolOr :: Prim.Boolean -> Prim.Boolean -> Prim.Boolean
124
142
143+ concatString :: Prim.String -> Prim.String -> Prim.String
144+
145+ cons :: forall a. a -> [a] -> [a]
146+
125 const :: forall a b. a -> b -> a
147 const :: forall a b. a -> b -> a
126
148
127 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
149 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
128
150
151+ liftA1 :: forall f a b. (Applicative f) => (a -> b) -> f a -> f b
152+
153+ liftM1 :: forall m a b. (Monad m) => (a -> b) -> m a -> m b
154+
129 numAdd :: Prim.Number -> Prim.Number -> Prim.Number
155 numAdd :: Prim.Number -> Prim.Number -> Prim.Number
130
156
131 numAnd :: Prim.Number -> Prim.Number -> Prim.Number
157 numAnd :: Prim.Number -> Prim.Number -> Prim.Number
@@ -154,14 +180,34 @@
154
180
155 numZshr :: Prim.Number -> Prim.Number -> Prim.Number
181 numZshr :: Prim.Number -> Prim.Number -> Prim.Number
156
182
157− on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c
158−
159 refEq :: forall a. a -> a -> Prim.Boolean
183 refEq :: forall a. a -> a -> Prim.Boolean
160
184
161 refIneq :: forall a. a -> a -> Prim.Boolean
185 refIneq :: forall a. a -> a -> Prim.Boolean
162
186
187+ return :: forall m a. (Monad m) => a -> m a
188+
189+ showArrayImpl :: forall a. (a -> Prim.String) -> [a] -> Prim.String
190+
163 showNumberImpl :: Prim.Number -> Prim.String
191 showNumberImpl :: Prim.Number -> Prim.String
164
192
193+ showStringImpl :: Prim.String -> Prim.String
194+
195+
196+## Module Data.Function
197+
198+### Types
199+
200+
201+### Type Classes
202+
203+
204+### Type Class Instances
205+
206+
207+### Values
208+
209+ on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c
210+
165
211
166## Module Data.Eq
212## Module Data.Eq
167
213
@@ -184,6 +230,22 @@
184 liftRef :: forall a b. (a -> a -> b) -> Ref a -> Ref a -> b
230 liftRef :: forall a b. (a -> a -> b) -> Ref a -> Ref a -> b
185
231
186
232
233+## Module Prelude.Unsafe
234+
235+### Types
236+
237+
238+### Type Classes
239+
240+
241+### Type Class Instances
242+
243+
244+### Values
245+
246+ unsafeIndex :: forall a. [a] -> Prim.Number -> a
247+
248+
187## Module Control.Monad.Eff
249## Module Control.Monad.Eff
188
250
189### Types
251### Types
@@ -198,18 +260,26 @@
198
260
199### Type Class Instances
261### Type Class Instances
200
262
263+ instance applicativeEff :: Applicative (Eff e)
264+
265+ instance applyEff :: Apply (Eff e)
266+
267+ instance bindEff :: Bind (Eff e)
268+
269+ instance functorEff :: Functor (Eff e)
270+
201 instance monadEff :: Monad (Eff e)
271 instance monadEff :: Monad (Eff e)
202
272
203
273
204### Values
274### Values
205
275
206− bindEff :: forall e a b. Eff e a -> (a -> Eff e b) -> Eff e b
276+ bindE :: forall e a b. Eff e a -> (a -> Eff e b) -> Eff e b
207
277
208 forE :: forall e. Prim.Number -> Prim.Number -> (Prim.Number -> Eff e { }) -> Eff e { }
278 forE :: forall e. Prim.Number -> Prim.Number -> (Prim.Number -> Eff e { }) -> Eff e { }
209
279
210 foreachE :: forall e a. [a] -> (a -> Eff e { }) -> Eff e { }
280 foreachE :: forall e a. [a] -> (a -> Eff e { }) -> Eff e { }
211
281
212− retEff :: forall e a. a -> Eff e a
282+ returnE :: forall e a. a -> Eff e a
213
283
214 runPure :: forall a. Pure a -> a
284 runPure :: forall a. Pure a -> a
215
285
prelude/images/Prelude.pngnew file

Binary file not shown.

prelude/updateDocs.sh+7
@@ -1,2 +1,9 @@
1../dist/build/docgen/docgen prelude.purs > README.md
1../dist/build/docgen/docgen prelude.purs > README.md
2+../dist/build/hierarchy/hierarchy prelude.purs -o prelude
3+mkdir -p images
4+for f in prelude/*; do
5+ BASE=$(basename "$f")
6+ dot -Tpng -o images/"$BASE".png "$f"
7+done
8+rm -r prelude
2pandoc -o ../docs/source/prelude.rst README.md
9pandoc -o ../docs/source/prelude.rst README.md
purescript.cabal+9
@@ -125,6 +125,15 @@ executable docgen
125 other-modules:
125 other-modules:
126 ghc-options: -Wall -O2
126 ghc-options: -Wall -O2
127
127
128+executable hierarchy
129+ build-depends: base >=4 && <5, cmdtheline -any, purescript -any, utf8-string -any,
130+ process -any, mtl -any, parsec -any, filepath -any, directory -any
131+ main-is: Main.hs
132+ buildable: True
133+ hs-source-dirs: hierarchy
134+ other-modules:
135+ ghc-options: -Wall -O2
136+
128test-suite tests
137test-suite tests
129 build-depends: base >=4 && <5, containers -any, directory -any,
138 build-depends: base >=4 && <5, containers -any, directory -any,
130 filepath -any, mtl -any, parsec -any, purescript -any, syb >= 0.4.1 && < 0.5,
139 filepath -any, mtl -any, parsec -any, purescript -any, syb >= 0.4.1 && < 0.5,