Skip to content

Implicits as constructor arguments #48

@yallop

Description

@yallop

It'd be convenient to have implicits as constructor arguments so that we could write

type showable = Show : {S: SHOW} * S.t -> showable;;
let f (Show ({M}, x)) = show x

It's currently possible to achieve something similar with first-class modules in a few cases:

type showable = Show : (module SHOW with type t = 'a) * 'a -> showable
let f (Show ((module M), x)) = let implicit module M = M in show x

but this technique doesn't work for higher-kinded examples, besides being rather cumbersome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions