[Haskell-beginners] using Shake to compile c++
Roger Mason
rmason at mun.ca
Sat Jul 8 11:57:01 UTC 2017
David McBride <toad3k at gmail.com> writes:
> Sorry that should have been command, not command_ which is very different.
>
> On Sat, Jul 8, 2017 at 7:37 AM, David McBride <toad3k at gmail.com> wrote:
>> The easy option is to just use command instead of cmd. Variadic
>> functions are always a little weird to type check.
>>
>> command_ [] "pkg-config" ["glib-2.0","--cflags"]
>>
>> That will *probably* solve the ambiguity in both lines, but I haven't tested.
Thank you for your replies.
This is what I have now:
"objects//*.o" %> \out -> do
let c = dropDirectory1 $ out -<.> "cxx"
let m = out -<.> "m"
let i = command [] "pkg-config" ["glib-2.0","--cflags"]
() <- cmd "c++ -c" [c] "-o" [out] "-MMD -MF" [m] [i]
needMakefileDependencies m
That produces:
Build.hs:29:17: error:
* Ambiguous type variable `r0' arising from a use of `command'
prevents the constraint `(CmdResult r0)' from being solved.
Relevant bindings include i :: Action r0 (bound at Build.hs:29:13)
Probable fix: use a type annotation to specify what `r0' should be.
These potential instances exist:
instance CmdResult CmdLine
-- Defined in `Development.Shake.Command'
instance CmdResult CmdTime
-- Defined in `Development.Shake.Command'
instance CmdResult Exit -- Defined in `Development.Shake.Command'
...plus 9 others
...plus two instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
* In the expression:
command [] "pkg-config" ["glib-2.0", "--cflags"]
In an equation for `i':
i = command [] "pkg-config" ["glib-2.0", "--cflags"]
In the expression:
do { let c = dropDirectory1 $ out -<.> "cxx";
let m = out -<.> "m";
let i = command ... "pkg-config" ...;
() <- cmd "c++ -c" [c] "-o" [out] "-MMD -MF" [m] [i];
.... }
Build.hs:30:15: error:
* No instance for (Development.Shake.Command.Arg [Action r0])
arising from a use of `cmd'
* In a stmt of a 'do' block:
() <- cmd "c++ -c" [c] "-o" [out] "-MMD -MF" [m] [i]
In the expression:
do { let c = dropDirectory1 $ out -<.> "cxx";
let m = out -<.> "m";
let i = command ... "pkg-config" ...;
() <- cmd "c++ -c" [c] "-o" [out] "-MMD -MF" [m] [i];
.... }
In the second argument of `(%>)', namely
`\ out
-> do { let ...;
let ...;
.... }'
Thanks again,
Roger
More information about the Beginners
mailing list