Fix compiling with HSE >= 1.16.0
This commit is contained in:
parent
b96ef00248
commit
8f123dc7de
@ -151,16 +151,32 @@ getSignatureFromHE file lineNo colNo = do
|
|||||||
HE.ParseOk (HE.Module _ _ _ _ mdecls) -> do
|
HE.ParseOk (HE.Module _ _ _ _ mdecls) -> do
|
||||||
decl <- find (typeSigInRangeHE lineNo colNo) mdecls
|
decl <- find (typeSigInRangeHE lineNo colNo) mdecls
|
||||||
case decl of
|
case decl of
|
||||||
HE.TypeSig (HE.SrcSpanInfo s _) names ty -> return $ HESignature s names ty
|
HE.TypeSig (HE.SrcSpanInfo s _) names ty ->
|
||||||
HE.TypeFamDecl (HE.SrcSpanInfo s _) (HE.DHead _ name tys) _ ->
|
return $ HESignature s names ty
|
||||||
|
|
||||||
|
HE.TypeFamDecl (HE.SrcSpanInfo s _) declHead _ ->
|
||||||
|
let (name, tys) = dHeadTyVars declHead in
|
||||||
return $ HEFamSignature s Open name (map cleanTyVarBind tys)
|
return $ HEFamSignature s Open name (map cleanTyVarBind tys)
|
||||||
HE.DataFamDecl (HE.SrcSpanInfo s _) _ (HE.DHead _ name tys) _ ->
|
|
||||||
|
HE.DataFamDecl (HE.SrcSpanInfo s _) _ declHead _ ->
|
||||||
|
let (name, tys) = dHeadTyVars declHead in
|
||||||
return $ HEFamSignature s Open name (map cleanTyVarBind tys)
|
return $ HEFamSignature s Open name (map cleanTyVarBind tys)
|
||||||
_ -> fail ""
|
_ -> fail ""
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
where cleanTyVarBind (HE.KindedVar _ n _) = n
|
where cleanTyVarBind (HE.KindedVar _ n _) = n
|
||||||
cleanTyVarBind (HE.UnkindedVar _ n) = n
|
cleanTyVarBind (HE.UnkindedVar _ n) = n
|
||||||
|
|
||||||
|
#if MIN_VERSION_haskell_src_exts(1,16,0)
|
||||||
|
dHeadTyVars :: HE.DeclHead l -> (HE.Name l, [HE.TyVarBind l])
|
||||||
|
dHeadTyVars (HE.DHead _ name) = (name, [])
|
||||||
|
dHeadTyVars (HE.DHApp _ r ty) = (++[ty]) `fmap` (dHeadTyVars r)
|
||||||
|
dHeadTyVars (HE.DHInfix _ ty name) = (name, [ty])
|
||||||
|
dHeadTyVars (HE.DHParen _ r) = dHeadTyVars r
|
||||||
|
#else
|
||||||
|
dHeadTyVars :: HE.DeclHead l -> (HE.Name l, [HE.TyVarBind l])
|
||||||
|
dHeadTyVars (DHead _ n tys) = (n, tys)
|
||||||
|
#endif
|
||||||
|
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
-- b. Code for generating initial code
|
-- b. Code for generating initial code
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user