Skip to content

Instantly share code, notes, and snippets.

@llelf
Last active March 14, 2020 18:30
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save llelf/6c01ded225877914f38a to your computer and use it in GitHub Desktop.
Save llelf/6c01ded225877914f38a to your computer and use it in GitHub Desktop.
{-# 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
@TheMatten
Copy link

Extended idea a little bit: https://gitlab.com/snippets/1874588

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment