[Haskell-cafe] Main function variables made global.
mantkiew at gsd.uwaterloo.ca
mantkiew at gsd.uwaterloo.ca
Thu Mar 27 11:39:37 UTC 2014
Anthony, maybe simply add var as a parameter and partially apply func in main? That'll give you the right type.
Michal
Original Message
From: Tom Ellis
Sent: Thursday, March 27, 2014 7:06 AM
To: haskell-cafe at haskell.org
Subject: Re: [Haskell-cafe] Main function variables made global.
On Thu, Mar 27, 2014 at 10:58:45AM +0000, Chapman, Anthony Sergio wrote:
> func w = w * var
>
> I get the value of 'var' from a text file in the main function (as the
> user types the name of the file into terminal)
>
> I need a way for 'func' to see what 'var' is without having to change
> it's type (ie make it into a function which take a 'w' and a 'var'.
>
> The reason I can't change the type is that I then pass the function to a
> PSO module which has strict declarations of a function and I would rather
> not change the PSO module.
It's not quite clear to me what you're asking, but won't something like this
do?
do var <- readVar
let func w = w * var
let result = psoFunction func
Tom
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list