Shake Actions: What is the easiest way to run? - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Joel McCracken

I am currently working on a project that features Shake for a lot of the infrastructure code. As far as I can tell, it looks like:

main = shake shakeOptions $ do
   action $ do
       b <- doesFileExist "file.src"
       when b $ need ["file.out"]

is the easiest way to run an action. Any advice? I want to run the action to inspect its side effects.

Sridhar Ratnakumar

Development.Shake.Forward (which rib-sample uses by default) is the easiest way.

Joel McCracken

cool, ty. And as you probably figuired, this is the context I am trying to use this in :P

Sridhar Ratnakumar

In fact, rib actually uses the Forward mechanism by default. It calls shakeForward opts ... (not shake opts ...). https://github.com/srid/rib/blob/0c748f4/src/Rib/App.hs#L123

Haskell static site generator based on Shake. Contribute to srid/rib development by creating an account on GitHub.
Sridhar Ratnakumar

I find it a nicer way to write build actions. You can forget about Makefile-sque structure, and focus on what needs to be done, by writing it like regular shell script.

Sridhar Ratnakumar

Eg.: https://github.com/srid/website/blob/ca765de/src/Main.hs#L26-L48 (uses older Rib api, but principles stand)

Source for my old website. Contribute to srid/website development by creating an account on GitHub.