haskell - Understanding type -


a few questions haskell programming language:

  1. what's difference between these 2 code statements? i'm convinced should same:

    type t = [char] type currentvalue = char   

    my concern that, in second one, there no brackets.

    anyway, declarations, aren't they?

  2. what maybe string?

    for instance: type p = (char, maybe string)

    is function has 2 arguments?

  3. what maybe char?

    for instance : type d = ((maybe char) , char)

    it's function taking 3 arguments, right?

  1. what's difference between these 2 code statements?

    type t = [char] type currentvalue = char   

    the first line declares type alias t [char] list of characters. second line declares type alias currentvalue char, single character.

  2. what maybe string?

    it application of type constructor maybe type string (which alias [char]). similar how brackets turn type list of type, except maybe makes things optional.

    for instance: type p = (char, maybe string)

    is function has 2 arguments ?

    no, that's tuple type of 2 elements. first element char , second maybe string.

  3. what maybe char ?

    for instance : type d = ((maybe char) , char)

    it's function having 3 arguments. right?

    this again tuple type. type of first element maybe char , second char. inner parenthesis redundant, it's same type d = (maybe char, char).


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -