[Haskell-cafe] user type declarations in Haskell

2006-06-22 Thread Vladimir Portnykh
I am trying to define the following types data MyStringType a = String deriving (Eq, Ord, Show) data QADouble a = Double deriving (Eq, Ord, Show) data HType a = QADouble a| DDTraceType a deriving (Eq, Ord, Show) So HType can represent strings or doubles. later I want to do something like the

[Haskell-cafe] do we have something like isDefined or isNull in Haskell?

2006-06-15 Thread Vladimir Portnykh
Suppose there is a data definition in Haskell: data MyType = MyType { date :: Double, weight :: Double, height:: Double } deriving (Eq, Ord, Show) Is it possible to check if the field height, for example, is filled

[Haskell-cafe] Fibonacci numbers generator in Haskell

2006-06-15 Thread Vladimir Portnykh
Fibonacci numbers implementations in Haskell one of the classical examples. An example I found is the following: fibs :: [Int] fibs = 0 : 1 : [ a + b | (a, b) - zip fibs (tail fibs)] To get the k-th number you do the following: Result = fibs !! k It is elegant but creates a list of all

[Haskell-cafe] calling haskell from C++

2006-05-23 Thread Vladimir Portnykh
Hello ALL, I am very new to Haskell and my question might appear very basic sorry about it in advance. I have a C++ application and I would like to be able to launch Haskell interpreter (lets say GHC) supplying the Haskell code (in a file ) to be interpreted from it. The Haskell program