\( \DeclareMathOperator{\tr}{tr} \newcommand\D{\mathrm{d}} \newcommand\E{\mathrm{e}} \newcommand\I{\mathrm{i}} \newcommand\bigOh{\mathcal{O}} \newcommand{\cat}[1]{\mathbf{#1}} \newcommand\curl{\vec{\nabla}\times} \newcommand{\CC}{\mathbb{C}} \newcommand{\NN}{\mathbb{N}} \newcommand{\QQ}{\mathbb{Q}} \newcommand{\RR}{\mathbb{R}} \newcommand{\ZZ}{\mathbb{Z}} % For +---- metric \newcommand{\BDpos}{} \newcommand{\BDneg}{-} \newcommand{\BDposs}{\phantom{-}} \newcommand{\BDnegg}{-} \newcommand{\BDplus}{+} \newcommand{\BDminus}{-} % For -+++ metric \newcommand{\BDpos}{-} \newcommand{\BDposs}{-} \newcommand{\BDneg}{} \newcommand{\BDnegg}{\phantom{-}} \newcommand{\BDplus}{-} \newcommand{\BDminus}{+} \)
UP | HOME

Haskell

Table of Contents

1. State# "Monad"

The IO Monad is ultimately State# RealWorld

  • Note in Prim.hs about the State# type constructor
  • Apparently it lives in the GHC.Prim module.
  • primops notes that State# is represented by nothing at all, so State# a is an empty type.
  • IO a is/was defined in GHC.Prim.Types as newtype IO a = IO (State# RealWorld -> (# State# RealWorld, a #)).

2. References

2.1. Type Checking

  • Dimitrios Vytiniotis, Simon Peyton Jones, Tom Schrijvers, Martin Sulzmann,
    "OutsideIn(X): Modular type inference with local assumptions".
    Journal of Functional Programming 21 (2011) pp. 333–412 Eprint

Last Updated: Sun, 19 Nov 2023 06:40:22 -0800