@@ -26,7 +26,7 @@ module which defines a binary tree type ``BTree`` (in a file
27 toList : BTree a -> List a
27 toList : BTree a -> List a
28 toList Leaf = []
28 toList Leaf = []
29− toList (Node l v r) = btree.toList l ++ (v :: btree.toList r)
29+ toList (Node l v r) = Btree.toList l ++ (v :: Btree.toList r)
31 toTree : Ord a => List a -> BTree a
31 toTree : Ord a => List a -> BTree a
32 toTree [] = Leaf
32 toTree [] = Leaf
@@ -44,7 +44,7 @@ Then, this gives a main program (in a file
45 main : IO ()
45 main : IO ()
46 main = do let t = toTree [1,8,2,7,9,3]
46 main = do let t = toTree [1,8,2,7,9,3]
47− print (btree.toList t)
47+ print (Btree.toList t)
@@ -118,7 +118,7 @@ functions to be exported as ``abstract``, as we see below:
119 toList : BTree a -> List a
119 toList : BTree a -> List a
120 toList Leaf = []
120 toList Leaf = []
121− toList (Node l v r) = btree.toList l ++ (v :: btree.toList r)
121+ toList (Node l v r) = Btree.toList l ++ (v :: Btree.toList r)
124 toTree : Ord a => List a -> BTree a
124 toTree : Ord a => List a -> BTree a
@@ -128,6 +128,28 @@ functions to be exported as ``abstract``, as we see below:
128Finally, the default export mode can be changed with the ``%access``
128Finally, the default export mode can be changed with the ``%access``
129directive, for example:
129directive, for example:
131+.. code-block:: idris
138+ | Node (BTree a) a (BTree a)
140+ insert : Ord a => a -> BTree a -> BTree a
141+ insert x Leaf = Node Leaf x Leaf
142+ insert x (Node l v r) = if (x < v) then (Node (insert x l) v r)
143+ else (Node l v (insert x r))
145+ toList : BTree a -> List a
147+ toList (Node l v r) = Btree.toList l ++ (v :: Btree.toList r)
149+ toTree : Ord a => List a -> BTree a
151+ toTree (x :: xs) = insert x (toTree xs)
131In this case, any function with no access modifier will be exported as
153In this case, any function with no access modifier will be exported as
132``abstract``, rather than left ``private``.
154``abstract``, rather than left ``private``.