git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
docs for the doc god
9569019JP Smith
prelude/prelude.purs+37−1
@@ -39,10 +39,20 @@ module Prelude
39 otherwise = true
39 otherwise = true
40
40
41 -- | Flips the order of the arguments to a function of two arguments.
41 -- | Flips the order of the arguments to a function of two arguments.
42+ -- |
43+ -- | E.g.
44+ -- |
45+ -- | flip const 1 2 = const 2 1 = 2
46+ -- |
42 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
47 flip :: forall a b c. (a -> b -> c) -> b -> a -> c
43 flip f b a = f a b
48 flip f b a = f a b
44
49
45 -- | Returns its first argument and ignores its second.
50 -- | Returns its first argument and ignores its second.
51+ -- |
52+ -- | E.g.
53+ -- |
54+ -- | const 1 2 = 1
55+ -- |
46 const :: forall a b. a -> b -> a
56 const :: forall a b. a -> b -> a
47 const a _ = a
57 const a _ = a
48
58
@@ -98,14 +108,40 @@ module Prelude
98 infixr 0 $
108 infixr 0 $
99 infixl 0 #
109 infixl 0 #
100
110
111+ -- | Applies a function to its argument
112+ -- |
113+ -- | E.g.
114+ -- |
115+ -- | const $ 1 2 = const 1 2 = 1
116+ -- |
117+ -- | `($)` is different from [`(#)`](#-2) because it is right-infix instance instead of left.
118+ -- | Right-infix operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse
119+ -- | like (((a # b) # c) # d ...).
120+ -- |
101 ($) :: forall a b. (a -> b) -> a -> b
121 ($) :: forall a b. (a -> b) -> a -> b
102 ($) f x = f x
122 ($) f x = f x
103
123
124+ -- | Applies a function to its argument
125+ -- |
126+ -- | E.g.
127+ -- |
128+ -- | 3 # ((+) 1) = 3 + 1 = 4
129+ -- |
130+ -- | `(#)` is different from [`($)`](#-1) because it is left-infix instance instead of right.
131+ -- | Right-infix operators parse like (a $ (b $ (c $ (d ...)))) whereas left-infix operators parse
132+ -- | like (((a # b) # c) # d ...).
133+ -- |
104 (#) :: forall a b. a -> (a -> b) -> b
134 (#) :: forall a b. a -> (a -> b) -> b
105 (#) x f = f x
135 (#) x f = f x
106
136
107 infixr 6 :
137 infixr 6 :
108
138
139+ -- | Attaches an element to the front of a list.
140+ -- |
141+ -- | E.g.
142+ -- |
143+ -- | 1 : [2, 3, 4] = [1, 2, 3, 4]
144+ -- |
109 (:) :: forall a. a -> [a] -> [a]
145 (:) :: forall a. a -> [a] -> [a]
110 (:) = cons
146 (:) = cons
111
147
@@ -452,7 +488,7 @@ module Prelude
452 show LT = "LT"
488 show LT = "LT"
453 show GT = "GT"
489 show GT = "GT"
454 show EQ = "EQ"
490 show EQ = "EQ"
455−
491+
456 instance semigroupOrdening :: Semigroup Ordering where
492 instance semigroupOrdening :: Semigroup Ordering where
457 (<>) LT _ = LT
493 (<>) LT _ = LT
458 (<>) GT _ = GT
494 (<>) GT _ = GT