Reputation: 13
I am relatively new to Haskell and the compile/build process. I cloned a Haskell package from Github that builds using a cabal file. I can build the program no problem using stack build
, stack install
etc.
Currently I am interested in using the functions in only the Rewrite.hs file in the Haskell package, but I cannot successfully compile it by importing Rewrite to my own Main.hs and calling ghc Main.hs
. I get the following type errors:
Rewrite.hs:73:13: error:
• Expecting one more argument to ‘Module’
Expected a type, but ‘Module’ has kind ‘* -> *’
• In the type signature:
stripTop :: Module -> Module
Rewrite.hs:16:29: error:
• Expecting one more argument to ‘Pat’
Expected a type, but ‘Pat’ has kind ‘* -> *’
• In the type signature:
findPats :: Data a => a -> [Pat]
I thought that building a package basically compiles and links files together - Why is it possible to have compiler errors for parts of a program when compiling by hand? Alternatively, should I not be attempting to use a .hs file from a part of a program like this?
EDITED:
The package is https://github.com/Genetic-Strictness/Autobahn
An example of Main:
import Rewrite
import System.FilePath
import Language.Haskell.Exts
file ::FilePath
file = "test.hs"
main = placesToStrict file
where the function placesToStrict
is from Rewrite which calls on findPats
, which causes the compiler errors above.
Upvotes: 0
Views: 141
Reputation: 231
The .cabal file specifies several language extensions: other-extensions: BangPatterns, FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances
You can enabled these on a per file basis by putting: {-# LANGUAGE BangPatterns, FlexibleInstances, ... #-}
at the top of your source file. You can also pass -XBangPatterns -XFlexibleInstances ...
to ghc, although this is discouraged.
Upvotes: 1