Skip to content

Commit

Permalink
Added NoImplicitPrelude directive, made type signatures more restrict…
Browse files Browse the repository at this point in the history
…ive to match how the monad functions are implemented in Fay.
  • Loading branch information
brianhv committed Aug 23, 2012
1 parent f7a409c commit 97ff101
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test.hs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{-# LANGUAGE NoImplicitPrelude #-}

module Test (main) where

import Language.Fay.Prelude hiding (return, ($), (.), (>>=), (++), map, foldr, find)
import Language.Fay.Prelude
import Language.Fay.JQuery
import Language.Fay.FFI

(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c)
(>=>) :: (a -> Fay b) -> (b -> Fay c) -> (a -> Fay c)
f >=> g = \x -> f x >>= g

myMapM :: Monad m => (a -> m b) -> [a] -> m [b]
myMapM :: (a -> Fay b) -> [a] -> Fay [b]
myMapM f as = mySequence (map f as)

mySequence :: Monad m => [m a] -> m [a]
mySequence :: [Fay a] -> Fay [a]
mySequence ms = let k m m' = do { x <- m; xs <- m'; return (x:xs) } in
foldr k (return []) ms

Expand Down

0 comments on commit 97ff101

Please sign in to comment.