[Haskell-cafe] how to check thunk

Erik Hesselink hesselink at gmail.com
Mon Jul 2 09:54:08 CEST 2012


There is also the 'isevaluated' package (which depends on vacuum, but
seems to do something more involved than your code).

Erik

On Mon, Jul 2, 2012 at 7:40 AM, Chaddaï Fouché <chaddai.fouche at gmail.com> wrote:
> On Mon, Jul 2, 2012 at 5:29 AM, Kazu Yamamoto <kazu at iij.ad.jp> wrote:
>> Hello,
>>
>> Are there any ways to see if a value is a thunk or memorized?
>> I would like to have a function like:
>>   isThunk :: a -> IO Bool
>>
>
> vacuum allow that and much more though I don't know if it still works
> correctly on GHC 7.4. Anyway your isThunk is
>
>> isThunk a = fmap GHC.Vacuum.ClosureType.isThunk GHC.Vacuum.closureType
>
> (Feel free to arrange your imports to make that a bit more readable ;)
>
> http://hackage.haskell.org/package/vacuum
> --
> Jedaï
>
> _______________________________________________
> 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