polyp [--version] [-v] {-p Preludefile.hs} {-r f[:D]} [polypcode.phs]
--version
-v
-p file
-r value[:type constructor|all]
-') to
the command line. (Or compile with polyp with make hbc "hbc=hbc
-noflags".)
chase {-i ImportDir} PolyPModule.phs > PolyPcode.Phs
polyp [-v] {-p ExplTypes.hs} {-r f[:D]}] PolyPcode.Phs > Haskellcode.Hs
[cat Prefix.hs Haskellcode.Hs > Haskellcode.hs]
The import chaser chase takes a polytypic program module
and inlines the text of all imported modules (recursively).
The output consists of one big module of the concatenated texts of the
involved modules and should normally be directed to a file (ending in
.Phs - a big 'P' to denote a big PolyP file).
If your input consists of just one file and does not need any others
the chase is unnecessary.
(But unless you paste the polytypic prelude into your file by hand,
you will virtually always need chase.)
The flag -i can be used (any number of times) to specify
directories that are to be searched for the imported modules.
For convenience the polytypic library directory
POLYPDIR/polylib is always implicitly included.
polyp
P.Phs.
It type checks the input file P.Phs and generates the
instances of all polytypic functions that are used in the code
reachable from the definitions of the start values.
By default there is one start value - main - but the flag
-r value[:D|all] can be used
(any number of times) to specify other start values.
If the start value is polytypic, it must be instatiated to a regular type
constructor (D) (or to all regular type constructors)
given after the colon.
The output is Haskell code and can be loaded in hugs or compiled with
a Haskell compiler.
Sometimes the generated code is rejected as a Haskell program due to
the lack of explicit type declarations of top level overloaded
function.
In this case these declarations have to be supplied by hand.
The simplest way to do this is to put them in a separate file and then
cat it together with the polyp output.
If the flag -v (verbose) is used, the different phases of
the PolyP compilation give progress reports in a Haskell comment in
the output file:
The flag -p is used when you want to use Haskell
functions that are not in the built in part of the Haskell prelude.
If you list the types of these functions in a file
ExplTypes.hs and call PolyP with polyp -p
ExplTypes.hs PolyPCode.Phs you can use the listed functions in
the definitions in PolyPCode.Phs.
Note that the file ExplTypes.hs must contain only
explicit type declarations, and that these are only read by PolyP, not
included in the output.
The definitions of these functions should be placed in a separate file
and prepended to the PolyP output or loaded in hugs in some other way.
Types.hs, invoke PolyP by polyp -p Types.hs
Code.Phs.
polytypic constructs as possible.
The polytypic construct is powerful, but difficult
to use.
Often one more general polytypic function can solve a number of
related polytypic problems given different parameters.
../test/polyp.mk.