- Getting pattern signatures out of bindings
-%* *
-%************************************************************************
-
-Get all the pattern type signatures out of a bunch of bindings
-
-\begin{code}
-collectSigTysFromHsBinds :: LHsBinds name -> [LHsType name]
-collectSigTysFromHsBinds binds = concatMap collectSigTysFromHsBind (bagToList binds)
-
-collectSigTysFromHsBind :: LHsBind name -> [LHsType name]
-collectSigTysFromHsBind bind
- = go (unLoc bind)
- where
- go (PatBind pat _ _ _)
- = collectSigTysFromPat pat
- go (FunBind f _ (MatchGroup ms _) _)
- = [sig | L _ (Match [] (Just sig) _) <- ms]
- -- A binding like x :: a = f y
- -- is parsed as FunMonoBind, but for this purpose we
- -- want to treat it as a pattern binding
- go out_bind = panic "collectSigTysFromHsBind"
-\end{code}
-
-%************************************************************************
-%* *