Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

README: Fix type error in example, add imports and pragmas, and updat…

…e comments (closes #24)
  • Loading branch information...
commit 8977424261e697e45cc826415ce47f6e499c575d 1 parent 8a3bb61
@bergmark bergmark authored
Showing with 12 additions and 3 deletions.
  1. +12 −3 README.md
View
15 README.md
@@ -15,16 +15,25 @@ methods operate is the *last* parameter to every function. This allows simple
monadic composition:
```haskell
+{-# LANGUAGE RebindableSyntax, OverloadedStrings #-}
+
+import Fay.Text (fromString)
+import JQuery
+import Prelude
+
+(>=>) :: (a -> Fay b) -> (b -> Fay c) -> a -> Fay c
+f >=> g = \x -> f x >>= g
+
makeSquare :: JQuery -> Fay JQuery
makeSquare = addClass "square" >=>
setWidth 400 >=>
setHeight 400
--- `ready` is the same as jQuery(document).ready(%1); fay-jquery things will
--- probably break if this is omitted!
+-- `ready` is the same as jQuery(document).ready(%1);
+-- You generally need to wait for this event to fire before modifying the DOM.
main :: Fay ()
main = ready $ do
- makeSquare $ select "#elementToMakeSquare"
+ select "#elementToMakeSquare" >>= makeSquare
return ()
```
Please sign in to comment.
Something went wrong with that request. Please try again.