Slide 13
Slide 13 text
Option 1: Lots of type errors
• De
fi
ne functions to “push” a constructor through an expression
6
Data.Array.Accelerate: https://hackage.haskell.org/package/accelerate-1.3.0.0/docs/Data-Array-Accelerate.html#g:47
pair
: :
Exp a
- >
Exp b
- >
Exp (a, b)
pair x y = lift (x, y)
fst
: :
Exp (a, b)
- >
Exp a
fst p = let (a, _) = unlift p in a
Lift.hs:14
:
29
:
error:
• Couldn't match type ‘b’ with ‘Plain b0’
‘b’ is a rigid type variable bound by
the type signature for:
Lift.fst
: :
forall a b. (Elt a, Elt b)
= >
Exp (a, b)
- >
Exp a
at Lift.hs:13
:
1-44
Expected type: Exp (Plain (Exp a, b0))
Actual type: Exp (a, b)
• In the f
i
rst argument of ‘unlift’, namely ‘p’
In the expression: unlift p
In a pattern binding: (a, _) = unlift p
• Relevant bindings include
p
: :
Exp (a, b) (bound at Lift.hs:14
:
5)
fst
: :
Exp (a, b)
- >
Exp a (bound at Lift.hs:14
:
1)
|
14 | fst p = let (a, _) = unlift p in a
| ^