3||| A fancy shower with a constructor
4||| @ a the thing to be shown
5interface MyShow a where
9 ||| @ x will become a string
10 myShow : (x : a) -> String
12twiceAString : MyShow a => a -> String
13twiceAString x = myShow x ++ myShow x
15implementation MyShow Integer where
18badShow : MyShow Integer
19badShow = MkMyShow (const "hej")
21test1 : twiceAString 2 = "22"
24test2 : twiceAString @{InterfaceName.badShow} 2 = "hejhej"
28||| Parent interface fun
29interface MyMagma a where
31 total op : a -> a -> a
34interface MyMagma a => MySemigroup a where
35 constructor MkMySemigroup
36 total isAssoc : (x, y, z : a) -> op x $ op y z = op (op x y) z
38implementation [addition] MyMagma Nat where
41additionS : MySemigroup Nat
42additionS = MkMySemigroup @{addition} plusAssociative
44doIt : MySemigroup a => a -> List a -> a
46doIt x (y :: xs) = doIt (x `op` y) xs
49test = doIt @{additionS} 22 [1,2,3,4]
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list