1 The file
Download the code: media:AlexWrapper-monadUser
Note this is only a minor change to the current monad wrapper.
2.1 In the Alex source file
In Alex, wrappers are chosen by the %wrapper directive. To use the monadUser wrapper, add the line
after the initial code block in your Alex source file.Additionally, two items must be defined in a code block (or imported), the Haskell type
2.2 Where to put the wrapper source file
Alex retrieves wrappers from its template directory, typically
/usr/lib/alex2.x.x. If you have access to that directory, simply place the file in there.
If not, create a directory named
alex in your home directory. Copy all of the files from
alex. Then place the downloaded file in that directory.
Then, when running Alex, use the command:
alex -t ~/alex input.x
which will tell alex to use the new directory for its templates.
3 Examples of use
To be done once the UofCalgary 411 class is done their first assignment :) BrettGiles