Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add record support #23

Merged
merged 1 commit into from
Jul 23, 2024
Merged

Add record support #23

merged 1 commit into from
Jul 23, 2024

Conversation

chrisdone
Copy link
Owner

This adds support for records, like this:

data Person = Person { age :: Int, name :: Text }
main = do
Text.putStrLn $ Record.get @"name" Main.person
Text.putStrLn $ Record.get @"name" $ Record.set @"name" "Mary" Main.person
Text.putStrLn $ Record.get @"name" $ Record.modify @"name" Text.reverse Main.person
person =
Main.Person { name = "Chris", age = 23 }

The accessors, setters and modifiers aren't exactly Haskell-98 (perhaps more GHC2024), but otherwise declaration and construction are the same.

@chrisdone chrisdone merged commit 6ae42a4 into main Jul 23, 2024
@chrisdone chrisdone deleted the cd/2024-06-26-records branch July 23, 2024 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant