summaryrefslogtreecommitdiff
path: root/transfer/examples/widesnake.tra
blob: 8b2a199c27ae694199055d51f2cdafc604fcc503 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import bool
import stoneage

monoid_Bool : sig { zero : Bool; plus : Bool -> Bool -> Bool }
monoid_Bool = rec
	        zero = False
	        plus = \x -> \y -> x && y

isSnake : (A : Tree) -> Tree A -> Bool
isSnake _ x = case x of
		Snake -> True
		_ -> composFold ? ? compos_Tree Bool monoid_Bool ? isSnake x

wideSnake : (A : Cat) -> Tree A -> Tree A
wideSnake _ x = case x of
		    Wide y -> let y' = wideSnake ? y
                               in if isSnake CN y' then Thick y' else Wide y'
		    _ -> composOp ? ? compos_Tree ? wideSnake x