{"id":17251146,"url":"https://github.com/fumieval/moldable","last_synced_at":"2025-03-26T06:43:53.626Z","repository":{"id":66326275,"uuid":"128853218","full_name":"fumieval/moldable","owner":"fumieval","description":"Poor man's extensible records","archived":false,"fork":false,"pushed_at":"2019-08-29T06:56:15.000Z","size":374,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-31T08:27:57.506Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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":null,"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":"2018-04-10T01:10:39.000Z","updated_at":"2019-12-05T10:42:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2ff7bec-25a9-4dc0-abd2-b9838e28cead","html_url":"https://github.com/fumieval/moldable","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fmoldable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fmoldable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fmoldable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fumieval%2Fmoldable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fumieval","download_url":"https://codeload.github.com/fumieval/moldable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245605708,"owners_count":20643030,"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-10-15T06:50:29.231Z","updated_at":"2025-03-26T06:43:53.605Z","avatar_url":"https://github.com/fumieval.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"![logo](https://github.com/fumieval/moldable/blob/master/artwork/logo-256px.png?raw=true)\n\n```haskell\ndeclareMold [d|\n  data Foo = Foo\n    { foo :: Int\n    , bar :: Bool\n    }|]\n```\n\nThe declaration above instead creates a following datatype:\n\n```haskell\ndata Foo s = Foo\n  { foo :: Shroud s \"foo\" Int\n  , bar :: Shroud s \"bar\" Bool\n  }\n```\n\n`Shroud` is a type family that wraps a type depending on the switch type.\n`Foo Raw` is equivalent to the original declaration and `Foo (Ann f)` wraps each\nfield by `f`.\n\n```haskell\ntype family Shroud switch name a where\n  Shroud Raw _ a = a\n  Shroud (Ann f) name a = f name a\n```\n\nThe datatype is an instance of the `Moldable` class:\n\n```haskell\nclass Moldable m where\n  annotateMold :: m Raw -\u003e m (Ann Tagged)\n  unannotateMold :: m (Ann Tagged) -\u003e m Raw\n  traverseMold :: Applicative f =\u003e (forall k x. KnownSymbol k =\u003e g k x -\u003e f (h k x)) -\u003e m (Ann g) -\u003e f (m (Ann h))\n  traverseMold_ :: Applicative f =\u003e (forall k x. KnownSymbol k =\u003e g k x -\u003e f r) -\u003e m (Ann g) -\u003e f ()\n  zipMold :: (forall k x. KnownSymbol k =\u003e f k x -\u003e g k x -\u003e h k x) -\u003e m (Ann f) -\u003e m (Ann g) -\u003e m (Ann h)\n  zipMoldA :: Applicative t =\u003e (forall k x. KnownSymbol k =\u003e f k x -\u003e g k x -\u003e t (h k x)) -\u003e m (Ann f) -\u003e m (Ann g) -\u003e t (m (Ann h))\n  zipMoldA_ :: Applicative t =\u003e (forall k x. KnownSymbol k =\u003e f k x -\u003e g k x -\u003e t r) -\u003e m (Ann f) -\u003e m (Ann g) -\u003e t ()\n```\n\n`Wrap` allows you to use `Type -\u003e Type` wrappers.\n\n```haskell\ndata Wrap h name a = Wrap { unWrap :: h a }\n\nrewrap :: (forall x. f x -\u003e g x) -\u003e Wrap f k a -\u003e Wrap g k a\nrewrapF :: Functor t =\u003e (forall x. f x -\u003e t (g x)) -\u003e Wrap f k a -\u003e t (Wrap g k a)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumieval%2Fmoldable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffumieval%2Fmoldable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffumieval%2Fmoldable/lists"}