{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveGeneric #-}
module GhcDump.Ast where

import GHC.Generics

import Data.Monoid hiding ((<>))
import Data.Semigroup as Sem
import qualified Data.ByteString as BS
import Codec.Serialise
import qualified Data.Text as T

import Unique (mkUnique)
import Prelude

data Unique = Unique !Char !Int
            deriving (Unique -> Unique -> Bool
(Unique -> Unique -> Bool)
-> (Unique -> Unique -> Bool) -> Eq Unique
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Unique -> Unique -> Bool
$c/= :: Unique -> Unique -> Bool
== :: Unique -> Unique -> Bool
$c== :: Unique -> Unique -> Bool
Eq, Eq Unique
Eq Unique
-> (Unique -> Unique -> Ordering)
-> (Unique -> Unique -> Bool)
-> (Unique -> Unique -> Bool)
-> (Unique -> Unique -> Bool)
-> (Unique -> Unique -> Bool)
-> (Unique -> Unique -> Unique)
-> (Unique -> Unique -> Unique)
-> Ord Unique
Unique -> Unique -> Bool
Unique -> Unique -> Ordering
Unique -> Unique -> Unique
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Unique -> Unique -> Unique
$cmin :: Unique -> Unique -> Unique
max :: Unique -> Unique -> Unique
$cmax :: Unique -> Unique -> Unique
>= :: Unique -> Unique -> Bool
$c>= :: Unique -> Unique -> Bool
> :: Unique -> Unique -> Bool
$c> :: Unique -> Unique -> Bool
<= :: Unique -> Unique -> Bool
$c<= :: Unique -> Unique -> Bool
< :: Unique -> Unique -> Bool
$c< :: Unique -> Unique -> Bool
compare :: Unique -> Unique -> Ordering
$ccompare :: Unique -> Unique -> Ordering
$cp1Ord :: Eq Unique
Ord, (forall x. Unique -> Rep Unique x)
-> (forall x. Rep Unique x -> Unique) -> Generic Unique
forall x. Rep Unique x -> Unique
forall x. Unique -> Rep Unique x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Unique x -> Unique
$cfrom :: forall x. Unique -> Rep Unique x
Generic)
instance Serialise Unique

-- | This is dependent upon GHC
instance Show Unique where
    show :: Unique -> String
show (Unique Char
c Int
n) = Unique -> String
forall a. Show a => a -> String
show (Unique -> String) -> Unique -> String
forall a b. (a -> b) -> a -> b
$ Char -> Int -> Unique
mkUnique Char
c Int
n

data ExternalName = ExternalName { ExternalName -> ModuleName
externalModuleName :: !ModuleName
                                 , ExternalName -> Text
externalName :: !T.Text
                                 , ExternalName -> Unique
externalUnique :: !Unique
                                 }
                  | ForeignCall
                  deriving (ExternalName -> ExternalName -> Bool
(ExternalName -> ExternalName -> Bool)
-> (ExternalName -> ExternalName -> Bool) -> Eq ExternalName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExternalName -> ExternalName -> Bool
$c/= :: ExternalName -> ExternalName -> Bool
== :: ExternalName -> ExternalName -> Bool
$c== :: ExternalName -> ExternalName -> Bool
Eq, Eq ExternalName
Eq ExternalName
-> (ExternalName -> ExternalName -> Ordering)
-> (ExternalName -> ExternalName -> Bool)
-> (ExternalName -> ExternalName -> Bool)
-> (ExternalName -> ExternalName -> Bool)
-> (ExternalName -> ExternalName -> Bool)
-> (ExternalName -> ExternalName -> ExternalName)
-> (ExternalName -> ExternalName -> ExternalName)
-> Ord ExternalName
ExternalName -> ExternalName -> Bool
ExternalName -> ExternalName -> Ordering
ExternalName -> ExternalName -> ExternalName
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ExternalName -> ExternalName -> ExternalName
$cmin :: ExternalName -> ExternalName -> ExternalName
max :: ExternalName -> ExternalName -> ExternalName
$cmax :: ExternalName -> ExternalName -> ExternalName
>= :: ExternalName -> ExternalName -> Bool
$c>= :: ExternalName -> ExternalName -> Bool
> :: ExternalName -> ExternalName -> Bool
$c> :: ExternalName -> ExternalName -> Bool
<= :: ExternalName -> ExternalName -> Bool
$c<= :: ExternalName -> ExternalName -> Bool
< :: ExternalName -> ExternalName -> Bool
$c< :: ExternalName -> ExternalName -> Bool
compare :: ExternalName -> ExternalName -> Ordering
$ccompare :: ExternalName -> ExternalName -> Ordering
$cp1Ord :: Eq ExternalName
Ord, (forall x. ExternalName -> Rep ExternalName x)
-> (forall x. Rep ExternalName x -> ExternalName)
-> Generic ExternalName
forall x. Rep ExternalName x -> ExternalName
forall x. ExternalName -> Rep ExternalName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExternalName x -> ExternalName
$cfrom :: forall x. ExternalName -> Rep ExternalName x
Generic, Int -> ExternalName -> ShowS
[ExternalName] -> ShowS
ExternalName -> String
(Int -> ExternalName -> ShowS)
-> (ExternalName -> String)
-> ([ExternalName] -> ShowS)
-> Show ExternalName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExternalName] -> ShowS
$cshowList :: [ExternalName] -> ShowS
show :: ExternalName -> String
$cshow :: ExternalName -> String
showsPrec :: Int -> ExternalName -> ShowS
$cshowsPrec :: Int -> ExternalName -> ShowS
Show)
instance Serialise ExternalName

newtype BinderId = BinderId Unique
                 deriving (BinderId -> BinderId -> Bool
(BinderId -> BinderId -> Bool)
-> (BinderId -> BinderId -> Bool) -> Eq BinderId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BinderId -> BinderId -> Bool
$c/= :: BinderId -> BinderId -> Bool
== :: BinderId -> BinderId -> Bool
$c== :: BinderId -> BinderId -> Bool
Eq, Eq BinderId
Eq BinderId
-> (BinderId -> BinderId -> Ordering)
-> (BinderId -> BinderId -> Bool)
-> (BinderId -> BinderId -> Bool)
-> (BinderId -> BinderId -> Bool)
-> (BinderId -> BinderId -> Bool)
-> (BinderId -> BinderId -> BinderId)
-> (BinderId -> BinderId -> BinderId)
-> Ord BinderId
BinderId -> BinderId -> Bool
BinderId -> BinderId -> Ordering
BinderId -> BinderId -> BinderId
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: BinderId -> BinderId -> BinderId
$cmin :: BinderId -> BinderId -> BinderId
max :: BinderId -> BinderId -> BinderId
$cmax :: BinderId -> BinderId -> BinderId
>= :: BinderId -> BinderId -> Bool
$c>= :: BinderId -> BinderId -> Bool
> :: BinderId -> BinderId -> Bool
$c> :: BinderId -> BinderId -> Bool
<= :: BinderId -> BinderId -> Bool
$c<= :: BinderId -> BinderId -> Bool
< :: BinderId -> BinderId -> Bool
$c< :: BinderId -> BinderId -> Bool
compare :: BinderId -> BinderId -> Ordering
$ccompare :: BinderId -> BinderId -> Ordering
$cp1Ord :: Eq BinderId
Ord, Decoder s BinderId
Decoder s [BinderId]
[BinderId] -> Encoding
BinderId -> Encoding
(BinderId -> Encoding)
-> (forall s. Decoder s BinderId)
-> ([BinderId] -> Encoding)
-> (forall s. Decoder s [BinderId])
-> Serialise BinderId
forall s. Decoder s [BinderId]
forall s. Decoder s BinderId
forall a.
(a -> Encoding)
-> (forall s. Decoder s a)
-> ([a] -> Encoding)
-> (forall s. Decoder s [a])
-> Serialise a
decodeList :: Decoder s [BinderId]
$cdecodeList :: forall s. Decoder s [BinderId]
encodeList :: [BinderId] -> Encoding
$cencodeList :: [BinderId] -> Encoding
decode :: Decoder s BinderId
$cdecode :: forall s. Decoder s BinderId
encode :: BinderId -> Encoding
$cencode :: BinderId -> Encoding
Serialise, Int -> BinderId -> ShowS
[BinderId] -> ShowS
BinderId -> String
(Int -> BinderId -> ShowS)
-> (BinderId -> String) -> ([BinderId] -> ShowS) -> Show BinderId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BinderId] -> ShowS
$cshowList :: [BinderId] -> ShowS
show :: BinderId -> String
$cshow :: BinderId -> String
showsPrec :: Int -> BinderId -> ShowS
$cshowsPrec :: Int -> BinderId -> ShowS
Show)

