Skip to content

Couldn't match type ‘r’ with ‘Extend "pitch" Pitch (r :- "pitch") #4

@meditans

Description

@meditans

Hi, the title is the error message I get when I try to write a function like:

c :: forall r. Forall (r :- "pitch") Default => Rec r
c = pitch := C .| (def :: Rec (r :- "pitch"))

The complete error message is:

src/LibCTRex.hs:54:5: Couldn't match type ‘r’ with ‘Extend "pitch" Pitch (r :- "pitch")’ …
      ‘r’ is a rigid type variable bound by
          the type signature for c :: Forall (r :- "pitch") Default => Rec r
          at /home/carlo/code/haskell/prova/musicRecord/src/LibCTRex.hs:53:13
    Expected _type:_ Rec r
      Actual type: Rec (("pitch" '::= Pitch) :| (r :- "pitch"))
    Relevant bindings include
      c :: Rec r
        (bound at /home/carlo/code/haskell/prova/musicRecord/src/LibCTRex.hs:54:1)
    In the expression: pitch := C .| (def :: Rec (r :- "pitch"))
    In an equation for ‘c’:
        c = pitch := C .| (def :: Rec (r :- "pitch"))
Compilation failed.

Now, shouldn't there be an isomorphism, in general, between those types? How
could I write one on my own?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions