Hi, suppose I am looking at the Outline window in the Haskell perspective. Then if I have the following piece of code :
y = 10
main = do
Then the value y appears as "f(.) y" in the outline window. If it is a value, then why is the outline window showing it as a function? Thanks
Because there is no difference, really, in Haskell. A value is a function with no parameter, a constant function if you like, and tthe difference is somewhat subtle (for example: getCurrentTime is a function with no argument but returning always a different value, so a function with no argument is not always a value…). The code we use to generate the outline (Haskell-src-exts) does not differentiate.
But in theory it should be possible to differentiate between the two right? Because we know that if it is a value type then the :t command in ghci yields something with no arrow ->, whereas if it is a function then there exists an arrow -> in the output of :t. Or have I got that wrong? Thanks
getCurrentTime has type IO(). It contains no -> in the type. Is it a value? Or a function?
Actually I just realised that and was rushing back to the forum to correct myself but it seems you beat me to it!:)
So if you made the statement that anything which has :
b)Arrow in type declaration
is a function, and anything else is a value type, then would that work? Thanks
You can have any type of monad transformer wrapping IO, so you'll need a type analysis to decide if the value is constant or not, I believe, so it would add complexify the outline generation…
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.