blob: fece8c9c4780c18b9cb7afea90c5bad1eaaf9fb8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
-- !!! Defines functions as an instance of Num
module Main where
instance (Eq a, Eq b) => Eq (a->b)
instance Show (a->b) where
show f = "<<function>>"
instance (Num a, Num b) => Num (a->b) where
f + g = \x -> f x + g x
negate f = \x -> - (f x)
f * g = \x -> f x * g x
fromInteger n = \x -> fromInteger n
ss :: Float -> Float
cc :: Float -> Float
tt :: Float -> Float
ss = sin * sin
cc = cos * cos
tt = ss + cc
-- sin**2 + cos**2 = 1
main = putStrLn ((show (tt 0.4))++ " "++(show (tt 1.652)))
|