Haskell type error using inferred type -


i created data type hold basic user information , loaded ghci. used ghci @ new data types type signature. copied type signature ghci source file , tried reload file. ghci threw error.

the code , error below.

my question is, why throwing error. used type inferred ghci.

user :: int -> string -> string -> string -> string -> user data user = user { userid :: int,                    login :: string,                    password :: string,                    username :: string,                    email :: string                    } deriving (show) 

prelude> :r user [1 of 1] compiling user ( user.hs, interpreted )

user.hs:3:0: invalid type signature failed, modules loaded: none.

you may declare type of value (such function), may not declare type of data type or of data constructor using type declaration syntax values. in fact, declaring full type of data type , data constructor when define them, there no need additional type declaration. leave out line user :: ...; line syntax error because user capital u (constructor) , lower-case names (values) may have ascribed types.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -