haskell - Code explanation -


i'm beginner, i'd me understand few lines of code

my questions are:

  1. maybe string application of constructor maybe type string. mean? there equivalent in c language?

  2. is function 3 arguments?

    type t = [char]  type p = (char, maybe string) type delta = ((maybe char, char), maybe string) fromgtom :: t -> [p] -> [delta] 
  3. is usage of above mentioned function?

    fromgtom t p =  terminalrules ++ varrules  

    i don't see why function has 3 arguments 2 used: t, p.

  4. what ++ mean ?

sorry, posting many questions.

thanks in advance.

i attempt answer questions, better off reading book/finding tutorial.

  1. maybe string type indicates value may be string, or may nothing. in c, kind of having string, giving null instead - except in haskell, information put in type, , if omitted maybe, not allowed use nothing. there better explanation @ wikibooks.
  2. no, function of 2 arguments, or function of 1 argument returns function of 1 argument. first argument list of chars (a string), , second list of 2-tuples of char , maybe string. last "argument" return type. currying more information.
  3. no, possibly invalid definition of function (depending on type of terminalrules , varrules). matter, t , p aren't used in definition; terminalrules , varrules being used instead.
  4. (++) list concatenation operator.

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 -