Skip to content
Newer
Older
100644 61 lines (36 sloc) 1.11 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
9 import Prelude (Int, fromInteger)
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
40d631e @tomlokhorst Made some more changes, code is better now.
authored
19 test = f true
8b57a9e @tomlokhorst Initial checkin
authored
20
40d631e @tomlokhorst Made some more changes, code is better now.
authored
21 -- kk :: Js JsBool
22 -- kk = (not (true :: Js JsBool) :: Js JsBool)
41c088e @tomlokhorst Clearified example.
authored
23
24
25
26
27
28
29
30
31
32
33
34
35
36
f8df28b @tomlokhorst Working on Eq...
authored
37 -- listy :: [Int]
38 -- listy = 3 `cons` (4 `cons` nil)
39
40 -- bool' :: a -> a -> P.Bool -> a
41 -- bool' x y b = if b then x else y
42 --
43 -- f :: (forall a. a -> a -> b -> a) -> a -> b -> a
44 -- f g a b = g a a b
45 --
46 -- ok = f bool'
47 -- -- epicfail = f bool
48 --
49 -- hi = maybe false not
50 -- (just true :: P.Maybe P.Bool)
51 -- -- (just true :: JsC1 JsMaybe (Js JsBool))
52 --
53 -- yo = either (P.* 5) (P.const 2)
54 -- (right false :: P.Either P.Int P.Bool)
55 -- -- (right false :: JsC2 JsEither (Js JsNumber) (Js JsBool))
56 --
57 -- ah = tuple2 (\x y -> x && P.const false y)
58 -- (ctuple2 true 3 :: (,) P.Bool P.Int)
59 -- -- (ctuple2 true 3 :: JsC2 JsTuple2 (Js JsBool) (Js JsNumber))
8b57a9e @tomlokhorst Initial checkin
authored
60
Something went wrong with that request. Please try again.