I have a function with a following type signature
{-# LANGUAGE FlexibleContexts #-}
dataLat :: Load r DIM1 Double
=> (Array r DIM1 Double -> Array U DIM1 Double, Array U DIM1 Double)
Array
, U
and DIM1
come from Repa library. dataLat
creates data that is later passed to other functions as a tuple. At one point r
type variable gets unified with type D
(this is again from Repa), but at later point r
should also unify with type L
(this is my type). The problem is that it has already been unified with D
and cannot be therefore unified with L
. I end up with Couldn't match expected type
error. I think this should be solved by some form of higher rank types, but I am unable to figure out how this should be written. Can anyone give me a hand?
Try {-# LANGUAGE NoMonomorphismRestriction #-}
http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/monomorphism.html