[Haskell-beginners] Random variable holding a function
Daniel Bergey
bergey at alum.mit.edu
Thu Feb 26 13:35:17 UTC 2015
On 2015-02-26 at 12:42, Ondrej Nekola <ondra at nekola.cz> wrote:
> type Selection = Population -> Population
>
> so far, it's easy:
>
> allSurvive :: Selection
> allSurvive = id
>
> fairChance :: Int -> Population -> RVar Population
> fairChance newSize p = Population <$> (Data.Random.Extras.sample newSize
> $ individuals p)
>
> fairChance :: Int -> RVar Selection
> (e.g. fairChance :: Int -> RVar (Population -> Population))
>
> Is there a way to do this? Or should I give up this way and try to give
> up some purity and go withtype Selection :: RVar Population -> RVar
> population?
>
> Thanks
> Ondrej
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
More information about the Beginners
mailing list