Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Module types for multi-argument functors

$
0
0

The module type for B will need an abstract type in order to have something to substitute, but the substitution can be destructive so that the module doesn’t have to define it:

module type B = {
  type t
  let value: t
}

module M: B with type t := int = {
  let value = 42
}

Note that := is used for the type substitution, instead of =, to specify that the substitution is destructive.


Viewing all articles
Browse latest Browse all 2592

Trending Articles