Re:Sshole
by markasoftware on Friday November 06, 2026 @12:57AM
(#50388711)
Those are not types at all. Ok and Err are type constructors for the Result<A, B> type that take arguments of type A and B respectively.
> type constructors
Nit: the type constructor is `Result`: given two types `A` and `B` (not instances of those types, but actual types) it gives you a new type `Result<A, B>`.
`Ok` and `Err` are called "variants" and can be used to construct a new _instance_ of `Result<A, B>`.
Re:Sshole
by markasoftware on Friday November 06, 2026 @04:41PM
(#50398887)
Ah, thanks! I'd remembered the term "data constructor" from Haskell and called it a type constructor instead.
These types are not the same: