stgi-1.1: Educational implementation of the STG (Spineless Tagless G-machine)

Safe HaskellNone
LanguageHaskell2010

Stg.Prelude

Description

Common Haskell functions, translated to STG. Use the Monoid instance for Program to mix them.

This module should be imported qualified to avoid clashes with standard Haskell definitions.

Synopsis

Documentation

force :: Program Source #

Force a value to normal form and return it.

This function makes heavy use of the fact that the STG is untyped. It currently supports the following types:

  • Unit (Unit)
  • Maybe (Just, Nothing)
  • Bool (True, False)
  • Int (Int#)
  • Either (Left, Right)
  • Tuples (Pair, Triple)
  • List (Nil, Cons)

Everything else will run into an error.