Last active
March 14, 2020 18:30
-
-
Save llelf/6c01ded225877914f38a to your computer and use it in GitHub Desktop.
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
{-# LANGUAGE GADTs, ConstraintKinds, Rank2Types, ImplicitParams #-} | |
data Rec fields where | |
Rec :: fields => Rec fields | |
infixr 1 ? | |
(?) :: Rec fields -> (fields => r) -> r | |
Rec ? e = e | |
record :: Rec (?a :: Int, ?b :: String) | |
record = Rec where ?a=42 | |
?b="hey" | |
access :: Int | |
access = record ? ?a | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Extended idea a little bit: https://gitlab.com/snippets/1874588