Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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