Skip to content

Addition of a Void module #31

@HarrisonGrodin

Description

@HarrisonGrodin

Unsure if this is the best format/place for a new proposal (or if I should, say, create a Wiki page). If there's something else I should do, please let me know!


Often, it is useful to have access to an empty "void" type. A simple proposal might look like this:

signature VOID =
  sig
    type void
    type t = void
    val absurd : t -> 'a
  end

structure Void :> VOID =
  struct
    datatype void = Void of void
    type t = void
    fun absurd (Void v) = absurd v
  end

Perhaps a few other auxiliary functions could be useful, as well. For example:

    val fail : string -> t  (* raises `Fail` *)
    val asLeft : ('a,t) either -> 'a
    val asRight : (t,'a) either -> 'a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions