Skip to content

Instantly share code, notes, and snippets.

@seanparsons
Created May 8, 2015 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanparsons/51bc16518d933337cf5d to your computer and use it in GitHub Desktop.
Save seanparsons/51bc16518d933337cf5d to your computer and use it in GitHub Desktop.
Baffling errors where GHC appears to be ignoring the types I've added to functions.
renderRoute :: HasRep as => S.Path as -> HVectElim as H.AttributeValue
renderRoute path =
let curryIt :: (HVect as -> H.AttributeValue) -> HVectElim as H.AttributeValue
curryIt = hVectCurry
uncurryIt :: HVectElim as Text -> HVect as -> Text
uncurryIt = hVectUncurry
renderIt :: S.Path as -> HVectElim as Text
renderIt = S.renderRoute
in curryIt $ fmap H.textValue $ uncurryIt $ renderIt path
{-
src/MyProject/WebSupport.hs:26:17:
Could not deduce (HasRep as1) arising from a use of `hVectCurry'
from the context (HasRep as)
bound by the type signature for
renderRoute :: HasRep as =>
S.Path as -> HVectElim as H.AttributeValue
at src/MyProject/WebSupport.hs:23:16-70
Possible fix:
add (HasRep as1) to the context of
the type signature for
curryIt :: (HVect as1 -> H.AttributeValue)
-> HVectElim as1 H.AttributeValue
or the type signature for
renderRoute :: HasRep as =>
S.Path as -> HVectElim as H.AttributeValue
In the expression: hVectCurry
In an equation for `curryIt': curryIt = hVectCurry
In the expression:
let
curryIt ::
(HVect as -> H.AttributeValue) -> HVectElim as H.AttributeValue
curryIt = hVectCurry
uncurryIt :: HVectElim as Text -> HVect as -> Text
....
in curryIt $ fmap H.textValue $ uncurryIt $ renderIt path
src/MyProject/WebSupport.hs:30:18:
Could not deduce (HasRep as1) arising from a use of `S.renderRoute'
from the context (HasRep as)
bound by the type signature for
renderRoute :: HasRep as =>
S.Path as -> HVectElim as H.AttributeValue
at src/MyProject/WebSupport.hs:23:16-70
Possible fix:
add (HasRep as1) to the context of
the type signature for renderIt :: S.Path as1 -> HVectElim as1 Text
or the type signature for
renderRoute :: HasRep as =>
S.Path as -> HVectElim as H.AttributeValue
In the expression: S.renderRoute
In an equation for `renderIt': renderIt = S.renderRoute
In the expression:
let
curryIt ::
(HVect as -> H.AttributeValue) -> HVectElim as H.AttributeValue
curryIt = hVectCurry
uncurryIt :: HVectElim as Text -> HVect as -> Text
....
in curryIt $ fmap H.textValue $ uncurryIt $ renderIt path
src/MyProject/WebSupport.hs:31:7:
Could not deduce (HVectElim as H.AttributeValue
~ HVectElim as0 H.AttributeValue)
from the context (HasRep as)
bound by the type signature for
renderRoute :: HasRep as =>
S.Path as -> HVectElim as H.AttributeValue
at src/MyProject/WebSupport.hs:23:16-70
NB: `HVectElim' is a type function, and may not be injective
The type variable `as0' is ambiguous
Possible fix: add a type signature that fixes these type variable(s)
In the expression:
curryIt $ fmap H.textValue $ uncurryIt $ renderIt path
In the expression:
let
curryIt ::
(HVect as -> H.AttributeValue) -> HVectElim as H.AttributeValue
curryIt = hVectCurry
uncurryIt :: HVectElim as Text -> HVect as -> Text
....
in curryIt $ fmap H.textValue $ uncurryIt $ renderIt path
In an equation for `renderRoute':
renderRoute path
= let
curryIt ::
(HVect as -> H.AttributeValue) -> HVectElim as H.AttributeValue
curryIt = hVectCurry
....
in curryIt $ fmap H.textValue $ uncurryIt $ renderIt path
src/MyProject/WebSupport.hs:31:48:
Could not deduce (HVectElim as0 Text ~ HVectElim as Text)
from the context (HasRep as)
bound by the type signature for
renderRoute :: HasRep as =>
S.Path as -> HVectElim as H.AttributeValue
at src/MyProject/WebSupport.hs:23:16-70
NB: `HVectElim' is a type function, and may not be injective
The type variable `as0' is ambiguous
Possible fix: add a type signature that fixes these type variable(s)
In the return type of a call of `renderIt'
In the second argument of `($)', namely `renderIt path'
In the second argument of `($)', namely `uncurryIt $ renderIt path'
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment