HsExpr.hs-boot 1.93 KB
Newer Older
1
{-# LANGUAGE CPP, KindSignatures #-}
2 3 4 5 6 7 8 9
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-} -- Note [Pass sensitive types]
                                      -- in module PlaceHolder
{-# LANGUAGE ConstraintKinds #-}
#if __GLASGOW_HASKELL__ > 706
{-# LANGUAGE RoleAnnotations #-}
#endif

10 11
module HsExpr where

Ian Lynagh's avatar
Ian Lynagh committed
12
import SrcLoc     ( Located )
13
import Outputable ( SDoc, OutputableBndr, Outputable )
14
import {-# SOURCE #-} HsPat  ( LPat )
15 16
import PlaceHolder ( DataId )
import Data.Data hiding ( Fixity )
17

18 19 20 21 22 23 24
#if __GLASGOW_HASKELL__ > 706
type role HsExpr nominal
type role HsCmd nominal
type role MatchGroup nominal representational
type role GRHSs nominal representational
type role HsSplice nominal
#endif
dreixel's avatar
dreixel committed
25
data HsExpr (i :: *)
26
data HsCmd  (i :: *)
dreixel's avatar
dreixel committed
27
data HsSplice (i :: *)
28 29
data MatchGroup (a :: *) (body :: *)
data GRHSs (a :: *) (body :: *)
30

31 32 33 34 35 36
#if __GLASGOW_HASKELL__ > 706
instance Typeable HsSplice
instance Typeable HsExpr
instance Typeable MatchGroup
instance Typeable GRHSs
#else
37 38
instance Typeable1 HsSplice
instance Typeable1 HsExpr
39 40 41
instance Typeable1 HsCmd
instance Typeable2 MatchGroup
instance Typeable2 GRHSs
42 43
#endif

44 45 46 47 48
instance (DataId id) => Data (HsSplice id)
instance (DataId id) => Data (HsExpr id)
instance (DataId id) => Data (HsCmd id)
instance (Data body,DataId id) => Data (MatchGroup id body)
instance (Data body,DataId id) => Data (GRHSs id body)
49 50 51

instance OutputableBndr id => Outputable (HsExpr id)
instance OutputableBndr id => Outputable (HsCmd id)
52

53
type LHsExpr a = Located (HsExpr a)
54
type SyntaxExpr a = HsExpr a
55

Austin Seipp's avatar
Austin Seipp committed
56
pprLExpr :: (OutputableBndr i) =>
Ian Lynagh's avatar
Ian Lynagh committed
57
        LHsExpr i -> SDoc
58

Austin Seipp's avatar
Austin Seipp committed
59
pprExpr :: (OutputableBndr i) =>
Ian Lynagh's avatar
Ian Lynagh committed
60
        HsExpr i -> SDoc
61

62
pprSplice :: (OutputableBndr i) => HsSplice i -> SDoc
63

64 65
pprPatBind :: (OutputableBndr bndr, OutputableBndr id, Outputable body)
           => LPat bndr -> GRHSs id body -> SDoc
66

Austin Seipp's avatar
Austin Seipp committed
67
pprFunBind :: (OutputableBndr idL, OutputableBndr idR, Outputable body)
68
           => idL -> Bool -> MatchGroup idR body -> SDoc