Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 12 Exercise InsertRight #114

Open
jllang opened this issue Jul 19, 2021 · 4 comments
Open

Chapter 12 Exercise InsertRight #114

jllang opened this issue Jul 19, 2021 · 4 comments

Comments

@jllang
Copy link

jllang commented Jul 19, 2021

I get errors when I try to define insRsymmetrically to how insLhas been defined above. However, these errors are about insL rather than insR. How can it be? These are the errors I get:

~/liquidhaskell-tutorial/src/Tutorial_12_Case_Study_AVL.lhs:606:42: error:
    Liquid Type Mismatch
    .
    The inferred type
      VV : a
    .
    is not a subtype of the required type
      VV : {VV : a | VV < v}
    .
    in the context
      v : a
    |
606 |   | isLeftBig && leftHeavy l'  = balLL v l' r
    |                                          ^^

~/liquidhaskell-tutorial/src/Tutorial_12_Case_Study_AVL.lhs:607:42: error:
    Liquid Type Mismatch
    .
    The inferred type
      VV : a
    .
    is not a subtype of the required type
      VV : {VV : a | VV < v}
    .
    in the context
      v : a
    |
607 |   | isLeftBig && rightHeavy l' = balLR v l' r
    |                                          ^^

~/liquidhaskell-tutorial/src/Tutorial_12_Case_Study_AVL.lhs:608:42: error:
    Liquid Type Mismatch
    .
    The inferred type
      VV : a
    .
    is not a subtype of the required type
      VV : {VV : a | VV < v}
    .
    in the context
      v : a
    |
608 |   | isLeftBig                  = balL0 v l' r
    |                                          ^^

~/liquidhaskell-tutorial/src/Tutorial_12_Case_Study_AVL.lhs:609:42: error:
    Liquid Type Mismatch
    .
    The inferred type
      VV : a
    .
    is not a subtype of the required type
      VV : {VV : a | VV < v}
    .
    in the context
      v : a
    |
609 |   | otherwise                  = node  v l' r
    |                                          ^^

How can it be that modifying one function breaks another independent function?

@ranjitjhala
Copy link
Member

  1. Can you post a link to your code?
  2. Do you have a signature for insL and insR?

@jllang
Copy link
Author

jllang commented Jul 26, 2021

Here's the link: https://privatebin.net/?2b64c18c8da919bc#BPts1wpxjXVxaLyzqM9RdhP5Zwtp6E2AqhkxcainToFg

I haven't modified the signatures. My implementation for insR is pretty much the mirror image of insL. If I comment out everything about insR, then these errors go away.

@ranjitjhala
Copy link
Member

ranjitjhala commented Jul 26, 2021 via email

@ranjitjhala
Copy link
Member

ranjitjhala commented Jul 26, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants