Re: [Haskell-cafe] Monad for binary tree data structure

2011-07-23 Thread Александр
Hello, 1) Do you really need a Monad instance for this? Only for training purposes. 2) One possibility is just have it being (Node x _ _) = f = f x I've already tried to do so, but i get only 1 element. Look. I have a function fillTree that's fill this binary tree. let a = fillTree 1 Empty

[Haskell-cafe] Monad for binary tree data structure

2011-07-22 Thread Александр
Hello, I built binary tree with: data Tree a = Empty                | Node a (Tree a) (Tree a)               deriving (Eq, Ord, Read, Show) How can i make Monad type class instance for this tree? And can i make it on not? i try: instance Monad Tree where     return x = Node x Empty Empty 

[Haskell-cafe] Make Show instance

2011-07-21 Thread Александр
Hello, I have binary tree, with every leaf tuple - (k,v): data Tree k v = EmptyTree                  | Node (k, v) (Tree k v) (Tree k v) How can i make Show Instance for (Tree  Int Int) ? I try: instance Show (Tree k v) where      show EmptyTree = show Empty      show (Node (Int, Int) left

Re: [Haskell-cafe] Make Show instance

2011-07-21 Thread Александр
Hello, thank you for reply. I know that i can derive this. But i want to know how can i make it by hand. Thank you. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Make Show instance

2011-07-21 Thread Александр
Hello, Willem Van Lint, Thank you for help, it works. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Can't use libraries in haskell

2011-06-26 Thread Александр
Hello, I'm new in haskell. I want to use xml library (http://hackage.haskell.org/package/xml) in my project. I downloaded it.then try to build and install: runhaskell Setup.hs configure runhaskell Setup.hs build runhaskell Setup.hs install All ok. There are no errors. When i try import

Re: [Haskell-cafe] Can't use libraries in haskell

2011-06-26 Thread Александр
Thank you, for reply. Yes i use ghc. First thing is to do 'ghc-pkg list'. If your package doesn't show up then it's not installed, according to the package registry. 'cabal install' should have registered it. If it is in the list, then it depends how you're building. If you use ghc manually,