Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Can someone explain where Applicative instances arise in this code?
- isAlphaNum :: Char -> Bool
- isAlphaNum = (||) <$> isAlpha <*> isNum
- s :: (r -> a -> b) -> (r -> a) -> r -> b
- s f g x = f x (g x)
- newtype Reader r a = Reader (r -> a)
- f <*> x = c -> (f c) (x c)
- isAlphaNum c = (isAlpha c) || (isNum c)
- import Data.Char
- import Control.Applicative
- isAlphaNum = liftA2 (||) isAlpha isNumber
- import Data.Char
- import Control.Monad
- isAlphaNum = liftM2 (||) isAlpha isNumber
- import Data.Function
- orFst = (||) `on` fst
- -- orFst (True,3) (False, 7)
- --> True
Advertisement
Add Comment
Please, Sign In to add comment