[Haskell-cafe] how to check thunk

Chaddaï Fouché chaddai.fouche at gmail.com
Mon Jul 2 07:40:43 CEST 2012


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ï



More information about the Haskell-Cafe mailing list