newtype SBinder = SBndr { SBinder -> Binder' SBinder BinderId
unSBndr :: Binder' SBinder BinderId }
                deriving (SBinder -> SBinder -> Bool
(SBinder -> SBinder -> Bool)
-> (SBinder -> SBinder -> Bool) -> Eq SBinder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SBinder -> SBinder -> Bool
$c/= :: SBinder -> SBinder -> Bool
== :: SBinder -> SBinder -> Bool
$c== :: SBinder -> SBinder -> Bool
Eq, Eq SBinder
Eq SBinder
-> (SBinder -> SBinder -> Ordering)
-> (SBinder -> SBinder -> Bool)
-> (SBinder -> SBinder -> Bool)
-> (SBinder -> SBinder -> Bool)
-> (SBinder -> SBinder -> Bool)
-> (SBinder -> SBinder -> SBinder)
-> (SBinder -> SBinder -> SBinder)
-> Ord SBinder
SBinder -> SBinder -> Bool
SBinder -> SBinder -> Ordering
SBinder -> SBinder -> SBinder
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: SBinder -> SBinder -> SBinder
$cmin :: SBinder -> SBinder -> SBinder
max :: SBinder -> SBinder -> SBinder
$cmax :: SBinder -> SBinder -> SBinder
>= :: SBinder -> SBinder -> Bool
$c>= :: SBinder -> SBinder -> Bool
> :: SBinder -> SBinder -> Bool
$c> :: SBinder -> SBinder -> Bool
<= :: SBinder -> SBinder -> Bool
$c<= :: SBinder -> SBinder -> Bool
< :: SBinder -> SBinder -> Bool
$c< :: SBinder -> SBinder -> Bool
compare :: SBinder -> SBinder -> Ordering
$ccompare :: SBinder -> SBinder -> Ordering
$cp1Ord :: Eq SBinder
Ord, (forall x. SBinder -> Rep SBinder x)
-> (forall x. Rep SBinder x -> SBinder) -> Generic SBinder
forall x. Rep SBinder x -> SBinder
forall x. SBinder -> Rep SBinder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SBinder x -> SBinder
$cfrom :: forall x. SBinder -> Rep SBinder x
Generic, Int -> SBinder -> ShowS
[SBinder] -> ShowS
SBinder -> String
(Int -> SBinder -> ShowS)
-> (SBinder -> String) -> ([SBinder] -> ShowS) -> Show SBinder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SBinder] -> ShowS
$cshowList :: [SBinder] -> ShowS
show :: SBinder -> String
$cshow :: SBinder -> String
showsPrec :: Int -> SBinder -> ShowS
$cshowsPrec :: Int -> SBinder -> ShowS
Show)
instance Serialise SBinder

newtype Binder = Bndr { Binder -> Binder' Binder Binder
unBndr :: Binder' Binder Binder }
               deriving (Binder -> Binder -> Bool
(Binder -> Binder -> Bool)
-> (Binder -> Binder -> Bool) -> Eq Binder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Binder -> Binder -> Bool
$c/= :: Binder -> Binder -> Bool
== :: Binder -> Binder -> Bool
$c== :: Binder -> Binder -> Bool
Eq, Eq Binder
Eq Binder
-> (Binder -> Binder -> Ordering)
-> (Binder -> Binder -> Bool)
-> (Binder -> Binder -> Bool)
-> (Binder -> Binder -> Bool)
-> (Binder -> Binder -> Bool)
-> (Binder -> Binder -> Binder)
-> (Binder -> Binder -> Binder)
-> Ord Binder
Binder -> Binder -> Bool
Binder -> Binder -> Ordering
Binder -> Binder -> Binder
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Binder -> Binder -> Binder
$cmin :: Binder -> Binder -> Binder
max :: Binder -> Binder -> Binder
$cmax :: Binder -> Binder -> Binder
>= :: Binder -> Binder -> Bool
$c>= :: Binder -> Binder -> Bool
> :: Binder -> Binder -> Bool
$c> :: Binder -> Binder -> Bool
<= :: Binder -> Binder -> Bool
$c<= :: Binder -> Binder -> Bool
< :: Binder -> Binder -> Bool
$c< :: Binder -> Binder -> Bool
compare :: Binder -> Binder -> Ordering
$ccompare :: Binder -> Binder -> Ordering
$cp1Ord :: Eq Binder
Ord, (forall x. Binder -> Rep Binder x)
-> (forall x. Rep Binder x -> Binder) -> Generic Binder
forall x. Rep Binder x -> Binder
forall x. Binder -> Rep Binder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Binder x -> Binder
$cfrom :: forall x. Binder -> Rep Binder x
Generic, Int -> Binder -> ShowS
[Binder] -> ShowS
Binder -> String
(Int -> Binder -> ShowS)
-> (Binder -> String) -> ([Binder] -> ShowS) -> Show Binder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Binder] -> ShowS
$cshowList :: [Binder] -> ShowS
show :: Binder -> String
$cshow :: Binder -> String
showsPrec :: Int -> Binder -> ShowS
$cshowsPrec :: Int -> Binder -> ShowS
Show)
instance Serialise Binder

binderUniqueName :: Binder -> T.Text
binderUniqueName :: Binder -> Text
binderUniqueName (Bndr Binder' Binder Binder
b) =
    Binder' Binder Binder -> Text
forall bndr var. Binder' bndr var -> Text
binderName Binder' Binder Binder
b Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
T.pack String
"_" Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> String -> Text
T.pack (Unique -> String
forall a. Show a => a -> String
show Unique
u)
  where BinderId Unique
u = Binder' Binder Binder -> BinderId
forall bndr var. Binder' bndr var -> BinderId
binderId Binder' Binder Binder
b

data Binder' bndr var = Binder { Binder' bndr var -> Text
binderName   :: !T.Text
                               , Binder' bndr var -> BinderId
binderId     :: !BinderId
                               , Binder' bndr var -> IdInfo bndr var
binderIdInfo :: IdInfo bndr var
                               , Binder' bndr var -> IdDetails
binderIdDetails :: IdDetails
                               , Binder' bndr var -> Type' bndr var
