What is ARR_WORDS in a GHC heap profile?
ARR_WORDS is the internal name of ByteArray#, which is a GHC type used to implement e.g. ByteString, Text and unboxed arrays.
ARR_WORDS is the internal name of ByteArray#, which is a GHC type used to implement e.g. ByteString, Text and unboxed arrays.
Yes, it’s a bug. Here’s a workaround to save folks clicking and scrolling: {-# LANGUAGE ForeignFunctionInterface #-} import Data.Char import Foreign.C.Types getHiddenChar = fmap (chr.fromEnum) c_getch foreign import ccall unsafe “conio.h getch” c_getch :: IO CInt So you can replace calls to getChar with calls to getHiddenChar. Note this is a workaround just for ghc/ghci … Read more
This is possible with the ScopedTypeVariables extension. You need to use explicit forall’s to bring the type variables into scope. blah :: forall a b. a -> b -> a blah x y = ble x where ble :: b -> b ble x = x Trying to load this definition with ScopedTypeVariables enabled gives: … Read more
A good way to debug Haskell code is to write and test algebraic laws using QuickCheck and SmallCheck. There have been several Haskell debuggers including Hat, Hood, and Freya, but none of them have been perceived as sufficiently valuable to be worth maintaining for a long time. When it’s Haskell, you have to think differently … Read more
The flag is -with-rtsopts, not –with-rtsopts, so you should add -with-rtsopts=-N to the ghc-options field. GHC Flag Reference. Note that this will also require you to link with runtime support by adding -rtsopts to the ghc-options.
What about ghc -fno-code file.hs. It will generate no other files and will show errors if your files don’t typecheck. Caveat: this will not do analysis on in-exhaustive pattern matches, so if you want those additional useful warnings, don’t use this option alone.
I once stumbled upon the following. Answering this question, I first tried this code: {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} class (Eq a, Show a) => Genome a where crossover :: (Fractional b) => b -> a -> a -> IO (a, a) mutate :: (Fractional b) => b -> a -> IO … Read more
It’s probably best to look at what SafeHaskell allows: Safe Language The Safe Language (enabled through -XSafe) restricts things in two different ways: Certain GHC LANGUAGE extensions are disallowed completely. Certain GHC LANGUAGE extensions are restricted in functionality. Below is precisely what flags and extensions fall into each category: Disallowed completely: GeneralizedNewtypeDeriving, TemplateHaskell Restricted functionality: … Read more
While I am not familiar with Haskell daemon itself, answering your question “how it’d be possible to more effectively pinpoint such a leak”, it might be possible to use valgrind –leak-check=yes haskelldaemon (better if you compile it with debug info), OR, if the leak happens in shared library, try LD_PRELOAD=”yourlibrary.so” valgrind your-executable.
Liquid Haskell has totality checking: https://github.com/ucsd-progsys/liquidhaskell#termination-check By default a termination check is performed on all recursive functions. Use the no-termination option to disable the check liquid –no-termination test.hs In recursive functions the first algebraic or integer argument should be decreasing. The default decreasing measure for lists is length and Integers its value. (I included screenshot … Read more