Beginners Question: Problem with Data Type Declaration

I try to create an own data type containing "Vector Double" from the H-Matrix package. The code: ## data PowerSig = PowerSig Int Double Vector Double main = do let p5 = PowerSig 1 0.1 (fromList [1,2,3]) ## When compiling with ghci, I get however the following message: `Vector' is not applied to enough type arguments Expected kind `?', but `Vector' has kind `* -> *' In the type `Vector' In the definition of data constructor `PowerSig' In the data type declaration for `PowerSig' I don't understand the compilers message and couldn't find any wiki-page/other material to help me. The Data Declaration somehow seems not to understand that "Vector Double" belongs together, but brackets don't help either. Cheers Phil -- View this message in context: http://haskell.1045720.n5.nabble.com/Beginners-Question-Problem-with-Data-Ty... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Hi,
On Thu, Jun 16, 2011 at 9:53 AM, kaffeepause73
I try to create an own data type containing "Vector Double" from the H-Matrix package. The code:
##
data PowerSig = PowerSig Int Double Vector Double
You need to put parenthesis around (Vector Double). Otherwise this is interpreted as a constructor with 4 fields (instead of 3). Johan

Hi Johan, actually quite obvious. Code works now, many thanks. :-) import Data.Packed.Vector data PowerSig = PowerSig Int Double (Vector Double) -- signal Index timeStep data instance Show PowerSig where show (PowerSig idx dt vector) = "PowerSignal Nr: " ++ show idx ++ " dt: " ++ show dt ++ " val:" ++ show vector main = do let p = PowerSig 5 0.1 (fromList [0..10::Double]) putStrLn (show p) -- View this message in context: http://haskell.1045720.n5.nabble.com/Beginners-Question-Problem-with-Data-Ty... Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
participants (2)
-
Johan Tibell
-
kaffeepause73