binderType   :: Type' bndr var
                               }
                      | TyBinder { binderName :: !T.Text
                                 , binderId   :: !BinderId
                                 , Binder' bndr var -> Type' bndr var
binderKind :: Type' bndr var
                                 }
                      deriving (Binder' bndr var -> Binder' bndr var -> Bool
(Binder' bndr var -> Binder' bndr var -> Bool)
-> (Binder' bndr var -> Binder' bndr var -> Bool)
-> Eq (Binder' bndr var)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall bndr var.
(Eq var, Eq bndr) =>
Binder' bndr var -> Binder' bndr var -> Bool
/= :: Binder' bndr var -> Binder' bndr var -> Bool
$c/= :: forall bndr var.
(Eq var, Eq bndr) =>
Binder' bndr var -> Binder' bndr var -> Bool
== :: Binder' bndr var -> Binder' bndr var -> Bool
$c== :: forall bndr var.
(Eq var, Eq bndr) =>
Binder' bndr var -> Binder' bndr var -> Bool
Eq, Eq (Binder' bndr var)
Eq (Binder' bndr var)
-> (Binder' bndr var -> Binder' bndr var -> Ordering)
-> (Binder' bndr var -> Binder' bndr var -> Bool)
-> (Binder' bndr var -> Binder' bndr var -> Bool)
-> (Binder' bndr var -> Binder' bndr var -> Bool)
-> (Binder' bndr var -> Binder' bndr var -> Bool)
-> (Binder' bndr var -> Binder' bndr var -> Binder' bndr var)
-> (Binder' bndr var -> Binder' bndr var -> Binder' bndr var)
-> Ord (Binder' bndr var)
Binder' bndr var -> Binder' bndr var -> Bool
Binder' bndr var -> Binder' bndr var -> Ordering
Binder' bndr var -> Binder' bndr var -> Binder' bndr var
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall bndr var. (Ord var, Ord bndr) => Eq (Binder' bndr var)
forall bndr var.
(Ord var, Ord bndr) =>
Binder' bndr var -> Binder' bndr var -> Bool
forall bndr var.
(Ord var, Ord bndr) =>
Binder' bndr var -> Binder' bndr var -> Ordering
forall bndr var.
(Ord var, Ord bndr) =>
Binder' bndr var -> Binder' bndr var -> Binder' bndr var
min :: Binder' bndr var -> Binder' bndr var -> Binder' bndr var
$cmin :: forall bndr var.
(Ord var, Ord bndr) =>
Binder' bndr var -> Binder' bndr var -> Binder' bndr var
max :: Binder' bndr var -> Binder' bndr var -> Binder' bndr var
$cmax :: forall bndr var.
(Ord var, Ord bndr) =>
Binder' bndr var -> Binder' bndr var -> Binder' bndr var
>= :: Binder' bndr var -> Binder' bndr var -> Bool
$c>= :: forall bndr var.
(Ord var, Ord bndr) =>
Binder' bndr var -> Binder' bndr var -> Bool
> :: Binder' bndr var -> Binder' bndr var -> Bool
$c> :: forall bndr var.
(Ord var, Ord bndr) =>
Binder' bndr var -> Binder' bndr var -> Bool
<= :: Binder' bndr var -> Binder' bndr var -> Bool
$c<= :: forall bndr var.
(Ord var, Ord bndr) =>
Binder' bndr var -> Binder' bndr var -> Bool
< :: Binder' bndr var -> Binder' bndr var -> Bool
$c< :: forall bndr var.
(Ord var, Ord bndr) =>
Binder' bndr var -> Binder' bndr var -> Bool
compare :: Binder' bndr var -> Binder' bndr var -> Ordering
$ccompare :: forall bndr var.
(Ord var, Ord bndr) =>
Binder' bndr var -> Binder' bndr var -> Ordering
$cp1Ord :: forall bndr var. (Ord var, Ord bndr) => Eq (Binder' bndr var)
Ord, (forall x. Binder' bndr var -> Rep (Binder' bndr var) x)
-> (forall x. Rep (Binder' bndr var) x -> Binder' bndr var)
-> Generic (Binder' bndr var)
forall x. Rep (Binder' bndr var) x -> Binder' bndr var
forall x. Binder' bndr var -> Rep (Binder' bndr var) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall bndr var x. Rep (Binder' bndr var) x -> Binder' bndr var
forall bndr var x. Binder' bndr var -> Rep (Binder' bndr var) x
$cto :: forall bndr var x. Rep (Binder' bndr var) x -> Binder' bndr var
$cfrom :: forall bndr var x. Binder' bndr var -> Rep (Binder' bndr var) x
Generic, Int -> Binder' bndr var -> ShowS
[Binder' bndr var] -> ShowS
Binder' bndr var -> String
(Int -> Binder' bndr var -> ShowS)
-> (Binder' bndr var -> String)
-> ([Binder' bndr var] -> ShowS)
-> Show (Binder' bndr var)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall bndr var.
(Show var, Show bndr) =>
Int -> Binder' bndr var -> ShowS
forall bndr var.
(Show var, Show bndr) =>
[Binder' bndr var] -> ShowS
forall bndr var.
(Show var, Show bndr) =>
Binder' bndr var -> String
showList :: [Binder' bndr var] -> ShowS
$cshowList :: forall bndr var.
(Show var, Show bndr) =>
[Binder' bndr var] -> ShowS
show :: Binder' bndr var -> String
$cshow :: forall bndr var.
(Show var, Show bndr) =>
Binder' bndr var -> String
showsPrec :: Int -> Binder' bndr var -> ShowS
$cshowsPrec :: forall bndr var.
(Show var, Show bndr) =>
Int -> Binder' bndr var -> ShowS
Show)
instance (Serialise bndr, Serialise var) => Serialise (Binder' bndr var)

data IdInfo bndr var
    = IdInfo { IdInfo bndr var -> Int
idiArity         :: !Int
             , IdInfo bndr var -> Bool
idiIsOneShot     :: Bool
             , IdInfo bndr var -> Unfolding bndr var
idiUnfolding     :: Unfolding bndr var
             , IdInfo bndr var -> Text
idiInlinePragma  :: !T.Text
             , IdInfo bndr var -> OccInfo
idiOccInfo       :: OccInfo
             , IdInfo bndr var -> Text
idiStrictnessSig :: !T.Text
             , IdInfo bndr var -> Text
idiDemandSig     :: !T.Text
             , IdInfo bndr var -> Int
idiCallArity     :: !Int
             }
    deriving (IdInfo bndr var -> IdInfo bndr var -> Bool
(IdInfo bndr var -> IdInfo bndr var -> Bool)
-> (IdInfo bndr var -> IdInfo bndr var -> Bool)
-> Eq (IdInfo bndr var)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall bndr var.
(Eq var, Eq bndr) =>
IdInfo bndr var -> IdInfo bndr var -> Bool
/= :: IdInfo bndr var -> IdInfo bndr var -> Bool
$c/= :: forall bndr var.
(Eq var, Eq bndr) =>
IdInfo bndr var -> IdInfo bndr var -> Bool
== :: IdInfo bndr var -> IdInfo bndr var -> Bool
$c== :: forall bndr var.
(Eq var, Eq bndr) =>
IdInfo bndr var -> IdInfo bndr var -> Bool
Eq, Eq (IdInfo bndr var)
Eq (IdInfo bndr var)
-> (IdInfo bndr var -> IdInfo bndr var -> Ordering)
-> (IdInfo bndr var -> IdInfo bndr var -> Bool)
-> (IdInfo bndr var -> IdInfo bndr var -> Bool)
-> (IdInfo bndr var -> IdInfo bndr var -> Bool)
-> (IdInfo bndr var -> IdInfo bndr var -> Bool)
-> (IdInfo bndr var -> IdInfo bndr var -> IdInfo bndr var)
-> (IdInfo bndr var -> IdInfo bndr var -> IdInfo bndr var)
-> Ord (IdInfo bndr var)
IdInfo bndr var -> IdInfo bndr var -> Bool
IdInfo bndr var -> IdInfo bndr var -> Ordering
IdInfo bndr var -> IdInfo bndr var -> IdInfo bndr var
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall bndr var. (Ord var, Ord bndr) => Eq (IdInfo bndr var)
forall bndr var.
(Ord var, Ord bndr) =>
IdInfo bndr var -> IdInfo bndr var -> Bool
forall bndr var.
(Ord var, Ord bndr) =>
IdInfo bndr var -> IdInfo bndr var -> Ordering
forall bndr var.
(Ord var, Ord bndr) =>
IdInfo bndr var -> IdInfo bndr var -> IdInfo bndr var
min :: IdInfo bndr var -> IdInfo bndr var -> IdInfo bndr var
$cmin :: forall bndr var.
(Ord var, Ord bndr) =>
IdInfo bndr var -> IdInfo bndr var -> IdInfo bndr var
max :: IdInfo bndr var -> IdInfo bndr var -> IdInfo bndr var
$cmax :: forall bndr var.
(Ord var, Ord bndr) =>
IdInfo bndr var -> IdInfo bndr var -> IdInfo bndr var
>= :: IdInfo bndr var -> IdInfo bndr var -> Bool
$c>= :: forall bndr var.
(Ord var, Ord bndr) =>
IdInfo bndr var -> IdInfo bndr var -> Bool
> :: IdInfo bndr var -> IdInfo bndr var -> Bool
$c> :: forall bndr var.
(Ord var, Ord bndr) =>
IdInfo bndr var -> IdInfo bndr var -> Bool
<= :: IdInfo bndr var -> IdInfo bndr var -> Bool
$c<= :: forall bndr var.
(Ord var, Ord bndr) =>
IdInfo bndr var -> IdInfo bndr var -> Bool
< :: IdInfo bndr var -> IdInfo bndr var -> Bool
$c< :: forall bndr var.
(Ord var, Ord bndr) =>
IdInfo bndr var -> IdInfo bndr var -> Bool
compare :: IdInfo bndr var -> IdInfo bndr var -> Ordering
$ccompare :: forall bndr var.
(Ord var, Ord bndr) =>
IdInfo bndr var -> IdInfo bndr var -> Ordering
$cp1Ord :: forall bndr var. (Ord var, Ord bndr) => Eq (IdInfo bndr var)
Ord, (forall x. IdInfo bndr var -> Rep (IdInfo bndr var) x)
-> (forall x. Rep (IdInfo bndr var) x -> IdInfo bndr var)
-> Generic (IdInfo bndr var)
forall x. Rep (IdInfo bndr var) x -> IdInfo bndr var
forall x. IdInfo bndr var -> Rep (IdInfo bndr var) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall bndr var x. Rep (IdInfo bndr var) x -> IdInfo bndr var
forall bndr var x. IdInfo bndr var -> Rep (IdInfo bndr var) x
$cto :: forall bndr var x. Rep (IdInfo bndr var) x -> IdInfo bndr var
$cfrom :: forall bndr var x. IdInfo bndr var -> Rep (IdInfo bndr var) x
Generic, Int -> IdInfo bndr var -> ShowS
[IdInfo bndr var] -> ShowS
IdInfo bndr var -> String
(Int -> IdInfo bndr var -> ShowS)
-> (IdInfo bndr var -> String)
-> ([IdInfo bndr var] -> ShowS)
-> Show (IdInfo bndr var)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall bndr var.
(Show var, Show bndr) =>
Int -> IdInfo bndr var -> ShowS
forall bndr var.
(Show var, Show bndr) =>
[IdInfo bndr var] -> ShowS
forall bndr var. (Show var, Show bndr) => IdInfo bndr var -> String
showList :: [IdInfo bndr var] -> ShowS
$cshowList :: forall bndr var.
(Show var, Show bndr) =>
[IdInfo bndr var] -> ShowS
show :: IdInfo bndr var -> String
$cshow :: forall bndr var. (Show var, Show bndr) => IdInfo bndr var -> String
showsPrec :: Int -> IdInfo bndr var -> ShowS
$cshowsPrec :: forall bndr var.
(Show var, Show bndr) =>
Int -> IdInfo bndr var -> ShowS
Show)
instance (Serialise bndr, Serialise var) => Serialise (IdInfo bndr var)

data Unfolding bndr var
    = NoUnfolding
    | BootUnfolding
    | OtherCon [AltCon]
    | DFunUnfolding
    | CoreUnfolding { Unfolding bndr var -> Expr' bndr var
unfTemplate   :: Expr' bndr var
                    , Unfolding bndr var -> Bool
unfIsValue    :: Bool
                    , Unfolding bndr var -> Bool
unfIsConLike  :: Bool
                    , Unfolding bndr var -> Bool
unfIsWorkFree :: Bool
                    , Unfolding bndr var -> Text
unfGuidance   :: T.Text
                    }
    deriving (Unfolding bndr var -> Unfolding bndr var -> Bool
(Unfolding bndr var -> Unfolding bndr var -> Bool)
-> (Unfolding bndr var -> Unfolding bndr var -> Bool)
-> Eq (Unfolding bndr var)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall bndr var.
(Eq var, Eq bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Bool
/= :: Unfolding bndr var -> Unfolding bndr var -> Bool
$c/= :: forall bndr var.
(Eq var, Eq bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Bool
== :: Unfolding bndr var -> Unfolding bndr var -> Bool
$c== :: forall bndr var.
(Eq var, Eq bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Bool
Eq, Eq (Unfolding bndr var)
Eq (Unfolding bndr var)
-> (Unfolding bndr var -> Unfolding bndr var -> Ordering)
-> (Unfolding bndr var -> Unfolding bndr var -> Bool)
-> (Unfolding bndr var -> Unfolding bndr var -> Bool)
-> (Unfolding bndr var -> Unfolding bndr var -> Bool)
-> (Unfolding bndr var -> Unfolding bndr var -> Bool)
-> (Unfolding bndr var -> Unfolding bndr var -> Unfolding bndr var)
-> (Unfolding bndr var -> Unfolding bndr var -> Unfolding bndr var)
-> Ord (Unfolding bndr var)
Unfolding bndr var -> Unfolding bndr var -> Bool
Unfolding bndr var -> Unfolding bndr var -> Ordering
Unfolding bndr var -> Unfolding bndr var -> Unfolding bndr var
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall bndr var. (Ord var, Ord bndr) => Eq (Unfolding bndr var)
forall bndr var.
(Ord var, Ord bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Bool
forall bndr var.
(Ord var, Ord bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Ordering
forall bndr var.
(Ord var, Ord bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Unfolding bndr var
min :: Unfolding bndr var -> Unfolding bndr var -> Unfolding bndr var
$cmin :: forall bndr var.
(Ord var, Ord bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Unfolding bndr var
max :: Unfolding bndr var -> Unfolding bndr var -> Unfolding bndr var
$cmax :: forall bndr var.
(Ord var, Ord bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Unfolding bndr var
>= :: Unfolding bndr var -> Unfolding bndr var -> Bool
$c>= :: forall bndr var.
(Ord var, Ord bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Bool
> :: Unfolding bndr var -> Unfolding bndr var -> Bool
$c> :: forall bndr var.
(Ord var, Ord bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Bool
<= :: Unfolding bndr var -> Unfolding bndr var -> Bool
$c<= :: forall bndr var.
(Ord var, Ord bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Bool
< :: Unfolding bndr var -> Unfolding bndr var -> Bool
$c< :: forall bndr var.
(Ord var, Ord bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Bool
compare :: Unfolding bndr var -> Unfolding bndr var -> Ordering
$ccompare :: forall bndr var.
(Ord var, Ord bndr) =>
Unfolding bndr var -> Unfolding bndr var -> Ordering
$cp1Ord :: forall bndr var. (Ord var, Ord bndr) => Eq (Unfolding bndr var)
Ord, (forall x. Unfolding bndr var -> Rep (Unfolding bndr var) x)
-> (forall x. Rep (Unfolding bndr var) x -> Unfolding bndr var)
-> Generic (Unfolding bndr var)
forall x. Rep (Unfolding bndr var) x -> Unfolding bndr var
forall x. Unfolding bndr var -> Rep (Unfolding bndr var) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall bndr var x. Rep (Unfolding bndr var) x -> Unfolding bndr var
forall bndr var x. Unfolding bndr var -> Rep (Unfolding bndr var) x
$cto :: forall bndr var x. Rep (Unfolding bndr var) x -> Unfolding bndr var
$cfrom :: forall bndr var x. Unfolding bndr var -> Rep (Unfolding bndr var) x
Generic, Int -> Unfolding bndr var -> ShowS
[Unfolding bndr var] -> ShowS
Unfolding bndr var -> String
(Int -> Unfolding bndr var -> ShowS)
-> (Unfolding bndr var -> String)
-> ([Unfolding bndr var] -> ShowS)
-> Show (Unfolding bndr var)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall bndr var.
(Show var, Show bndr) =>
Int -> Unfolding bndr var -> ShowS
forall bndr var.
(Show var, Show bndr) =>
[Unfolding bndr var] -> ShowS
forall bndr var.
(Show var, Show bndr) =>
Unfolding bndr var -> String
showList :: [Unfolding bndr var] -> ShowS
$cshowList :: forall bndr var.
(Show var, Show bndr) =>
[Unfolding bndr var] -> ShowS
show :: Unfolding bndr var -> String
$cshow :: forall bndr var.
(Show var, Show bndr) =>
Unfolding bndr var -> String
showsPrec :: Int -> Unfolding bndr var -> ShowS
$cshowsPrec :: forall bndr var.
(Show var, Show bndr) =>
Int -> Unfolding bndr var -> ShowS
Show)
instance (Serialise bndr, Serialise var) => Serialise (Unfolding bndr var)

data OccInfo = OccManyOccs -- | introduced in GHC 8.2
             | OccDead
             | OccOneOcc
             | OccLoopBreaker { OccInfo -> Bool
occStrongLoopBreaker :: Bool }
    deriving (OccInfo -> OccInfo -> Bool
(OccInfo -> OccInfo -> Bool)
-> (OccInfo -> OccInfo -> Bool) -> Eq OccInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OccInfo -> OccInfo -> Bool
$c/= :: OccInfo -> OccInfo -> Bool
== :: OccInfo -> OccInfo -> Bool
$c== :: OccInfo -> OccInfo -> Bool
Eq, Eq OccInfo
Eq OccInfo
-> (OccInfo -> OccInfo -> Ordering)
-> (OccInfo -> OccInfo -> Bool)
-> (OccInfo -> OccInfo -> Bool)
-> (OccInfo -> OccInfo -> Bool)
-> (OccInfo -> OccInfo -> Bool)
-> (OccInfo -> OccInfo -> OccInfo)
-> (OccInfo -> OccInfo -> OccInfo)
-> Ord OccInfo
OccInfo -> OccInfo -> Bool
OccInfo -> OccInfo -> Ordering
OccInfo -> OccInfo -> OccInfo
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: OccInfo -> OccInfo -> OccInfo
$cmin :: OccInfo -> OccInfo -> OccInfo
max :: OccInfo -> OccInfo -> OccInfo
$cmax :: OccInfo -> OccInfo -> OccInfo
>= :: OccInfo -> OccInfo -> Bool
$c>= :: OccInfo -> OccInfo -> Bool
> :: OccInfo -> OccInfo -> Bool
$c> :: OccInfo -> OccInfo -> Bool
<= :: OccInfo -> OccInfo -> Bool
$c<= :: OccInfo -> OccInfo -> Bool
< :: OccInfo -> OccInfo -> Bool
$c< :: OccInfo -> OccInfo -> Bool
compare :: OccInfo -> OccInfo -> Ordering
$ccompare :: OccInfo -> OccInfo -> Ordering
$cp1Ord :: Eq OccInfo
Ord, (forall x. OccInfo -> Rep OccInfo x)
-> (forall x. Rep OccInfo x -> OccInfo) -> Generic OccInfo
forall x. Rep OccInfo x -> OccInfo
forall x. OccInfo -> Rep OccInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OccInfo x -> OccInfo
$cfrom :: forall x. OccInfo -> Rep OccInfo x
Generic, Int -> OccInfo -> ShowS
[OccInfo] -> ShowS
OccInfo -> String
(Int -> OccInfo -> ShowS)
-> (OccInfo -> String) -> ([OccInfo] -> ShowS) -> Show OccInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OccInfo] -> ShowS
$cshowList :: [OccInfo] -> ShowS
show :: OccInfo -> String
$cshow :: OccInfo -> String
showsPrec :: Int -> OccInfo -> ShowS
$cshowsPrec :: Int -> OccInfo -> ShowS
Show)
instance Serialise OccInfo

data IdDetails = VanillaId
               | RecSelId
               | DataConWorkId
               | DataConWrapId
               | ClassOpId
               | PrimOpId
               -- | FCallId  (these are treated as ExternalNames since they have no binding site)
               | TickBoxOpId
               | DFunId
               | CoVarId -- | introduced in GHC 8.0
               | JoinId { IdDetails -> Int
joinIdArity :: !Int }
               deriving (IdDetails -> IdDetails -> Bool
(IdDetails -> IdDetails -> Bool)
-> (IdDetails -> IdDetails -> Bool) -> Eq IdDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdDetails -> IdDetails -> Bool
$c/= :: IdDetails -> IdDetails -> Bool
== :: IdDetails -> IdDetails -> Bool
$c== :: IdDetails -> IdDetails -> Bool
Eq, Eq IdDetails
Eq IdDetails
-> (IdDetails -> IdDetails -> Ordering)
-> (IdDetails -> IdDetails -> Bool)
-> (IdDetails -> IdDetails -> Bool)
-> (IdDetails -> IdDetails -> Bool)
-> (IdDetails -> IdDetails -> Bool)
-> (IdDetails -> IdDetails -> IdDetails)
-> (IdDetails -> IdDetails -> IdDetails)
-> Ord IdDetails
IdDetails -> IdDetails -> Bool
IdDetails -> IdDetails -> Ordering
IdDetails -> IdDetails -> IdDetails
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: IdDetails -> IdDetails -> IdDetails
$cmin :: IdDetails -> IdDetails -> IdDetails
max :: IdDetails -> IdDetails -> IdDetails
$cmax :: IdDetails -> IdDetails -> IdDetails
>= :: IdDetails -> IdDetails -> Bool
$c>= :: IdDetails -> IdDetails -> Bool
> :: IdDetails -> IdDetails -> Bool
$c> :: IdDetails -> IdDetails -> Bool
<= :: IdDetails -> IdDetails -> Bool
$c<= :: IdDetails -> IdDetails -> Bool
< :: IdDetails -> IdDetails -> Bool
$c< :: IdDetails -> IdDetails -> Bool
compare :: IdDetails -> IdDetails -> Ordering
$ccompare :: IdDetails -> IdDetails -> Ordering
$cp1Ord :: Eq IdDetails
Ord, (forall x. IdDetails -> Rep IdDetails x)
-> (forall x. Rep IdDetails x -> IdDetails) -> Generic IdDetails
forall x. Rep IdDetails x -> IdDetails
forall x. IdDetails -> Rep IdDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IdDetails x -> IdDetails
$cfrom :: forall x. IdDetails -> Rep IdDetails x
Generic, Int -> IdDetails -> ShowS
[IdDetails] -> ShowS
IdDetails -> String
(Int -> IdDetails -> ShowS)
-> (IdDetails -> String)
-> ([IdDetails] -> ShowS)
-> Show IdDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdDetails] -> ShowS
$cshowList :: [IdDetails] -> ShowS
show :: IdDetails -> String
$cshow :: IdDetails -> String
showsPrec :: Int -> IdDetails -> ShowS
$cshowsPrec :: Int -> IdDetails -> ShowS
Show)
instance Serialise IdDetails

data Lit = MachChar Char
         | MachStr BS.ByteString
         | MachNullAddr
         | MachInt Integer
         | MachInt64 Integer
         | MachWord Integer
         | MachWord64 Integer
         | MachFloat Rational
         | MachDouble Rational
         | MachLabel T.Text
         | LitInteger Integer
         | LitNatural Integer
         | LitRubbish
         deriving (Lit -> Lit -> Bool
(Lit -> Lit -> Bool) -> (Lit -> Lit -> Bool) -> Eq Lit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Lit -> Lit -> Bool
$c/= :: Lit -> Lit -> Bool
== :: Lit -> Lit -> Bool
$c== :: Lit -> Lit -> Bool
Eq, Eq Lit
Eq Lit
-> (Lit -> Lit -> Ordering)
-> (Lit -> Lit -> Bool)
-> (Lit -> Lit -> Bool)
-> (Lit -> Lit -> Bool)
-> (Lit -> Lit -> Bool)
-> (Lit -> Lit -> Lit)
-> (Lit -> Lit -> Lit)
-> Ord Lit
Lit -> Lit -> Bool
Lit -> Lit -> Ordering
Lit -> Lit -> Lit
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Lit -> Lit -> Lit
$cmin :: Lit -> Lit -> Lit
max :: Lit -> Lit -> Lit
$cmax :: Lit -> Lit -> Lit
>= :: Lit -> Lit -> Bool
$c>= :: Lit -> Lit -> Bool
> :: Lit -> Lit -> Bool
$c> :: Lit -> Lit -> Bool
<= :: Lit -> Lit -> Bool
$c<= :: Lit -> Lit -> Bool
< :: Lit -> Lit -> Bool
$c< :: Lit -> Lit -> Bool
compare :: Lit -> Lit -> Ordering
$ccompare :: Lit -> Lit -> Ordering
$cp1Ord :: Eq Lit
Ord, (forall x. Lit -> Rep Lit x)
-> (forall x. Rep Lit x -> Lit) -> Generic Lit
forall x. Rep Lit x -> Lit
forall x. Lit -> Rep Lit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Lit x -> Lit
$cfrom :: forall x. Lit -> Rep Lit x
Generic, Int -> Lit -> ShowS
[Lit] -> ShowS
Lit -> String
(Int -> Lit -> ShowS)
-> (Lit -> String) -> ([Lit] -> ShowS) -> Show Lit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Lit] -> ShowS
$cshowList :: [Lit] -> ShowS
show :: Lit -> String
$cshow :: Lit -> String
showsPrec :: Int -> Lit -> ShowS
$cshowsPrec :: Int -> Lit -> ShowS
Show)
instance Serialise Lit

data TyCon = TyCon !T.Text !Unique
           deriving (TyCon -> TyCon -> Bool
(TyCon -> TyCon -> Bool) -> (TyCon -> TyCon -> Bool) -> Eq TyCon
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TyCon -> TyCon -> Bool
$c/= :: TyCon -> TyCon -> Bool
== :: TyCon -> TyCon -> Bool
$c== :: TyCon -> TyCon -> Bool
Eq, Eq TyCon
Eq TyCon
-> (TyCon -> TyCon -> Ordering)
-> (TyCon -> TyCon -> Bool)
-> (TyCon -> TyCon -> Bool)
-> (TyCon -> TyCon -> Bool)
-> (TyCon -> TyCon -> Bool)
-> (TyCon -> TyCon -> TyCon)
-> (TyCon -> TyCon -> TyCon)
-> Ord TyCon
TyCon -> TyCon -> Bool
TyCon -> TyCon -> Ordering
TyCon -> TyCon -> TyCon
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: TyCon -> TyCon -> TyCon
$cmin :: TyCon -> TyCon -> TyCon
max :: TyCon -> TyCon -> TyCon
$cmax :: TyCon -> TyCon -> TyCon
>= :: TyCon -> TyCon -> Bool
$c>= :: TyCon -> TyCon -> Bool
> :: TyCon -> TyCon -> Bool
$c> :: TyCon -> TyCon -> Bool
<= :: TyCon -> TyCon -> Bool
$c<= :: TyCon -> TyCon -> Bool
< :: TyCon -> TyCon -> Bool
$c< :: TyCon -> TyCon -> Bool
compare :: TyCon -> TyCon -> Ordering
$ccompare :: TyCon -> TyCon -> Ordering
$cp1Ord :: Eq TyCon
Ord, (forall x. TyCon -> Rep TyCon x)
-> (forall x. Rep TyCon x -> TyCon) -> Generic TyCon
forall x. Rep TyCon x -> TyCon
forall x. TyCon -> Rep TyCon x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TyCon x -> TyCon
$cfrom :: forall x. TyCon -> Rep TyCon x
Generic, Int -> TyCon -> ShowS
[TyCon] -> ShowS
TyCon -> String
(Int -> TyCon -> ShowS)
-> (TyCon -> String) -> ([TyCon] -> ShowS) -> Show TyCon
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TyCon] -> ShowS
$cshowList :: [TyCon] -> ShowS
show :: TyCon -> String
$cshow :: TyCon -> String
showsPrec :: Int -> TyCon -> ShowS
$cshowsPrec :: Int -> TyCon -> ShowS
Show)
instance Serialise TyCon

type SType = Type' SBinder BinderId
type Type = Type' Binder Binder

data Type' bndr var
    = VarTy var
    | FunTy (Type' bndr var) (Type' bndr var)
    | TyConApp TyCon [Type' bndr var]
    | AppTy (Type' bndr var) (Type' bndr var)
    | ForAllTy bndr (Type' bndr var)
    | LitTy
    | CoercionTy
    deriving (Type' bndr var -> Type' bndr var -> Bool
(Type' bndr var -> Type' bndr var -> Bool)
-> (Type' bndr var -> Type' bndr var -> Bool)
-> Eq (Type' bndr var)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall bndr var.
(Eq var, Eq bndr) =>
Type' bndr var -> Type' bndr var -> Bool
/= :: Type' bndr var -> Type' bndr var -> Bool
$c/= :: forall bndr var.
(Eq var, Eq bndr) =>
Type' bndr var -> Type' bndr var -> Bool
== :: Type' bndr var -> Type' bndr var -> Bool
$c== :: forall bndr var.
(Eq var, Eq bndr) =>
Type' bndr var -> Type' bndr var -> Bool
Eq, Eq (Type' bndr var)
Eq (Type' bndr var)
-> (Type' bndr var -> Type' bndr var -> Ordering)
-> (Type' bndr var -> Type' bndr var -> Bool)
-> (Type' bndr var -> Type' bndr var -> Bool)
-> (Type' bndr var -> Type' bndr var -> Bool)
-> (Type' bndr var -> Type' bndr var -> Bool)
-> (Type' bndr var -> Type' bndr var -> Type' bndr var)
-> (Type' bndr var -> Type' bndr var -> Type' bndr var)
-> Ord (Type' bndr var)
Type' bndr var -> Type' bndr var -> Bool
Type' bndr var -> Type' bndr var -> Ordering
Type' bndr var -> Type' bndr var -> Type' bndr var
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall bndr var. (Ord var, Ord bndr) => Eq (Type' bndr var)
forall bndr var.
(Ord var, Ord bndr) =>
Type' bndr var -> Type' bndr var -> Bool
forall bndr var.
(Ord var, Ord bndr) =>
Type' bndr var -> Type' bndr var -> Ordering
forall bndr var.
(Ord var, Ord bndr) =>
Type' bndr var -> Type' bndr var -> Type' bndr var
min :: Type' bndr var -> Type' bndr var -> Type' bndr var
$cmin :: forall bndr var.
(Ord var, Ord bndr) =>
Type' bndr var -> Type' bndr var -> Type' bndr var
max :: Type' bndr var -> Type' bndr var -> Type' bndr var
$cmax :: forall bndr var.
(Ord var, Ord bndr) =>
Type' bndr var -> Type' bndr var -> Type' bndr var
>= :: Type' bndr var -> Type' bndr var -> Bool
$c>= :: forall bndr var.
(Ord var, Ord bndr) =>
Type' bndr var -> Type' bndr var -> Bool
> :: Type' bndr var -> Type' bndr var -> Bool
$c> :: forall bndr var.
(Ord var, Ord bndr) =>
Type' bndr var -> Type' bndr var -> Bool
<= :: Type' bndr var -> Type' bndr var -> Bool
$c<= :: forall bndr var.
(Ord var, Ord bndr) =>
Type' bndr var -> Type' bndr var -> Bool
< :: Type' bndr var -> Type' bndr var -> Bool
$c< :: forall bndr var.
(Ord var, Ord bndr) =>
Type' bndr var -> Type' bndr var -> Bool
compare :: Type' bndr var -> Type' bndr var -> Ordering
$ccompare :: forall bndr var.
(Ord var, Ord bndr) =>
Type' bndr var -> Type' bndr var -> Ordering
$cp1Ord :: forall bndr var. (Ord var, Ord bndr) => Eq (Type' bndr var)
Ord, (forall x. Type' bndr var -> Rep (Type' bndr var) x)
-> (forall x. Rep (Type' bndr var) x -> Type' bndr var)
-> Generic (Type' bndr var)
forall x. Rep (Type' bndr var) x -> Type' bndr var
forall x. Type' bndr var -> Rep (Type' bndr var) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall bndr var x. Rep (Type' bndr var) x -> Type' bndr var
forall bndr var x. Type' bndr var -> Rep (Type' bndr var) x
$cto :: forall bndr var x. Rep (Type' bndr var) x -> Type' bndr var
$cfrom :: forall bndr var x. Type' bndr var -> Rep (Type' bndr var) x
Generic, Int -> Type' bndr var -> ShowS
[Type' bndr var] -> ShowS
Type' bndr var -> String
(Int -> Type' bndr var -> ShowS)
-> (Type' bndr var -> String)
-> ([Type' bndr var] -> ShowS)
-> Show (Type' bndr var)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall bndr var.
(Show var, Show bndr) =>
Int -> Type' bndr var -> ShowS
forall bndr var. (Show var, Show bndr) => [Type' bndr var] -> ShowS
forall bndr var. (Show var, Show bndr) => Type' bndr var -> String
showList :: [Type' bndr var] -> ShowS
$cshowList :: forall bndr var. (Show var, Show bndr) => [Type' bndr var] -> ShowS
show :: Type' bndr var -> String
$cshow :: forall bndr var. (Show var, Show bndr) => Type' bndr var -> String
showsPrec :: Int -> Type' bndr var -> ShowS
$cshowsPrec :: forall bndr var.
(Show var, Show bndr) =>
Int -> Type' bndr var -> ShowS
Show)
instance (Serialise bndr, Serialise var) => Serialise (Type' bndr var)

newtype ModuleName = ModuleName {ModuleName -> Text
getModuleName :: T.Text}
                   deriving (ModuleName -> ModuleName -> Bool
(ModuleName -> ModuleName -> Bool)
-> (ModuleName -> ModuleName -> Bool) -> Eq ModuleName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModuleName -> ModuleName -> Bool
$c/= :: ModuleName -> ModuleName -> Bool
== :: ModuleName -> ModuleName -> Bool
$c== :: ModuleName -> ModuleName -> Bool
Eq, Eq ModuleName
Eq ModuleName
-> (ModuleName -> ModuleName -> Ordering)
-> (ModuleName -> ModuleName -> Bool)
-> (ModuleName -> ModuleName -> Bool)
-> (ModuleName -> ModuleName -> Bool)
-> (ModuleName -> ModuleName -> Bool)
-> (ModuleName -> ModuleName -> ModuleName)
-> (ModuleName -> ModuleName -> ModuleName)
-> Ord ModuleName
ModuleName -> ModuleName -> Bool
ModuleName -> ModuleName -> Ordering
ModuleName -> ModuleName -> ModuleName
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ModuleName -> ModuleName -> ModuleName
$cmin :: ModuleName -> ModuleName -> ModuleName
max :: ModuleName -> ModuleName -> ModuleName
$cmax :: ModuleName -> ModuleName -> ModuleName
>= :: ModuleName -> ModuleName -> Bool
$c>= :: ModuleName -> ModuleName -> Bool
> :: ModuleName -> ModuleName -> Bool
$c> :: ModuleName -> ModuleName -> Bool
<= :: ModuleName -> ModuleName -> Bool
$c<= :: ModuleName -> ModuleName -> Bool
< :: ModuleName -> ModuleName -> Bool
$c< :: ModuleName -> ModuleName -> Bool
compare :: ModuleName -> ModuleName -> Ordering
$ccompare :: ModuleName -> ModuleName -> Ordering
$cp1Ord :: Eq ModuleName
Ord, Decoder s ModuleName
Decoder s [ModuleName]
[ModuleName] -> Encoding
ModuleName -> Encoding
(ModuleName -> Encoding)
-> (forall s. Decoder s ModuleName)
-> ([ModuleName] -> Encoding)
-> (forall s. Decoder s [ModuleName])
-> Serialise ModuleName
forall s. Decoder s [ModuleName]
forall s. Decoder s ModuleName
forall a.
(a -> Encoding)
-> (forall s. Decoder s a)
-> ([a] -> Encoding)
-> (forall s. Decoder s [a])
-> Serialise a
decodeList :: Decoder s [ModuleName]
$cdecodeList :: forall s. Decoder s [ModuleName]
encodeList :: [ModuleName] -> Encoding
$cencodeList :: [ModuleName] -> Encoding
decode :: Decoder s ModuleName
$cdecode :: forall s. Decoder s ModuleName
encode :: ModuleName -> Encoding
$cencode :: ModuleName -> Encoding
Serialise, Int -> ModuleName -> ShowS
[ModuleName] -> ShowS
ModuleName -> String
(Int -> ModuleName -> ShowS)
-> (ModuleName -> String)
-> ([ModuleName] -> ShowS)
-> Show ModuleName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleName] -> ShowS
$cshowList :: [ModuleName] -> ShowS
show :: ModuleName -> String
$cshow :: ModuleName -> String
showsPrec :: Int -> ModuleName -> ShowS
$cshowsPrec :: Int -> ModuleName -> ShowS
Show)

type Module = Module' Binder Binder
type SModule = Module' SBinder BinderId

data Module' bndr var
    = Module { Module' bndr var -> ModuleName
moduleName        :: ModuleName
             , Module' bndr var -> Text
modulePhase       :: T.Text
             , Module' bndr var -> [TopBinding' bndr var]
moduleTopBindings :: [TopBinding' bndr var]
             }
    deriving ((forall x. Module' bndr var -> Rep (Module' bndr var) x)
-> (forall x. Rep (Module' bndr var) x -> Module' bndr var)
-> Generic (Module' bndr var)
forall x. Rep (Module' bndr var) x -> Module' bndr var
forall x. Module' bndr var -> Rep (Module' bndr var) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall bndr var x. Rep (Module' bndr var) x -> Module' bndr var
forall bndr var x. Module' bndr var -> Rep (Module' bndr var) x
$cto :: forall bndr var x. Rep (Module' bndr var) x -> Module' bndr var
$cfrom :: forall bndr var x. Module' bndr var -> Rep (Module' bndr var) x
Generic, Int -> Module' bndr var -> ShowS
[Module' bndr var] -> ShowS
Module' bndr var -> String
(Int -> Module' bndr var -> ShowS)
-> (Module' bndr var -> String)
-> ([Module' bndr var] -> ShowS)
-> Show (Module' bndr var)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall bndr var.
(Show bndr, Show var) =>
Int -> Module' bndr var -> ShowS
forall bndr var.
(Show bndr, Show var) =>
[Module' bndr var] -> ShowS
forall bndr var.
(Show bndr, Show var) =>
Module' bndr var -> String
showList :: [Module' bndr var] -> ShowS
$cshowList :: forall bndr var.
(Show bndr, Show var) =>
[Module' bndr var] -> ShowS
show :: Module' bndr var -> String
$cshow :: forall bndr var.
(Show bndr, Show var) =>
Module' bndr var -> String
showsPrec :: Int -> Module' bndr var -> ShowS
$cshowsPrec :: forall bndr var.
(Show bndr, Show var) =>
Int -> Module' bndr var -> ShowS
Show)
instance (Serialise bndr, Serialise var) => Serialise (Module' bndr var)

moduleBindings :: Module' bndr var -> [(bndr, CoreStats, Expr' bndr var)]
moduleBindings :: Module' bndr var -> [(bndr, CoreStats, Expr' bndr var)]
moduleBindings = (TopBinding' bndr var -> [(bndr, CoreStats, Expr' bndr var)])
-> [TopBinding' bndr var] -> [(bndr, CoreStats, Expr' bndr var)]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap TopBinding' bndr var -> [(bndr, CoreStats, Expr' bndr var)]
forall bndr var.
TopBinding' bndr var -> [(bndr, CoreStats, Expr' bndr var)]
topBindings ([TopBinding' bndr var] -> [(bndr, CoreStats, Expr' bndr var)])
-> (Module' bndr var -> [TopBinding' bndr var])
-> Module' bndr var
-> [(bndr, CoreStats, Expr' bndr var)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Module' bndr var -> [TopBinding' bndr var]
forall bndr var. Module' bndr var -> [TopBinding' bndr var]
moduleTopBindings

-- $binders
--
-- The binder story:
--
-- Things which might contain bound variables (e.g. expressions and types) have
-- a type variable which is instantiated at 'BinderId' in the serialised form or
-- 'Binder' after post-processing.
--
-- Note that bindings sites themselves are always 'Binder's.

type SExpr = Expr' SBinder BinderId
type Expr = Expr' Binder Binder

data Expr' bndr var
    = EVar var
    | EVarGlobal ExternalName
    | ELit Lit
    | EApp (Expr' bndr var) (Expr' bndr var)
    | ETyLam bndr (Expr' bndr var)
    | ELam bndr (Expr' bndr var)
    | ELet [(bndr, Expr' bndr var)] (Expr' bndr var)
    | ECase (Expr' bndr var) bndr [Alt' bndr var]
    | EType (Type' bndr var)
    | ECoercion
    deriving (Expr' bndr var -> Expr' bndr var -> Bool
(Expr' bndr var -> Expr' bndr var -> Bool)
-> (Expr' bndr var -> Expr' bndr var -> Bool)
-> Eq (Expr' bndr var)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall bndr var.
(Eq var, Eq bndr) =>
Expr' bndr var -> Expr' bndr var -> Bool
/= :: Expr' bndr var -> Expr' bndr var -> Bool
$c/= :: forall bndr var.
(Eq var, Eq bndr) =>
Expr' bndr var -> Expr' bndr var -> Bool
== :: Expr' bndr var -> Expr' bndr var -> Bool
$c== :: forall bndr var.
(Eq var, Eq bndr) =>
Expr' bndr var -> Expr' bndr var -> Bool
Eq, Eq (Expr' bndr var)
Eq (Expr' bndr var)
-> (Expr' bndr var -> Expr' bndr var -> Ordering)
-> (Expr' bndr var -> Expr' bndr var -> Bool)
-> (Expr' bndr var -> Expr' bndr var -> Bool)
-> (Expr' bndr var -> Expr' bndr var -> Bool)
-> (Expr' bndr var -> Expr' bndr var -> Bool)
-> (Expr' bndr var -> Expr' bndr var -> Expr' bndr var)
-> (Expr' bndr var -> Expr' bndr var -> Expr' bndr var)
-> Ord (Expr' bndr var)
Expr' bndr var -> Expr' bndr var -> Bool
Expr' bndr var -> Expr' bndr var -> Ordering
Expr' bndr var -> Expr' bndr var -> Expr' bndr var
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall bndr var. (Ord var, Ord bndr) => Eq (Expr' bndr var)
forall bndr var.
(Ord var, Ord bndr) =>
Expr' bndr var -> Expr' bndr var -> Bool
forall bndr var.
(Ord var, Ord bndr) =>
Expr' bndr var -> Expr' bndr var -> Ordering
forall bndr var.
(Ord var, Ord bndr) =>
Expr' bndr var -> Expr' bndr var -> Expr' bndr var
min :: Expr' bndr var -> Expr' bndr var -> Expr' bndr var
$cmin :: forall bndr var.
(Ord var, Ord bndr) =>
Expr' bndr var -> Expr' bndr var -> Expr' bndr var
max :: Expr' bndr var -> Expr' bndr var -> Expr' bndr var
$cmax :: forall bndr var.
(Ord var, Ord bndr) =>
Expr' bndr var -> Expr' bndr var -> Expr' bndr var
>= :: Expr' bndr var -> Expr' bndr var -> Bool
$c>= :: forall bndr var.
(Ord var, Ord bndr) =>
Expr' bndr var -> Expr' bndr var -> Bool
> :: Expr' bndr var -> Expr' bndr var -> Bool
$c> :: forall bndr var.
(Ord var, Ord bndr) =>
Expr' bndr var -> Expr' bndr var -> Bool
<= :: Expr' bndr var -> Expr' bndr var -> Bool
$c<= :: forall bndr var.
(Ord var, Ord bndr) =>
Expr' bndr var -> Expr' bndr var -> Bool
< :: Expr' bndr var -> Expr' bndr var -> Bool
$c< :: forall bndr var.
(Ord var, Ord bndr) =>
Expr' bndr var -> Expr' bndr var -> Bool
compare :: Expr' bndr var -> Expr' bndr var -> Ordering
$ccompare :: forall bndr var.
(Ord var, Ord bndr) =>
Expr' bndr var -> Expr' bndr var -> Ordering
$cp1Ord :: forall bndr var. (Ord var, Ord bndr) => Eq (Expr' bndr var)
Ord, (forall x. Expr' bndr var -> Rep (Expr' bndr var) x)
-> (forall x. Rep (Expr' bndr var) x -> Expr' bndr var)
-> Generic (Expr' bndr var)
forall x. Rep (Expr' bndr var) x -> Expr' bndr var
forall x. Expr' bndr var -> Rep (Expr' bndr var) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall bndr var x. Rep (Expr' bndr var) x -> Expr' bndr var
forall bndr var x. Expr' bndr var -> Rep (Expr' bndr var) x
$cto :: forall bndr var x. Rep (Expr' bndr var) x -> Expr' bndr var
$cfrom :: forall bndr var x. Expr' bndr var -> Rep (Expr' bndr var) x
Generic, Int -> Expr' bndr var -> ShowS
[Expr' bndr var] -> ShowS
Expr' bndr var -> String
(Int -> Expr' bndr var -> ShowS)
-> (Expr' bndr var -> String)
-> ([Expr' bndr var] -> ShowS)
-> Show (Expr' bndr var)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall bndr var.
(Show var, Show bndr) =>
Int -> Expr' bndr var -> ShowS
forall bndr var. (Show var, Show bndr) => [Expr' bndr var] -> ShowS
forall bndr var. (Show var, Show bndr) => Expr' bndr var -> String
showList :: [Expr' bndr var] -> ShowS
$cshowList :: forall bndr var. (Show var, Show bndr) => [Expr' bndr var] -> ShowS
show :: Expr' bndr var -> String
$cshow :: forall bndr var. (Show var, Show bndr) => Expr' bndr var -> String
showsPrec :: Int -> Expr' bndr var -> ShowS
$cshowsPrec :: forall bndr var.
(Show var, Show bndr) =>
Int -> Expr' bndr var -> ShowS
Show)
instance (Serialise bndr, Serialise var) => Serialise (Expr' bndr var)

type SAlt = Alt' SBinder BinderId
type Alt = Alt' Binder Binder

data Alt' bndr var = Alt { Alt' bndr var -> AltCon
altCon     :: !AltCon
                         , Alt' bndr var -> [bndr]
altBinders :: [bndr]
                         , Alt' bndr var -> Expr' bndr var
altRHS     :: Expr' bndr var
                         }
                  deriving (Alt' bndr var -> Alt' bndr var -> Bool
(Alt' bndr var -> Alt' bndr var -> Bool)
-> (Alt' bndr var -> Alt' bndr var -> Bool) -> Eq (Alt' bndr var)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall bndr var.
(Eq bndr, Eq var) =>
Alt' bndr var -> Alt' bndr var -> Bool
/= :: Alt' bndr var -> Alt' bndr var -> Bool
$c/= :: forall bndr var.
(Eq bndr, Eq var) =>
Alt' bndr var -> Alt' bndr var -> Bool
== :: Alt' bndr var -> Alt' bndr var -> Bool
$c== :: forall bndr var.
(Eq bndr, Eq var) =>
Alt' bndr var -> Alt' bndr var -> Bool
Eq, Eq (Alt' bndr var)
Eq (Alt' bndr var)
-> (Alt' bndr var -> Alt' bndr var -> Ordering)
-> (Alt' bndr var -> Alt' bndr var -> Bool)
-> (Alt' bndr var -> Alt' bndr var -> Bool)
-> (Alt' bndr var -> Alt' bndr var -> Bool)
-> (Alt' bndr var -> Alt' bndr var -> Bool)
-> (Alt' bndr var -> Alt' bndr var -> Alt' bndr var)
-> (Alt' bndr var -> Alt' bndr var -> Alt' bndr var)
-> Ord (Alt' bndr var)
Alt' bndr var -> Alt' bndr var -> Bool
Alt' bndr var -> Alt' bndr var -> Ordering
Alt' bndr var -> Alt' bndr var -> Alt' bndr var
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall bndr var. (Ord bndr, Ord var) => Eq (Alt' bndr var)
forall bndr var.
(Ord bndr, Ord var) =>
Alt' bndr var -> Alt' bndr var -> Bool
forall bndr var.
(Ord bndr, Ord var) =>
Alt' bndr var -> Alt' bndr var -> Ordering
forall bndr var.
(Ord bndr, Ord var) =>
Alt' bndr var -> Alt' bndr var -> Alt' bndr var
min :: Alt' bndr var -> Alt' bndr var -> Alt' bndr var
$cmin :: forall bndr var.
(Ord bndr, Ord var) =>
Alt' bndr var -> Alt' bndr var -> Alt' bndr var
max :: Alt' bndr var -> Alt' bndr var -> Alt' bndr var
$cmax :: forall bndr var.
(Ord bndr, Ord var) =>
Alt' bndr var -> Alt' bndr var -> Alt' bndr var
>= :: Alt' bndr var -> Alt' bndr var -> Bool
$c>= :: forall bndr var.
(Ord bndr, Ord var) =>
Alt' bndr var -> Alt' bndr var -> Bool
> :: Alt' bndr var -> Alt' bndr var -> Bool
$c> :: forall bndr var.
(Ord bndr, Ord var) =>
Alt' bndr var -> Alt' bndr var -> Bool
<= :: Alt' bndr var -> Alt' bndr var -> Bool
$c<= :: forall bndr var.
(Ord bndr, Ord var) =>
Alt' bndr var -> Alt' bndr var -> Bool
< :: Alt' bndr var -> Alt' bndr var -> Bool
$c< :: forall bndr var.
(Ord bndr, Ord var) =>
Alt' bndr var -> Alt' bndr var -> Bool
compare :: Alt' bndr var -> Alt' bndr var -> Ordering
$ccompare :: forall bndr var.
(Ord bndr, Ord var) =>
Alt' bndr var -> Alt' bndr var -> Ordering
$cp1Ord :: forall bndr var. (Ord bndr, Ord var) => Eq (Alt' bndr var)
Ord, (forall x. Alt' bndr var -> Rep (Alt' bndr var) x)
-> (forall x. Rep (Alt' bndr var) x -> Alt' bndr var)
-> Generic (Alt' bndr var)
forall x. Rep (Alt' bndr var) x -> Alt' bndr var
forall x. Alt' bndr var -> Rep (Alt' bndr var) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall bndr var x. Rep (Alt' bndr var) x -> Alt' bndr var
forall bndr var x. Alt' bndr var -> Rep (Alt' bndr var) x
$cto :: forall bndr var x. Rep (Alt' bndr var) x -> Alt' bndr var
$cfrom :: forall bndr var x. Alt' bndr var -> Rep (Alt' bndr var) x
Generic, Int -> Alt' bndr var -> ShowS
[Alt' bndr var] -> ShowS
Alt' bndr var -> String
(Int -> Alt' bndr var -> ShowS)
-> (Alt' bndr var -> String)
-> ([Alt' bndr var] -> ShowS)
-> Show (Alt' bndr var)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall bndr var.
(Show bndr, Show var) =>
Int -> Alt' bndr var -> ShowS
forall bndr var. (Show bndr, Show var) => [Alt' bndr var] -> ShowS
forall bndr var. (Show bndr, Show var) => Alt' bndr var -> String
showList :: [Alt' bndr var] -> ShowS
$cshowList :: forall bndr var. (Show bndr, Show var) => [Alt' bndr var] -> ShowS
show :: Alt' bndr var -> String
$cshow :: forall bndr var. (Show bndr, Show var) => Alt' bndr var -> String
showsPrec :: Int -> Alt' bndr var -> ShowS
$cshowsPrec :: forall bndr var.
(Show bndr, Show var) =>
Int -> Alt' bndr var -> ShowS
Show)
instance (Serialise bndr, Serialise var) => Serialise (Alt' bndr var)

data AltCon = AltDataCon !T.Text
            | AltLit Lit
            | AltDefault
            deriving (AltCon -> AltCon -> Bool
(AltCon -> AltCon -> Bool)
-> (AltCon -> AltCon -> Bool) -> Eq AltCon
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AltCon -> AltCon -> Bool
$c/= :: AltCon -> AltCon -> Bool
== :: AltCon -> AltCon -> Bool
$c== :: AltCon -> AltCon -> Bool
Eq, Eq AltCon
Eq AltCon
-> (AltCon -> AltCon -> Ordering)
-> (AltCon -> AltCon -> Bool)
-> (AltCon -> AltCon -> Bool)
-> (AltCon -> AltCon -> Bool)
-> (AltCon -> AltCon -> Bool)
-> (AltCon -> AltCon -> AltCon)
-> (AltCon -> AltCon -> AltCon)
-> Ord AltCon
AltCon -> AltCon -> Bool
AltCon -> AltCon -> Ordering
AltCon -> AltCon -> AltCon
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AltCon -> AltCon -> AltCon
$cmin :: AltCon -> AltCon -> AltCon
max :: AltCon -> AltCon -> AltCon
$cmax :: AltCon -> AltCon -> AltCon
>= :: AltCon -> AltCon -> Bool
$c>= :: AltCon -> AltCon -> Bool
> :: AltCon -> AltCon -> Bool
$c> :: AltCon -> AltCon -> Bool
<= :: AltCon -> AltCon -> Bool
$c<= :: AltCon -> AltCon -> Bool
< :: AltCon -> AltCon -> Bool
$c< :: AltCon -> AltCon -> Bool
compare :: AltCon -> AltCon -> Ordering
$ccompare :: AltCon -> AltCon -> Ordering
$cp1Ord :: Eq AltCon
Ord, (forall x. AltCon -> Rep AltCon x)
-> (forall x. Rep AltCon x -> AltCon) -> Generic AltCon
forall x. Rep AltCon x -> AltCon
forall x. AltCon -> Rep AltCon x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AltCon x -> AltCon
$cfrom :: forall x. AltCon -> Rep AltCon x
Generic, Int -> AltCon -> ShowS
[AltCon] -> ShowS
AltCon -> String
(Int -> AltCon -> ShowS)
-> (AltCon -> String) -> ([AltCon] -> ShowS) -> Show AltCon
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AltCon] -> ShowS
$cshowList :: [AltCon] -> ShowS
show :: AltCon -> String
$cshow :: AltCon -> String
showsPrec :: Int -> AltCon -> ShowS
$cshowsPrec :: Int -> AltCon -> ShowS
Show)
instance Serialise AltCon

type STopBinding = TopBinding' SBinder BinderId
type TopBinding = TopBinding' Binder Binder

data TopBinding' bndr var
    = NonRecTopBinding bndr CoreStats (Expr' bndr var)
    | RecTopBinding [(bndr, CoreStats, Expr' bndr var)]
    deriving ((forall x. TopBinding' bndr var -> Rep (TopBinding' bndr var) x)
-> (forall x. Rep (TopBinding' bndr var) x -> TopBinding' bndr var)
-> Generic (TopBinding' bndr var)
forall x. Rep (TopBinding' bndr var) x -> TopBinding' bndr var
forall x. TopBinding' bndr var -> Rep (TopBinding' bndr var) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall bndr var x.
Rep (TopBinding' bndr var) x -> TopBinding' bndr var
forall bndr var x.
TopBinding' bndr var -> Rep (TopBinding' bndr var) x
$cto :: forall bndr var x.
Rep (TopBinding' bndr var) x -> TopBinding' bndr var
$cfrom :: forall bndr var x.
TopBinding' bndr var -> Rep (TopBinding' bndr var) x
Generic, Int -> TopBinding' bndr var -> ShowS
[TopBinding' bndr var] -> ShowS
TopBinding' bndr var -> String
(Int -> TopBinding' bndr var -> ShowS)
-> (TopBinding' bndr var -> String)
-> ([TopBinding' bndr var] -> ShowS)
-> Show (TopBinding' bndr var)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall bndr var.
(Show bndr, Show var) =>
Int -> TopBinding' bndr var -> ShowS
forall bndr var.
(Show bndr, Show var) =>
[TopBinding' bndr var] -> ShowS
forall bndr var.
(Show bndr, Show var) =>
TopBinding' bndr var -> String
showList :: [TopBinding' bndr var] -> ShowS
$cshowList :: forall bndr var.
(Show bndr, Show var) =>
[TopBinding' bndr var] -> ShowS
show :: TopBinding' bndr var -> String
$cshow :: forall bndr var.
(Show bndr, Show var) =>
TopBinding' bndr var -> String
showsPrec :: Int -> TopBinding' bndr var -> ShowS
$cshowsPrec :: forall bndr var.
(Show bndr, Show var) =>
Int -> TopBinding' bndr var -> ShowS
Show)
instance (Serialise bndr, Serialise var) => Serialise (TopBinding' bndr var)

topBindings :: TopBinding' bndr var -> [(bndr, CoreStats, Expr' bndr var)]
topBindings :: TopBinding' bndr var -> [(bndr, CoreStats, Expr' bndr var)]
topBindings (NonRecTopBinding bndr
a CoreStats
b Expr' bndr var
c) = [(bndr
a,CoreStats
b,Expr' bndr var
c)]
topBindings (RecTopBinding [(bndr, CoreStats, Expr' bndr var)]
bs) = [(bndr, CoreStats, Expr' bndr var)]
bs

data CoreStats
    = CoreStats { CoreStats -> Int
csTerms       :: !Int
                , CoreStats -> Int
csTypes       :: !Int
                , CoreStats -> Int
csCoercions   :: !Int
                , CoreStats -> Int
csValBinds   :: !Int
                , CoreStats -> Int
csJoinBinds  :: !Int
                }
    deriving ((forall x. CoreStats -> Rep CoreStats x)
-> (forall x. Rep CoreStats x -> CoreStats) -> Generic CoreStats
forall x. Rep CoreStats x -> CoreStats
forall x. CoreStats -> Rep CoreStats x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CoreStats x -> CoreStats
$cfrom :: forall x. CoreStats -> Rep CoreStats x
Generic, Int -> CoreStats -> ShowS
[CoreStats] -> ShowS
CoreStats -> String
(Int -> CoreStats -> ShowS)
-> (CoreStats -> String)
-> ([CoreStats] -> ShowS)
-> Show CoreStats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CoreStats] -> ShowS
$cshowList :: [CoreStats] -> ShowS
show :: CoreStats -> String
$cshow :: CoreStats -> String
showsPrec :: Int -> CoreStats -> ShowS
$cshowsPrec :: Int -> CoreStats -> ShowS
Show)
instance Serialise CoreStats

instance Sem.Semigroup CoreStats where
    CoreStats Int
a Int
b Int
c Int
d Int
e <> :: CoreStats -> CoreStats -> CoreStats
<> CoreStats Int
a' Int
b' Int
c' Int
d' Int
e' =
        Int -> Int -> Int -> Int -> Int -> CoreStats
CoreStats (Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
a') (Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
b') (Int
cInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
c') (Int
dInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
d') (Int
eInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
e')

instance Monoid CoreStats where
    mempty :: CoreStats
mempty = Int -> Int -> Int -> Int -> Int -> CoreStats
CoreStats Int
0 Int
0 Int
0 Int
0 Int
0
    mappend :: CoreStats -> CoreStats -> CoreStats
mappend = CoreStats -> CoreStats -> CoreStats
forall a. Semigroup a => a -> a -> a
(<>)

{-
data Rule' bndr var
    = Rule { ruleName :: T.Text
           , ruleActivation :: Activation
           , ruleFn :: Name
           , ruleBinders :: [bndr]
           , ruleRHS :: Expr' bndr var
           , ruleAuto :: Bool
           }
-}