@@ -39,10 +39,20 @@ module Prelude
39 otherwise = true
39 otherwise = true
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.
45+ -- | flip const 1 2 = const 2 1 = 2
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
45 -- | Returns its first argument and ignores its second.
50 -- | Returns its first argument and ignores its second.
46 const :: forall a b. a -> b -> a
56 const :: forall a b. a -> b -> a
47 const a _ = a
57 const a _ = a
@@ -98,14 +108,40 @@ module Prelude
98 infixr 0 $
108 infixr 0 $
99 infixl 0 #
109 infixl 0 #
111+ -- | Applies a function to its argument
115+ -- | const $ 1 2 = const 1 2 = 1
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 ...).
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
124+ -- | Applies a function to its argument
128+ -- | 3 # ((+) 1) = 3 + 1 = 4
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 ...).
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
107 infixr 6 :
137 infixr 6 :
139+ -- | Attaches an element to the front of a list.
143+ -- | 1 : [2, 3, 4] = [1, 2, 3, 4]
109 (:) :: forall a. a -> [a] -> [a]
145 (:) :: forall a. a -> [a] -> [a]
110 (:) = cons
146 (:) = cons
@@ -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"
456 instance semigroupOrdening :: Semigroup Ordering where
492 instance semigroupOrdening :: Semigroup Ordering where
457 (<>) LT _ = LT
493 (<>) LT _ = LT
458 (<>) GT _ = GT
494 (<>) GT _ = GT