fcf-composite: Type-level computation for composite using first-class-families.

[ composite, library, mit, types ] [ Propose Tags ]

Type-level computation for composite using first-class-families.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), composite-base (>=0.7.0.0 && <0.8), fcf-containers (>=0.5.0 && <0.7), first-class-families (>=0.8.0.0 && <0.9) [details]
License MIT
Copyright Daniel Firth
Author Daniel Firth
Maintainer dan.firth@homtopic.tech
Category Composite, Types
Source repo head: git clone https://gitlab.homotopic.tech/haskell/fcf-composite
Uploaded by locallycompact at 2021-08-25T19:29:54Z
Distributions
Downloads 273 total (13 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-08-25 [all 1 reports]

Readme for fcf-composite-0.1.0.0

[back to package description]

fcf-composite

Fcf support for composite records. This gives bidirection between a composite style [s :-> a] and MapC s a from fcf-containers.

Using this we can compute record types via the Map operations in Fcf.

data Difference :: [Type] -> [Type] -> Exp [Type]

type instance Eval (Difference xs ys) = Eval (ToComposite =<< Fcf.Data.MapC.Difference (Eval (FromComposite xs)) (Eval (FromComposite ys)))

type A = ["a" :-> Int, "b" :-> String, "c" :-> ()]

type B = ["a" :-> Int, "c" :-> ()]

myRec :: Record (Eval (Difference A B))
myRec = "foo" :*: RNil -- checks!

Note: Since ToComposite and FromComposite use ToList and FromList from Fcf.Data.MapC, then the fields will always be returned in alphabetical order according to the symbol name, so you may need to use rcast.