Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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