diff options
author | simonpj <unknown> | 2005-10-27 14:35:21 +0000 |
---|---|---|
committer | simonpj <unknown> | 2005-10-27 14:35:21 +0000 |
commit | 958924a2b338aebbcc8a88ba2cab511517762a19 (patch) | |
tree | 56935b38670abcc220f419e72900e1aed9040057 /ghc/compiler/hsSyn/HsDecls.lhs | |
parent | 47d253ba58b8b7bbbdd2ad21b6aa7ab78f7aef53 (diff) | |
download | haskell-958924a2b338aebbcc8a88ba2cab511517762a19.tar.gz |
[project @ 2005-10-27 14:35:20 by simonpj]
Add a new pragma: SPECIALISE INLINE
This amounts to adding an INLINE pragma to the specialised version
of the function. You can add phase stuff too (SPECIALISE INLINE [2]),
and NOINLINE instead of INLINE.
The reason for doing this is to support inlining of type-directed
recursive functions. The main example is this:
-- non-uniform array type
data Arr e where
ArrInt :: !Int -> ByteArray# -> Arr Int
ArrPair :: !Int -> Arr e1 -> Arr e2 -> Arr (e1, e2)
(!:) :: Arr e -> Int -> e
{-# SPECIALISE INLINE (!:) :: Arr Int -> Int -> Int #-}
{-# SPECIALISE INLINE (!:) :: Arr (a, b) -> Int -> (a, b) #-}
ArrInt _ ba !: (I# i) = I# (indexIntArray# ba i)
ArrPair _ a1 a2 !: i = (a1 !: i, a2 !: i)
If we use (!:) at a particular array type, we want to inline (:!),
which is recursive, until all the type specialisation is done.
On the way I did a bit of renaming and tidying of the way that
pragmas are carried, so quite a lot of files are touched in a
fairly trivial way.
Diffstat (limited to 'ghc/compiler/hsSyn/HsDecls.lhs')
-rw-r--r-- | ghc/compiler/hsSyn/HsDecls.lhs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ghc/compiler/hsSyn/HsDecls.lhs b/ghc/compiler/hsSyn/HsDecls.lhs index ddd11a662d..1f67f6e8a8 100644 --- a/ghc/compiler/hsSyn/HsDecls.lhs +++ b/ghc/compiler/hsSyn/HsDecls.lhs @@ -405,7 +405,7 @@ tyClDeclNames (TySynonym {tcdLName = name}) = [name] tyClDeclNames (ForeignType {tcdLName = name}) = [name] tyClDeclNames (ClassDecl {tcdLName = cls_name, tcdSigs = sigs}) - = cls_name : [n | L _ (Sig n _) <- sigs] + = cls_name : [n | L _ (TypeSig n _) <- sigs] tyClDeclNames (TyData {tcdLName = tc_name, tcdCons = cons}) = tc_name : conDeclsNames (map unLoc cons) |