Skip to content

support for constraints #18

Open
Open
@paolino

Description

I've added support for constraint in DSum and DMap.

type family DSumC a :: Constraint
data DSum (tag :: * -> *) (f :: * -> *) where
  (:=>) :: DSumC a => !(tag a) -> (f a) -> DSum tag f

data DMap (k :: * -> *) (f :: * -> *) where
  Data.Dependent.Map.Internal.Tip :: DMap k f
  Data.Dependent.Map.Internal.Bin :: DSumC v =>
                                     !Int -> !(k v) -> (f v) -> !(DMap k f) -> !(DMap k f)
                                     -> DMap k f

I'm needing this at my work to make a more useful map operation

Data.Dependent.Map.map ::
  (forall v. DSumC v => f v -> g v) -> DMap k f -> DMap k g

where I can do something on the v while changing the containing type

I'm not sure it is worth the bump (useful for anyone else) as I guess it will break all code around . But I'd like to know opinions before not submitting the pull request.
My stab has just deleted the Read instances, I couldn't solve the issues for that.
Hope it is interesting for someone else, because if it's not I will just use a list of modified definition of DSum with a lookup based on GOrdering which suffices for my needs (read-only , small set)

Btw, thanks a lot for this code, which I find a great approach to tackle modular software aspects

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions