on master help sign in
Add INLINE pragmas for type class instances
cea3cbbEvan Czaplicki
src/Parse/Primitives.hs+9
@@ -177,6 +177,7 @@ endOfFile =
177
177
178
178
179instance Functor Parser where
179instance Functor Parser where
180+ {-# INLINE fmap #-}
180 fmap f parser =
181 fmap f parser =
181 Parser $ \state cok cerr eok eerr ->
182 Parser $ \state cok cerr eok eerr ->
182 let
183 let
@@ -191,12 +192,18 @@ instance Functor Parser where
191
192
192
193
193instance Applicative.Applicative Parser where
194instance Applicative.Applicative Parser where
195+ {-# INLINE pure #-}
194 pure = return
196 pure = return
197+
198+ {-# INLINE (<*>) #-}
195 (<*>) = ap
199 (<*>) = ap
196
200
197
201
198instance Applicative.Alternative Parser where
202instance Applicative.Alternative Parser where
203+ {-# INLINE empty #-}
199 empty = allTheOptionsFailed
204 empty = allTheOptionsFailed
205+
206+ {-# INLINE (<|>) #-}
200 (<|>) = oneOfHelp
207 (<|>) = oneOfHelp
201
208
202
209
@@ -257,10 +264,12 @@ mergeErrors e1@(ParseError r1 c1 p1) e2@(ParseError r2 c2 p2) =
257
264
258
265
259instance Monad Parser where
266instance Monad Parser where
267+ {-# INLINE return #-}
260 return value =
268 return value =
261 Parser $ \state _ _ eok _ ->
269 Parser $ \state _ _ eok _ ->
262 eok value state noError
270 eok value state noError
263
271
272+ {-# INLINE (>>=) #-}
264 parser >>= callback =
273 parser >>= callback =
265 Parser $ \state cok cerr eok eerr ->
274 Parser $ \state cok cerr eok eerr ->
266 let
275 let