Commit 4a6c92b6 authored by simonmar's avatar simonmar
Browse files

[project @ 2005-10-06 10:40:10 by simonmar]

add dataConFieldType

From: Autrijus Tang <autrijus@autrijus.org>
parent 026ea0a9
...@@ -12,7 +12,8 @@ module DataCon ( ...@@ -12,7 +12,8 @@ module DataCon (
dataConTyVars, dataConStupidTheta, dataConTyVars, dataConStupidTheta,
dataConArgTys, dataConOrigArgTys, dataConResTy, dataConArgTys, dataConOrigArgTys, dataConResTy,
dataConInstOrigArgTys, dataConRepArgTys, dataConInstOrigArgTys, dataConRepArgTys,
dataConFieldLabels, dataConStrictMarks, dataConExStricts, dataConFieldLabels, dataConFieldType,
dataConStrictMarks, dataConExStricts,
dataConSourceArity, dataConRepArity, dataConSourceArity, dataConRepArity,
dataConIsInfix, dataConIsInfix,
dataConWorkId, dataConWrapId, dataConWrapId_maybe, dataConImplicitIds, dataConWorkId, dataConWrapId, dataConWrapId_maybe, dataConImplicitIds,
...@@ -40,6 +41,7 @@ import Outputable ...@@ -40,6 +41,7 @@ import Outputable
import Unique ( Unique, Uniquable(..) ) import Unique ( Unique, Uniquable(..) )
import ListSetOps ( assoc ) import ListSetOps ( assoc )
import Util ( zipEqual, zipWithEqual ) import Util ( zipEqual, zipWithEqual )
import Maybes ( expectJust )
\end{code} \end{code}
...@@ -454,6 +456,10 @@ dataConImplicitIds dc = case dcIds dc of ...@@ -454,6 +456,10 @@ dataConImplicitIds dc = case dcIds dc of
dataConFieldLabels :: DataCon -> [FieldLabel] dataConFieldLabels :: DataCon -> [FieldLabel]
dataConFieldLabels = dcFields dataConFieldLabels = dcFields
dataConFieldType :: DataCon -> FieldLabel -> Type
dataConFieldType con label = expectJust "unexpected label" $
lookup label (dcFields con `zip` dcOrigArgTys con)
dataConStrictMarks :: DataCon -> [StrictnessMark] dataConStrictMarks :: DataCon -> [StrictnessMark]
dataConStrictMarks = dcStrictMarks dataConStrictMarks = dcStrictMarks
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment