diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2019-01-24 17:58:50 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-02-19 06:14:04 -0500 |
commit | 7833cf407d1f608bebb1d38bb99d3035d8d735e6 (patch) | |
tree | 7ba7c4dee7bf439a38a6a10c836de4f0ccb73fc4 /compiler/basicTypes | |
parent | b78cc64e923716ac0512c299f42d4d0012306c05 (diff) | |
download | haskell-7833cf407d1f608bebb1d38bb99d3035d8d735e6.tar.gz |
Look through newtype wrappers (Trac #16254)
exprIsConApp_maybe could detect that I# 10 is a constructor application,
but not that Size (I# 10) is, because it was an application with a
nontrivial argument.
Diffstat (limited to 'compiler/basicTypes')
-rw-r--r-- | compiler/basicTypes/Id.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index 01b648ee89..199842ceb1 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -66,7 +66,9 @@ module Id ( isClassOpId_maybe, isDFunId, isPrimOpId, isPrimOpId_maybe, isFCallId, isFCallId_maybe, - isDataConWorkId, isDataConWorkId_maybe, isDataConWrapId, isDataConId_maybe, + isDataConWorkId, isDataConWorkId_maybe, + isDataConWrapId, isDataConWrapId_maybe, + isDataConId_maybe, idDataCon, isConLikeId, isBottomingId, idIsFrom, hasNoBinding, @@ -427,6 +429,7 @@ isClassOpId_maybe :: Id -> Maybe Class isPrimOpId_maybe :: Id -> Maybe PrimOp isFCallId_maybe :: Id -> Maybe ForeignCall isDataConWorkId_maybe :: Id -> Maybe DataCon +isDataConWrapId_maybe :: Id -> Maybe DataCon isRecordSelector id = case Var.idDetails id of RecSelId {} -> True @@ -480,6 +483,10 @@ isDataConWrapId id = case Var.idDetails id of DataConWrapId _ -> True _ -> False +isDataConWrapId_maybe id = case Var.idDetails id of + DataConWrapId con -> Just con + _ -> Nothing + isDataConId_maybe :: Id -> Maybe DataCon isDataConId_maybe id = case Var.idDetails id of DataConWorkId con -> Just con |