# HG changeset patch # User haftmann # Date 1283871481 -7200 # Node ID 985b13c5a61d2fcc7f09397b2e4d151989db1410 # Parent 1ca9055ba1f7144ed3ab02aacc9c86805bce5614 updated generated document diff -r 1ca9055ba1f7 -r 985b13c5a61d doc-src/Classes/Thy/document/Classes.tex --- a/doc-src/Classes/Thy/document/Classes.tex Tue Sep 07 16:49:32 2010 +0200 +++ b/doc-src/Classes/Thy/document/Classes.tex Tue Sep 07 16:58:01 2010 +0200 @@ -1134,65 +1134,64 @@ \noindent% \hspace*{0pt}module Example where {\char123}\\ \hspace*{0pt}\\ -\hspace*{0pt}data Nat = Zero{\char95}nat | Suc Example.Nat;\\ +\hspace*{0pt}data Nat = Zero{\char95}nat | Suc Nat;\\ \hspace*{0pt}\\ -\hspace*{0pt}nat{\char95}aux ::~Integer -> Example.Nat -> Example.Nat;\\ -\hspace*{0pt}nat{\char95}aux i n =\\ -\hspace*{0pt} ~(if i <= 0 then n else Example.nat{\char95}aux (i - 1) (Example.Suc n));\\ +\hspace*{0pt}nat{\char95}aux ::~Integer -> Nat -> Nat;\\ +\hspace*{0pt}nat{\char95}aux i n = (if i <= 0 then n else nat{\char95}aux (i - 1) (Suc n));\\ \hspace*{0pt}\\ -\hspace*{0pt}nat ::~Integer -> Example.Nat;\\ -\hspace*{0pt}nat i = Example.nat{\char95}aux i Example.Zero{\char95}nat;\\ +\hspace*{0pt}nat ::~Integer -> Nat;\\ +\hspace*{0pt}nat i = nat{\char95}aux i Zero{\char95}nat;\\ \hspace*{0pt}\\ \hspace*{0pt}class Semigroup a where {\char123}\\ \hspace*{0pt} ~mult ::~a -> a -> a;\\ \hspace*{0pt}{\char125};\\ \hspace*{0pt}\\ -\hspace*{0pt}class (Example.Semigroup a) => Monoidl a where {\char123}\\ +\hspace*{0pt}class (Semigroup a) => Monoidl a where {\char123}\\ \hspace*{0pt} ~neutral ::~a;\\ \hspace*{0pt}{\char125};\\ \hspace*{0pt}\\ -\hspace*{0pt}class (Example.Monoidl a) => Monoid a where {\char123}\\ +\hspace*{0pt}class (Monoidl a) => Monoid a where {\char123}\\ \hspace*{0pt}{\char125};\\ \hspace*{0pt}\\ -\hspace*{0pt}class (Example.Monoid a) => Group a where {\char123}\\ +\hspace*{0pt}class (Monoid a) => Group a where {\char123}\\ \hspace*{0pt} ~inverse ::~a -> a;\\ \hspace*{0pt}{\char125};\\ \hspace*{0pt}\\ +\hspace*{0pt}pow{\char95}nat ::~forall a.~(Monoid a) => Nat -> a -> a;\\ +\hspace*{0pt}pow{\char95}nat Zero{\char95}nat x = neutral;\\ +\hspace*{0pt}pow{\char95}nat (Suc n) x = mult x (pow{\char95}nat n x);\\ +\hspace*{0pt}\\ +\hspace*{0pt}pow{\char95}int ::~forall a.~(Group a) => Integer -> a -> a;\\ +\hspace*{0pt}pow{\char95}int k x =\\ +\hspace*{0pt} ~(if 0 <= k then pow{\char95}nat (nat k) x\\ +\hspace*{0pt} ~~~else inverse (pow{\char95}nat (nat (negate k)) x));\\ +\hspace*{0pt}\\ \hspace*{0pt}mult{\char95}int ::~Integer -> Integer -> Integer;\\ \hspace*{0pt}mult{\char95}int i j = i + j;\\ \hspace*{0pt}\\ +\hspace*{0pt}instance Semigroup Integer where {\char123}\\ +\hspace*{0pt} ~mult = mult{\char95}int;\\ +\hspace*{0pt}{\char125};\\ +\hspace*{0pt}\\ \hspace*{0pt}neutral{\char95}int ::~Integer;\\ \hspace*{0pt}neutral{\char95}int = 0;\\ \hspace*{0pt}\\ +\hspace*{0pt}instance Monoidl Integer where {\char123}\\ +\hspace*{0pt} ~neutral = neutral{\char95}int;\\ +\hspace*{0pt}{\char125};\\ +\hspace*{0pt}\\ +\hspace*{0pt}instance Monoid Integer where {\char123}\\ +\hspace*{0pt}{\char125};\\ +\hspace*{0pt}\\ \hspace*{0pt}inverse{\char95}int ::~Integer -> Integer;\\ \hspace*{0pt}inverse{\char95}int i = negate i;\\ \hspace*{0pt}\\ -\hspace*{0pt}instance Example.Semigroup Integer where {\char123}\\ -\hspace*{0pt} ~mult = Example.mult{\char95}int;\\ +\hspace*{0pt}instance Group Integer where {\char123}\\ +\hspace*{0pt} ~inverse = inverse{\char95}int;\\ \hspace*{0pt}{\char125};\\ \hspace*{0pt}\\ -\hspace*{0pt}instance Example.Monoidl Integer where {\char123}\\ -\hspace*{0pt} ~neutral = Example.neutral{\char95}int;\\ -\hspace*{0pt}{\char125};\\ -\hspace*{0pt}\\ -\hspace*{0pt}instance Example.Monoid Integer where {\char123}\\ -\hspace*{0pt}{\char125};\\ -\hspace*{0pt}\\ -\hspace*{0pt}instance Example.Group Integer where {\char123}\\ -\hspace*{0pt} ~inverse = Example.inverse{\char95}int;\\ -\hspace*{0pt}{\char125};\\ -\hspace*{0pt}\\ -\hspace*{0pt}pow{\char95}nat ::~forall a.~(Example.Monoid a) => Example.Nat -> a -> a;\\ -\hspace*{0pt}pow{\char95}nat Example.Zero{\char95}nat x = Example.neutral;\\ -\hspace*{0pt}pow{\char95}nat (Example.Suc n) x = Example.mult x (Example.pow{\char95}nat n x);\\ -\hspace*{0pt}\\ -\hspace*{0pt}pow{\char95}int ::~forall a.~(Example.Group a) => Integer -> a -> a;\\ -\hspace*{0pt}pow{\char95}int k x =\\ -\hspace*{0pt} ~(if 0 <= k then Example.pow{\char95}nat (Example.nat k) x\\ -\hspace*{0pt} ~~~else Example.inverse (Example.pow{\char95}nat (Example.nat (negate k)) x));\\ -\hspace*{0pt}\\ \hspace*{0pt}example ::~Integer;\\ -\hspace*{0pt}example = Example.pow{\char95}int 10 (-2);\\ +\hspace*{0pt}example = pow{\char95}int 10 (-2);\\ \hspace*{0pt}\\ \hspace*{0pt}{\char125}% \end{isamarkuptext}% diff -r 1ca9055ba1f7 -r 985b13c5a61d doc-src/Codegen/Thy/document/Foundations.tex --- a/doc-src/Codegen/Thy/document/Foundations.tex Tue Sep 07 16:49:32 2010 +0200 +++ b/doc-src/Codegen/Thy/document/Foundations.tex Tue Sep 07 16:58:01 2010 +0200 @@ -247,11 +247,11 @@ \begin{isamarkuptext}% \isatypewriter% \noindent% -\hspace*{0pt}dequeue ::~forall a.~Example.Queue a -> (Maybe a,~Example.Queue a);\\ -\hspace*{0pt}dequeue (Example.AQueue xs (y :~ys)) = (Just y,~Example.AQueue xs ys);\\ -\hspace*{0pt}dequeue (Example.AQueue xs []) =\\ -\hspace*{0pt} ~(if null xs then (Nothing,~Example.AQueue [] [])\\ -\hspace*{0pt} ~~~else Example.dequeue (Example.AQueue [] (reverse xs)));% +\hspace*{0pt}dequeue ::~forall a.~Queue a -> (Maybe a,~Queue a);\\ +\hspace*{0pt}dequeue (AQueue xs (y :~ys)) = (Just y,~AQueue xs ys);\\ +\hspace*{0pt}dequeue (AQueue xs []) =\\ +\hspace*{0pt} ~(if null xs then (Nothing,~AQueue [] [])\\ +\hspace*{0pt} ~~~else dequeue (AQueue [] (reverse xs)));% \end{isamarkuptext}% \isamarkuptrue% % @@ -444,12 +444,12 @@ \begin{isamarkuptext}% \isatypewriter% \noindent% -\hspace*{0pt}strict{\char95}dequeue ::~forall a.~Example.Queue a -> (a,~Example.Queue a);\\ -\hspace*{0pt}strict{\char95}dequeue (Example.AQueue xs []) =\\ +\hspace*{0pt}strict{\char95}dequeue ::~forall a.~Queue a -> (a,~Queue a);\\ +\hspace*{0pt}strict{\char95}dequeue (AQueue xs []) =\\ \hspace*{0pt} ~let {\char123}\\ \hspace*{0pt} ~~~(y :~ys) = reverse xs;\\ -\hspace*{0pt} ~{\char125}~in (y,~Example.AQueue [] ys);\\ -\hspace*{0pt}strict{\char95}dequeue (Example.AQueue xs (y :~ys)) = (y,~Example.AQueue xs ys);% +\hspace*{0pt} ~{\char125}~in (y,~AQueue [] ys);\\ +\hspace*{0pt}strict{\char95}dequeue (AQueue xs (y :~ys)) = (y,~AQueue xs ys);% \end{isamarkuptext}% \isamarkuptrue% % @@ -538,11 +538,11 @@ \hspace*{0pt}empty{\char95}queue ::~forall a.~a;\\ \hspace*{0pt}empty{\char95}queue = error {\char34}empty{\char95}queue{\char34};\\ \hspace*{0pt}\\ -\hspace*{0pt}strict{\char95}dequeue ::~forall a.~Example.Queue a -> (a,~Example.Queue a);\\ -\hspace*{0pt}strict{\char95}dequeue (Example.AQueue xs (y :~ys)) = (y,~Example.AQueue xs ys);\\ -\hspace*{0pt}strict{\char95}dequeue (Example.AQueue xs []) =\\ -\hspace*{0pt} ~(if null xs then Example.empty{\char95}queue\\ -\hspace*{0pt} ~~~else Example.strict{\char95}dequeue (Example.AQueue [] (reverse xs)));% +\hspace*{0pt}strict{\char95}dequeue ::~forall a.~Queue a -> (a,~Queue a);\\ +\hspace*{0pt}strict{\char95}dequeue (AQueue xs (y :~ys)) = (y,~AQueue xs ys);\\ +\hspace*{0pt}strict{\char95}dequeue (AQueue xs []) =\\ +\hspace*{0pt} ~(if null xs then empty{\char95}queue\\ +\hspace*{0pt} ~~~else strict{\char95}dequeue (AQueue [] (reverse xs)));% \end{isamarkuptext}% \isamarkuptrue% % diff -r 1ca9055ba1f7 -r 985b13c5a61d doc-src/Codegen/Thy/document/Further.tex --- a/doc-src/Codegen/Thy/document/Further.tex Tue Sep 07 16:49:32 2010 +0200 +++ b/doc-src/Codegen/Thy/document/Further.tex Tue Sep 07 16:58:01 2010 +0200 @@ -216,13 +216,13 @@ \begin{isamarkuptext}% \isatypewriter% \noindent% -\hspace*{0pt}funpow ::~forall a.~Example.Nat -> (a -> a) -> a -> a;\\ -\hspace*{0pt}funpow Example.Zero{\char95}nat f = id;\\ -\hspace*{0pt}funpow (Example.Suc n) f = f .~Example.funpow n f;\\ +\hspace*{0pt}funpow ::~forall a.~Nat -> (a -> a) -> a -> a;\\ +\hspace*{0pt}funpow Zero{\char95}nat f = id;\\ +\hspace*{0pt}funpow (Suc n) f = f .~funpow n f;\\ \hspace*{0pt}\\ -\hspace*{0pt}funpows ::~forall a.~[Example.Nat] -> (a -> a) -> a -> a;\\ +\hspace*{0pt}funpows ::~forall a.~[Nat] -> (a -> a) -> a -> a;\\ \hspace*{0pt}funpows [] = id;\\ -\hspace*{0pt}funpows (x :~xs) = Example.funpow x .~Example.funpows xs;% +\hspace*{0pt}funpows (x :~xs) = funpow x .~funpows xs;% \end{isamarkuptext}% \isamarkuptrue% % diff -r 1ca9055ba1f7 -r 985b13c5a61d doc-src/Codegen/Thy/document/Introduction.tex --- a/doc-src/Codegen/Thy/document/Introduction.tex Tue Sep 07 16:49:32 2010 +0200 +++ b/doc-src/Codegen/Thy/document/Introduction.tex Tue Sep 07 16:58:01 2010 +0200 @@ -231,19 +231,19 @@ \hspace*{0pt}\\ \hspace*{0pt}data Queue a = AQueue [a] [a];\\ \hspace*{0pt}\\ -\hspace*{0pt}empty ::~forall a.~Example.Queue a;\\ -\hspace*{0pt}empty = Example.AQueue [] [];\\ +\hspace*{0pt}empty ::~forall a.~Queue a;\\ +\hspace*{0pt}empty = AQueue [] [];\\ \hspace*{0pt}\\ -\hspace*{0pt}dequeue ::~forall a.~Example.Queue a -> (Maybe a,~Example.Queue a);\\ -\hspace*{0pt}dequeue (Example.AQueue [] []) = (Nothing,~Example.AQueue [] []);\\ -\hspace*{0pt}dequeue (Example.AQueue xs (y :~ys)) = (Just y,~Example.AQueue xs ys);\\ -\hspace*{0pt}dequeue (Example.AQueue (v :~va) []) =\\ +\hspace*{0pt}dequeue ::~forall a.~Queue a -> (Maybe a,~Queue a);\\ +\hspace*{0pt}dequeue (AQueue [] []) = (Nothing,~AQueue [] []);\\ +\hspace*{0pt}dequeue (AQueue xs (y :~ys)) = (Just y,~AQueue xs ys);\\ +\hspace*{0pt}dequeue (AQueue (v :~va) []) =\\ \hspace*{0pt} ~let {\char123}\\ \hspace*{0pt} ~~~(y :~ys) = reverse (v :~va);\\ -\hspace*{0pt} ~{\char125}~in (Just y,~Example.AQueue [] ys);\\ +\hspace*{0pt} ~{\char125}~in (Just y,~AQueue [] ys);\\ \hspace*{0pt}\\ -\hspace*{0pt}enqueue ::~forall a.~a -> Example.Queue a -> Example.Queue a;\\ -\hspace*{0pt}enqueue x (Example.AQueue xs ys) = Example.AQueue (x :~xs) ys;\\ +\hspace*{0pt}enqueue ::~forall a.~a -> Queue a -> Queue a;\\ +\hspace*{0pt}enqueue x (AQueue xs ys) = AQueue (x :~xs) ys;\\ \hspace*{0pt}\\ \hspace*{0pt}{\char125}% \end{isamarkuptext}% @@ -397,41 +397,41 @@ \noindent% \hspace*{0pt}module Example where {\char123}\\ \hspace*{0pt}\\ -\hspace*{0pt}data Nat = Zero{\char95}nat | Suc Example.Nat;\\ +\hspace*{0pt}data Nat = Zero{\char95}nat | Suc Nat;\\ \hspace*{0pt}\\ -\hspace*{0pt}plus{\char95}nat ::~Example.Nat -> Example.Nat -> Example.Nat;\\ -\hspace*{0pt}plus{\char95}nat (Example.Suc m) n = Example.plus{\char95}nat m (Example.Suc n);\\ -\hspace*{0pt}plus{\char95}nat Example.Zero{\char95}nat n = n;\\ +\hspace*{0pt}plus{\char95}nat ::~Nat -> Nat -> Nat;\\ +\hspace*{0pt}plus{\char95}nat (Suc m) n = plus{\char95}nat m (Suc n);\\ +\hspace*{0pt}plus{\char95}nat Zero{\char95}nat n = n;\\ \hspace*{0pt}\\ \hspace*{0pt}class Semigroup a where {\char123}\\ \hspace*{0pt} ~mult ::~a -> a -> a;\\ \hspace*{0pt}{\char125};\\ \hspace*{0pt}\\ -\hspace*{0pt}class (Example.Semigroup a) => Monoid a where {\char123}\\ +\hspace*{0pt}class (Semigroup a) => Monoid a where {\char123}\\ \hspace*{0pt} ~neutral ::~a;\\ \hspace*{0pt}{\char125};\\ \hspace*{0pt}\\ -\hspace*{0pt}pow ::~forall a.~(Example.Monoid a) => Example.Nat -> a -> a;\\ -\hspace*{0pt}pow Example.Zero{\char95}nat a = Example.neutral;\\ -\hspace*{0pt}pow (Example.Suc n) a = Example.mult a (Example.pow n a);\\ +\hspace*{0pt}pow ::~forall a.~(Monoid a) => Nat -> a -> a;\\ +\hspace*{0pt}pow Zero{\char95}nat a = neutral;\\ +\hspace*{0pt}pow (Suc n) a = mult a (pow n a);\\ \hspace*{0pt}\\ -\hspace*{0pt}mult{\char95}nat ::~Example.Nat -> Example.Nat -> Example.Nat;\\ -\hspace*{0pt}mult{\char95}nat Example.Zero{\char95}nat n = Example.Zero{\char95}nat;\\ -\hspace*{0pt}mult{\char95}nat (Example.Suc m) n = Example.plus{\char95}nat n (Example.mult{\char95}nat m n);\\ +\hspace*{0pt}mult{\char95}nat ::~Nat -> Nat -> Nat;\\ +\hspace*{0pt}mult{\char95}nat Zero{\char95}nat n = Zero{\char95}nat;\\ +\hspace*{0pt}mult{\char95}nat (Suc m) n = plus{\char95}nat n (mult{\char95}nat m n);\\ \hspace*{0pt}\\ -\hspace*{0pt}neutral{\char95}nat ::~Example.Nat;\\ -\hspace*{0pt}neutral{\char95}nat = Example.Suc Example.Zero{\char95}nat;\\ -\hspace*{0pt}\\ -\hspace*{0pt}instance Example.Semigroup Example.Nat where {\char123}\\ -\hspace*{0pt} ~mult = Example.mult{\char95}nat;\\ +\hspace*{0pt}instance Semigroup Nat where {\char123}\\ +\hspace*{0pt} ~mult = mult{\char95}nat;\\ \hspace*{0pt}{\char125};\\ \hspace*{0pt}\\ -\hspace*{0pt}instance Example.Monoid Example.Nat where {\char123}\\ -\hspace*{0pt} ~neutral = Example.neutral{\char95}nat;\\ +\hspace*{0pt}neutral{\char95}nat ::~Nat;\\ +\hspace*{0pt}neutral{\char95}nat = Suc Zero{\char95}nat;\\ +\hspace*{0pt}\\ +\hspace*{0pt}instance Monoid Nat where {\char123}\\ +\hspace*{0pt} ~neutral = neutral{\char95}nat;\\ \hspace*{0pt}{\char125};\\ \hspace*{0pt}\\ -\hspace*{0pt}bexp ::~Example.Nat -> Example.Nat;\\ -\hspace*{0pt}bexp n = Example.pow n (Example.Suc (Example.Suc Example.Zero{\char95}nat));\\ +\hspace*{0pt}bexp ::~Nat -> Nat;\\ +\hspace*{0pt}bexp n = pow n (Suc (Suc Zero{\char95}nat));\\ \hspace*{0pt}\\ \hspace*{0pt}{\char125}% \end{isamarkuptext}% diff -r 1ca9055ba1f7 -r 985b13c5a61d doc-src/Codegen/Thy/document/Refinement.tex --- a/doc-src/Codegen/Thy/document/Refinement.tex Tue Sep 07 16:49:32 2010 +0200 +++ b/doc-src/Codegen/Thy/document/Refinement.tex Tue Sep 07 16:58:01 2010 +0200 @@ -74,11 +74,10 @@ \begin{isamarkuptext}% \isatypewriter% \noindent% -\hspace*{0pt}fib ::~Example.Nat -> Example.Nat;\\ -\hspace*{0pt}fib Example.Zero{\char95}nat = Example.Zero{\char95}nat;\\ -\hspace*{0pt}fib (Example.Suc Example.Zero{\char95}nat) = Example.Suc Example.Zero{\char95}nat;\\ -\hspace*{0pt}fib (Example.Suc (Example.Suc n)) =\\ -\hspace*{0pt} ~Example.plus{\char95}nat (Example.fib n) (Example.fib (Example.Suc n));% +\hspace*{0pt}fib ::~Nat -> Nat;\\ +\hspace*{0pt}fib Zero{\char95}nat = Zero{\char95}nat;\\ +\hspace*{0pt}fib (Suc Zero{\char95}nat) = Suc Zero{\char95}nat;\\ +\hspace*{0pt}fib (Suc (Suc n)) = plus{\char95}nat (fib n) (fib (Suc n));% \end{isamarkuptext}% \isamarkuptrue% % @@ -173,17 +172,15 @@ \begin{isamarkuptext}% \isatypewriter% \noindent% -\hspace*{0pt}fib{\char95}step ::~Example.Nat -> (Example.Nat,~Example.Nat);\\ -\hspace*{0pt}fib{\char95}step (Example.Suc n) =\\ -\hspace*{0pt} ~let {\char123}\\ -\hspace*{0pt} ~~~(m,~q) = Example.fib{\char95}step n;\\ -\hspace*{0pt} ~{\char125}~in (Example.plus{\char95}nat m q,~m);\\ -\hspace*{0pt}fib{\char95}step Example.Zero{\char95}nat =\\ -\hspace*{0pt} ~(Example.Suc Example.Zero{\char95}nat,~Example.Zero{\char95}nat);\\ +\hspace*{0pt}fib{\char95}step ::~Nat -> (Nat,~Nat);\\ +\hspace*{0pt}fib{\char95}step (Suc n) = let {\char123}\\ +\hspace*{0pt} ~~~~~~~~~~~~~~~~~~~~(m,~q) = fib{\char95}step n;\\ +\hspace*{0pt} ~~~~~~~~~~~~~~~~~~{\char125}~in (plus{\char95}nat m q,~m);\\ +\hspace*{0pt}fib{\char95}step Zero{\char95}nat = (Suc Zero{\char95}nat,~Zero{\char95}nat);\\ \hspace*{0pt}\\ -\hspace*{0pt}fib ::~Example.Nat -> Example.Nat;\\ -\hspace*{0pt}fib (Example.Suc n) = fst (Example.fib{\char95}step n);\\ -\hspace*{0pt}fib Example.Zero{\char95}nat = Example.Zero{\char95}nat;% +\hspace*{0pt}fib ::~Nat -> Nat;\\ +\hspace*{0pt}fib (Suc n) = fst (fib{\char95}step n);\\ +\hspace*{0pt}fib Zero{\char95}nat = Zero{\char95}nat;% \end{isamarkuptext}% \isamarkuptrue% % @@ -593,30 +590,28 @@ \hspace*{0pt}\\ \hspace*{0pt}newtype Dlist a = Dlist [a];\\ \hspace*{0pt}\\ -\hspace*{0pt}empty ::~forall a.~Example.Dlist a;\\ -\hspace*{0pt}empty = Example.Dlist [];\\ +\hspace*{0pt}empty ::~forall a.~Dlist a;\\ +\hspace*{0pt}empty = Dlist [];\\ \hspace*{0pt}\\ \hspace*{0pt}member ::~forall a.~(Eq a) => [a] -> a -> Bool;\\ \hspace*{0pt}member [] y = False;\\ -\hspace*{0pt}member (x :~xs) y = x == y || Example.member xs y;\\ +\hspace*{0pt}member (x :~xs) y = x == y || member xs y;\\ \hspace*{0pt}\\ -\hspace*{0pt}inserta ::~forall a.~(Eq a) => a -> [a] -> [a];\\ -\hspace*{0pt}inserta x xs = (if Example.member xs x then xs else x :~xs);\\ +\hspace*{0pt}insert ::~forall a.~(Eq a) => a -> [a] -> [a];\\ +\hspace*{0pt}insert x xs = (if member xs x then xs else x :~xs);\\ \hspace*{0pt}\\ -\hspace*{0pt}list{\char95}of{\char95}dlist ::~forall a.~Example.Dlist a -> [a];\\ -\hspace*{0pt}list{\char95}of{\char95}dlist (Example.Dlist x) = x;\\ +\hspace*{0pt}list{\char95}of{\char95}dlist ::~forall a.~Dlist a -> [a];\\ +\hspace*{0pt}list{\char95}of{\char95}dlist (Dlist x) = x;\\ \hspace*{0pt}\\ -\hspace*{0pt}insert ::~forall a.~(Eq a) => a -> Example.Dlist a -> Example.Dlist a;\\ -\hspace*{0pt}insert x dxs =\\ -\hspace*{0pt} ~Example.Dlist (Example.inserta x (Example.list{\char95}of{\char95}dlist dxs));\\ +\hspace*{0pt}inserta ::~forall a.~(Eq a) => a -> Dlist a -> Dlist a;\\ +\hspace*{0pt}inserta x dxs = Dlist (insert x (list{\char95}of{\char95}dlist dxs));\\ \hspace*{0pt}\\ \hspace*{0pt}remove1 ::~forall a.~(Eq a) => a -> [a] -> [a];\\ \hspace*{0pt}remove1 x [] = [];\\ -\hspace*{0pt}remove1 x (y :~xs) = (if x == y then xs else y :~Example.remove1 x xs);\\ +\hspace*{0pt}remove1 x (y :~xs) = (if x == y then xs else y :~remove1 x xs);\\ \hspace*{0pt}\\ -\hspace*{0pt}remove ::~forall a.~(Eq a) => a -> Example.Dlist a -> Example.Dlist a;\\ -\hspace*{0pt}remove x dxs =\\ -\hspace*{0pt} ~Example.Dlist (Example.remove1 x (Example.list{\char95}of{\char95}dlist dxs));\\ +\hspace*{0pt}remove ::~forall a.~(Eq a) => a -> Dlist a -> Dlist a;\\ +\hspace*{0pt}remove x dxs = Dlist (remove1 x (list{\char95}of{\char95}dlist dxs));\\ \hspace*{0pt}\\ \hspace*{0pt}{\char125}% \end{isamarkuptext}% diff -r 1ca9055ba1f7 -r 985b13c5a61d doc-src/Codegen/Thy/examples/Example.hs --- a/doc-src/Codegen/Thy/examples/Example.hs Tue Sep 07 16:49:32 2010 +0200 +++ b/doc-src/Codegen/Thy/examples/Example.hs Tue Sep 07 16:58:01 2010 +0200 @@ -4,18 +4,18 @@ data Queue a = AQueue [a] [a]; -empty :: forall a. Example.Queue a; -empty = Example.AQueue [] []; +empty :: forall a. Queue a; +empty = AQueue [] []; -dequeue :: forall a. Example.Queue a -> (Maybe a, Example.Queue a); -dequeue (Example.AQueue [] []) = (Nothing, Example.AQueue [] []); -dequeue (Example.AQueue xs (y : ys)) = (Just y, Example.AQueue xs ys); -dequeue (Example.AQueue (v : va) []) = +dequeue :: forall a. Queue a -> (Maybe a, Queue a); +dequeue (AQueue [] []) = (Nothing, AQueue [] []); +dequeue (AQueue xs (y : ys)) = (Just y, AQueue xs ys); +dequeue (AQueue (v : va) []) = let { (y : ys) = reverse (v : va); - } in (Just y, Example.AQueue [] ys); + } in (Just y, AQueue [] ys); -enqueue :: forall a. a -> Example.Queue a -> Example.Queue a; -enqueue x (Example.AQueue xs ys) = Example.AQueue (x : xs) ys; +enqueue :: forall a. a -> Queue a -> Queue a; +enqueue x (AQueue xs ys) = AQueue (x : xs) ys; }