This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sources | |
// https://stackoverflow.com/questions/58964775/pattern-matching-on-a-gadt-fails | |
// GADTs in rescript. | |
// GADTs are cool. Here's an example of a function with polymorphic return type. | |
// The thing is that the syntax is buried somewhere I don't remember, and the | |
// docs won't say anything because this is sort of black magic. Apply with care. | |
type rec prim<'t> = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extended from https://apoberejnyi.medium.com/do-notation-for-either-in-typescript-c207e5987b7a | |
// Library | |
type Option<T> = T | null | |
class OptionError extends Error { | |
constructor() { | |
super() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as D from 'io-ts/Decoder' | |
import * as fp from 'fp-ts/function' | |
// Nominal types without much ceremony: "class" types | |
// AKA I want to convert typescript types into fsharp types while using | |
// typescript | |
// Not much syntax needed, so they are easy to create. That's what Fable uses to | |
// construct their own records and DUs. | |
class UserId { |