Skip to content

Chapter 12 Exercise InsertRight #114

@jllang

Description

@jllang

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?

Metadata

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