{"id":13687439,"url":"https://github.com/fumieval/barbies-th","last_synced_at":"2025-04-14T05:32:00.229Z","repository":{"id":48864718,"uuid":"226247965","full_name":"fumieval/barbies-th","owner":"fumieval","description":"Easy declaration of strippable HKD","archived":false,"fork":false,"pushed_at":"2024-04-28T21:50:45.000Z","size":46,"stargazers_count":11,"open_issues_count":2,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-28T22:41:31.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://hackage.haskell.org/package/barbies-th","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fumieval.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-06T04:49:20.000Z","updated_at":"2024-06-19T05:04:45.438Z","dependencies_parsed_at":"2024-01-14T16:11:43.293Z","dependency_job_id":"d29ada2c-1eb1-4c73-a585-9cbadaf17442","html_url":"https://github.com/fumieval/barbies-th","commit_stats":{"total_commits":52,"total_committers":6,"mean_commits":8.666666666666666,"dds":"0.28846153846153844","last_synced_commit":"ac953769dc9f7b3ab3b128ab74da70c786d7c1d3"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fbarbies-th","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fbarbies-th/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fbarbies-th/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fbarbies-th/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fumieval","download_url":"https://codeload.github.com/fumieval/barbies-th/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248826718,"owners_count":21167732,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T15:00:54.674Z","updated_at":"2025-04-14T05:31:59.994Z","avatar_url":"https://github.com/fumieval.png","language":"Haskell","funding_links":[],"categories":["Haskell"],"sub_categories":[],"readme":"barbies-th\n====\n\n[![Hackage](https://img.shields.io/hackage/v/barbies-th.svg)](https://hackage.haskell.org/package/barbies-th)\n![Haskell CI](https://github.com/fumieval/barbies-th/workflows/Haskell%20CI/badge.svg)\n\nA wrapper library for [barbies](http://hackage.haskell.org/package/barbies) to generate [strippable HKD](http://hackage.haskell.org/package/barbies-1.1.3.0/docs/Data-Barbie-Bare.html)s. It transforms the following declaration\n\n```haskell\ndeclareBareB [d|\n  data Foo = Foo\n    { foo :: Int\n    , bar :: String\n    }  |]\n```\n\ninto:\n\n```haskell\ndata Foo sw h = Foo\n    { foo :: Wear sw h Int,\n    , bar :: Wear sw h String\n    }\ninstance BareB Foo\ninstance FieldNamesB (Foo Covered) where\n  bfieldNames = Foo (Const \"foo\") (Const \"bar\")\ninstance ProductB (Foo Covered) where\n  bprod (Foo xfoo xbar) (Foo yfoo ybar)\n    = Foo (Pair xfoo yfoo) (Pair xbar ybar)\ninstance FunctorB (Foo Covered) where ...\ninstance TraversableB (Foo Covered) where ...\ninstance ConstraintsB (Foo Covered)\ninstance ProductBC (Foo Covered)\n```\n\n`passthroughBareB` generates a type synonym for the bare type,\npreserving the semantics of the original definition.\n\n```haskell\ndata FooB sw h = Foo\n    { foo :: Wear sw h Int,\n    , bar :: Wear sw h String\n    }\ntype Foo = Foo Bare Identity\ntype FooH = Foo Covered\n```\n\nTypically you need the following extensions to make `declareBareB` work:\n\n```haskell\n{-# LANGUAGE FlexibleInstances #-}\n{-# LANGUAGE TemplateHaskell #-}\n{-# LANGUAGE TypeFamilies #-}\n```\n\nGHC sometimes takes very long time to compile code with generically derived instances, and it often fails to inline functions properly too. This package generates most instance methods by TH, reducing large amount of compilation time\nof the declarations and use sites.\n\nUnlike [higgledy](https://hackage.haskell.org/package/higgledy) which relies on\nin-memory representation using `GHC.Generic`, you don't have to worry about the performance, and you can benefit from various language features\n(e.g. -Wmissing-fields, `RecordWildCards` etc) even in higher-kinded form.\n\nDeriving pass-through\n----\n\nstock deriving does not work on HKDs. Instead, it transforms deriving clauses into standalone ones via the `Barbie` wrapper,\nas well as ones for the `Bare` counterpart. For example,\n\n```haskell\ndata Foo = ... deriving (Show, Eq)\n```\n\ngenerates\n\n```haskell\nderiving instance Show (Foo Bare Identity)\nderiving instance Eq (Foo Bare Identity)\nderiving via Barbie (Foo Covered) h instance Show (Barbie (Foo Covered) h) =\u003e Show (Foo Covered h)\nderiving via Barbie (Foo Covered) h instance Eq (Barbie (Foo Covered) h) =\u003e Eq (Foo Covered h)\n```\n\nNote that `Barbies` module must be imported manually in order to make use of coercions.\n\nMatryoshka barbies\n----\n\nBarbies can contain other barbies if they're declared in the same splice, it\npretty much works as you'd expect.\n\n```hasklell\ndeclareBareB [d|\n  data Inner = Inner\n    { inner :: Int\n    }\n  data Outer = Outer\n    { outer :: Inner\n    , other :: Bool\n    }\n|]\n```\n\ninto:\n\n```haskell\ndata Inner sw h = Inner\n    { inner :: Wear sw h Int\n    }\ndata Outer sw h = Outer\n    { outer :: Inner sw h\n    , other :: Wear sw h Bool\n    }\n-- And all the instances as above\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumieval%2Fbarbies-th","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffumieval%2Fbarbies-th","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumieval%2Fbarbies-th/lists"}