hazel icon indicating copy to clipboard operation
hazel copied to clipboard

CastBVHoleGround exception raised during evaluation of Examples.map_example

Open dedbox opened this issue 2 years ago • 0 comments

Given the following edit state:

image

Expected behavior:

Pressing <Space> should promote the f to an application of f to a fresh expression hole.

Actual behavior:

The following exception is caught and reported in the console log:

[EvaluatorError.Exception((CastBVHoleGround
 (Cast
  (Fun (Var x)
   (((VarBinding x Hole)
     (VarBinding map (Arrow (Arrow Int Int) (Arrow (List Int) (List Int))))
     (VarBinding PI Float) (VarBinding int_of_float (Arrow Float Int))
     (VarBinding float_of_int (Arrow Int Float))
     (VarBinding mod (Arrow Int (Arrow Int Int))))
    Hole)
   (BinIntOp Plus
    (Cast (BoundVar x)
     (((VarBinding x Hole)
       (VarBinding map (Arrow (Arrow Int Int) (Arrow (List Int) (List Int))))
       (VarBinding PI Float) (VarBinding int_of_float (Arrow Float Int))
       (VarBinding float_of_int (Arrow Int Float))
       (VarBinding mod (Arrow Int (Arrow Int Int))))
      Hole)
     (((VarBinding PI Float) (VarBinding int_of_float (Arrow Float Int))
       (VarBinding float_of_int (Arrow Int Float))
       (VarBinding mod (Arrow Int (Arrow Int Int))))
      Int))
    (IntLit 1)))
  (((VarBinding map (Arrow (Arrow Int Int) (Arrow (List Int) (List Int))))
    (VarBinding PI Float) (VarBinding int_of_float (Arrow Float Int))
    (VarBinding float_of_int (Arrow Int Float))
    (VarBinding mod (Arrow Int (Arrow Int Int))))
   (Arrow Hole Int))
  (((VarBinding map (Arrow (Arrow Int Int) (Arrow (List Int) (List Int))))
    (VarBinding PI Float) (VarBinding int_of_float (Arrow Float Int))
    (VarBinding float_of_int (Arrow Int Float))
    (VarBinding mod (Arrow Int (Arrow Int Int))))
   (Arrow Int Int)))))]

This term can be written more concisely as (fun x { x + 1 })<? => Int -> Int => Int>.

We get the same error if we begin with the cursor in the adjacent hole (143) instead.

Constructing and manipulating other operators (e.g., + or '::') does not raise the error.

dedbox avatar Aug 03 '22 15:08 dedbox