Let’s say I have the following type: import Test.QuickCheck import GHC.TypeLits import Data.Kind data Vect :: Nat -> Type -> Type where VNil :: Vect 0 a VCons :: a -> Vect n a -> Vect (n + 1) a I want to be able to write some QuickChecks about my values, so I want to write an Arbitrary instance. sizedVect :: Int -> Gen a -> Gen (Vect n a) sizedVect 0 _ = pure VNil sizedVect n g = VCons <$> g <*> sizedVect (n - 1) g instance Arbitrary (Vect n a) where arbitrary :: Gen (Vect n a) arbi...| Haskell Community
I’m writing an application in Haskell that compiles both to native and to WASM, using the GHC backend. I would like to be able to embed a directory of text files in the binary; is there a way to do that? I thought of using Template Haskell + something like file-embed but as far as I can tell TH doesn’t work on WASM. Is there any other way I can do that, or can I get TH to work? (using TH would actually solve some other issues too, but i’ve worked around the ones i’ve encountered so fa...| Haskell Community
To explain these concepts in more detail, you want a Sigma type (n :: Nat, Vect (n :: Nat) a) But we don’t have those in Haskell. Instead you can have a second class existential type by writing it as a GADT: data SomeVect a where SomeVect :: (n :: Nat) -> Vect (n :: Nat) a -> SomeNat a -- ^ This is not yet valid Haskell! But we don’t have dependent types either! Instead there is a singleton type SNat :: Nat -> Type that does a similar job. It’s called a “singleton” because there is ...| Haskell Community
Following up from GHC and Cabal: the big picture, I hypothesise that part of the problem described is due to poorly-specified APIs[1], particularly the command line API to GHC that enables “packages” (perhaps more precisely, “units” – the ambiguity is symptomatic of the poorly-specified API). This got me thinking further. Here’s an idea: A nice way of specifying command line APIs would be to take a subset of all possible command lines for a program, and call it the “core” comm...| Haskell Community
Broadly speaking, we can say cabal-install and stack are frontends to Cabal . Both tools make it possible to build Haskell projects whose sets of dependencies might conflict with each other within the confines of a single system. I appreciate that answer is 2017, and things might have changed since. But there’s plenty of confusing-them q’s on SO and reddit; preferences seem to have changed over the years; one tool has caught up/got ahead of another; then the position reversed. (Or perhaps...| Haskell Community