Cupid

Reference

Differences from Hugs 98

What changed for someone who used Hugs, the September 2006 release that Cupid starts from. Each table gives the Hugs name on the left and what to use in Cupid on the right. The commands at the prompt are Hugs's, and so are most options.

Programs

HugsCupid
hugscupid shows the prompt
hugs File.hscupid -i File.hs. Without -i, cupid File.hs runs the program
runhugs File.hs argscupid File.hs args
ffihugs File.hs cc-argscupid --ffi File.hs cc-args
ffihugs '-i<math.h>' File.hsNo -i option: name the header in each import, foreign import ccall "math.h sin"
WinHugsNone. The Windows build is the same console program as on other systems

cupid decides what to do from its arguments; Running cupid has the details. A script for runhugs had to be a literate script so that its #! line was not read as Haskell. Cupid reads a #! first line as a blank line, so a script is an ordinary .hs file; see Write a script that runs with cupid.

Environment variables and files

HugsCupid
HUGSFLAGSCUPIDFLAGS
HUGSDIRCUPIDDIR
{Hugs} in the search path{Cupid}
lib/hugs/packageslib/cupid/packages
LC_CTYPE chooses the encoding of CharUTF-8 everywhere, unless Cupid was built with -Dchar-encoding=locale; see Character encoding
Options in the Windows registry, the WinHugs settings or the Mac "Hugs Preferences" fileRead only from CUPIDFLAGS and the command line
EMACS, IGNORE_USER_REGISTRYNot read

Environment variables lists what Cupid reads.

At the prompt

HugsCupid
The empty module Hugs and the prompt Hugs>The empty module Cupid and the prompt Cupid>

Every command is one that Hugs had; Interpreter commands lists them.

Options

HugsCupid
+98 and -98 switch the extensions off and onThe extensions are always on. Both options are ignored with a message
+l, and literate \begin{code} blocksOnly a .lhs file is literate, and only > lines are its program: \begin{code} blocks are not read. +l is an unknown toggle
+H (here documents)Here documents are gone; +H is an unknown toggle
+R (root optimisation)Always on; +R is an unknown toggle
-E and -F commands run through a shellRun directly and split on whitespace: shell syntax is not interpreted

Options describes every option Cupid has.

Language

Cupid accepts Haskell 2010 rather than Haskell 98. For a Hugs program the changes that matter are these:

  • n+k patterns are not accepted, as in Haskell 2010.
  • Pattern guards are accepted.
  • The extensions are always on, except overlapping instances, which still need +o or +O. So forall is always a keyword.
  • These extensions are gone: TREX extensible records, implicit parameters, the observe debugger (HugsHood), recursive mdo, parallel list comprehensions, here documents and multi-instance resolution. The design says why.
  • Others are new. Language extensions has them all.
  • Restricted type synonyms are kept, the only Hugs-only extension to survive.

The language Cupid accepts lists the deviations from the Report; most of those in Hugs's list are still there.

Libraries

The libraries follow GHC's base, roughly version 4.18, rather than the Haskell 98 libraries.

The monad classes are those of base. Applicative is a superclass of Monad and fail belongs to MonadFail, so a Hugs program that defines a Monad instance on its own needs Functor and Applicative instances as well. Semigroup is a superclass of Monoid, and the Prelude exports Foldable and Traversable. Haskell 2010 conformance has the full list.

The Haskell 98 module names are gone. Hugs shipped the flat names of the Haskell 98 Report in its haskell98 package; in Cupid, import Char fails with Can't find imported module "Char". Use the hierarchical names:

Haskell 98Cupid
ArrayData.Array
CharData.Char
ComplexData.Complex
CPUTimeSystem.CPUTime
DirectorySystem.Directory
IOSystem.IO
IxData.Ix
ListData.List
LocaleSystem.Locale
MaybeData.Maybe
MonadControl.Monad
RandomSystem.Random
RatioData.Ratio
SystemSystem.Exit, System.Environment and System.Cmd
TimeSystem.Time

Numeric keeps its name.

The interpreter's own modules are Cupid.*. What was Hugs.Prelude, Hugs.IOExts and so on is Cupid.Prelude, Cupid.IOExts and so on. Hugs.Trex and Hugs.Observe have no counterpart, since their extensions are gone. The libraries lists the modules that ship.

The deprecated pointer types are gone. Use Ptr for Addr and ForeignPtr for ForeignObj.

See also

Edit this page on GitHub