Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 62 lines (37 sloc) 1.162 kB
ef4abad @tomlokhorst Example of how partial application fails (see `epicfail`)
authored
1 {-# LANGUAGE NoImplicitPrelude, RankNTypes #-}
8b57a9e @tomlokhorst Initial checkin
authored
2
3 module Main where
4
5 import AwesomePrelude
6 import HaskellPrelude
7 import JsPrelude
8
9cd320d Less string literals.
Sebastiaan Visser authored
9 import Prelude (Int)
ef4abad @tomlokhorst Example of how partial application fails (see `epicfail`)
authored
10 import qualified Prelude as P
8b57a9e @tomlokhorst Initial checkin
authored
11
12
41c088e @tomlokhorst Clearified example.
authored
13 -- Switch between these two types to see the AwesomePrelude in action!
14
40d631e @tomlokhorst Made some more changes, code is better now.
authored
15 f :: Js JsBool -> Js JsBool
16 --f :: P.Bool -> P.Bool
17 f x = not x && false || true
41c088e @tomlokhorst Clearified example.
authored
18
85fcc2f Introduced JS operator for better output.
Sebastiaan Visser authored
19 test :: Js JsBool
20 test = true || false && f false
8b57a9e @tomlokhorst Initial checkin
authored
21
40d631e @tomlokhorst Made some more changes, code is better now.
authored
22 -- kk :: Js JsBool
23 -- kk = (not (true :: Js JsBool) :: Js JsBool)
41c088e @tomlokhorst Clearified example.
authored
24
25
26
27
28
29
30
31
32
33
34
35
36
37
f8df28b @tomlokhorst Working on Eq...
authored
38 -- listy :: [Int]
39 -- listy = 3 `cons` (4 `cons` nil)
40
41 -- bool' :: a -> a -> P.Bool -> a
42 -- bool' x y b = if b then x else y
43 --
44 -- f :: (forall a. a -> a -> b -> a) -> a -> b -> a
45 -- f g a b = g a a b
46 --
47 -- ok = f bool'
48 -- -- epicfail = f bool
49 --
50 -- hi = maybe false not
51 -- (just true :: P.Maybe P.Bool)
52 -- -- (just true :: JsC1 JsMaybe (Js JsBool))
53 --
54 -- yo = either (P.* 5) (P.const 2)
55 -- (right false :: P.Either P.Int P.Bool)
56 -- -- (right false :: JsC2 JsEither (Js JsNumber) (Js JsBool))
57 --
58 -- ah = tuple2 (\x y -> x && P.const false y)
59 -- (ctuple2 true 3 :: (,) P.Bool P.Int)
60 -- -- (ctuple2 true 3 :: JsC2 JsTuple2 (Js JsBool) (Js JsNumber))
8b57a9e @tomlokhorst Initial checkin
authored
61
Something went wrong with that request. Please try again.