@@ -31,27 +31,28 @@ module Prelude
32 -- | An alias for `true`, which can be useful in guard clauses:
32 -- | An alias for `true`, which can be useful in guard clauses:
34− -- | E.g.
34+ -- | ```purescript
36 -- | max x y | x >= y = x
35 -- | max x y | x >= y = x
37 -- | | otherwise = y
36 -- | | otherwise = y
38 otherwise :: Boolean
39 otherwise :: Boolean
39 otherwise = true
40 otherwise = true
41 -- | Flips the order of the arguments to a function of two arguments.
42 -- | Flips the order of the arguments to a function of two arguments.
43− -- | E.g.
44+ -- | ```purescript
45 -- | flip const 1 2 = const 2 1 = 2
45 -- | flip const 1 2 = const 2 1 = 2
47 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
48 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
48 flip f b a = f a b
49 flip f b a = f a b
50 -- | Returns its first argument and ignores its second.
51 -- | Returns its first argument and ignores its second.
52− -- | E.g.
53+ -- | ```purescript
54− -- | const 1 2 = 1
54+ -- | const 1 "hello" = 1
56 const :: forall a b. a -> b -> a
57 const :: forall a b. a -> b -> a
57 const a _ = a
58 const a _ = a
@@ -59,9 +60,9 @@ module Prelude
59 -- | This function returns its first argument, and can be used to assert type equalities.
60 -- | This function returns its first argument, and can be used to assert type equalities.
60 -- | This can be useful when types are otherwise ambiguous.
61 -- | This can be useful when types are otherwise ambiguous.
62− -- | E.g.
63+ -- | ```purescript
64 -- | main = print $ [] `asTypeOf` [0]
64 -- | main = print $ [] `asTypeOf` [0]
66 -- | If instead, we had written `main = print []`, the type of the argument `[]` would have
67 -- | If instead, we had written `main = print []`, the type of the argument `[]` would have
67 -- | been ambiguous, resulting in a compile-time error.
68 -- | been ambiguous, resulting in a compile-time error.
@@ -110,26 +111,26 @@ module Prelude
111 -- | Applies a function to its argument
112 -- | Applies a function to its argument
113− -- | E.g.
114+ -- | ```purescript
115− -- | const $ 1 2 = const 1 2 = 1
115+ -- | (+) 1 ((*) 2 (const 1 2)) = (+) 1 $ (*) 2 $ const 1 2
117− -- | `($)` is different from [`(#)`](#-2) because it is right-infix instance instead of left.
118+ -- | `($)` is different from [`(#)`](#-2) because it is right-infix instead of left. Right-infix
118− -- | Right-infix operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse
119+ -- | operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse like
119− -- | like (((a # b) # c) # d ...).
120+ -- | `(((a # b) # c) # d ...)`.
121 ($) :: forall a b. (a -> b) -> a -> b
122 ($) :: forall a b. (a -> b) -> a -> b
122 ($) f x = f x
123 ($) f x = f x
124 -- | Applies a function to its argument
125 -- | Applies a function to its argument
126− -- | E.g.
127+ -- | ```purescript
128+ -- | (((3 + 1) * 2) + 4) = 3 # ((+) 1) # ((*) 2) # ((+) 4)
128− -- | 3 # ((+) 1) = 3 + 1 = 4
130− -- | `(#)` is different from [`($)`](#-1) because it is left-infix instance instead of right.
131+ -- | `(#)` is different from [`($)`](#-1) because it is left-infix instead of right. Right-infix
131− -- | Right-infix operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse
132+ -- | operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse like
132− -- | like (((a # b) # c) # d ...).
133+ -- | `(((a # b) # c) # d ...)`.
134 (#) :: forall a b. a -> (a -> b) -> b
135 (#) :: forall a b. a -> (a -> b) -> b
135 (#) x f = f x
136 (#) x f = f x
@@ -138,9 +139,9 @@ module Prelude
139 -- | Attaches an element to the front of a list.
140 -- | Attaches an element to the front of a list.
141− -- | E.g.
142+ -- | ```purescript
143 -- | 1 : [2, 3, 4] = [1, 2, 3, 4]
143 -- | 1 : [2, 3, 4] = [1, 2, 3, 4]
145 (:) :: forall a. a -> [a] -> [a]
146 (:) :: forall a. a -> [a] -> [a]
146 (:) = cons
147 (:) = cons