==================== Tidy Core ==================== 2019-04-01 08:37:31.987344719 UTC Result size of Tidy Core = {terms: 299, types: 288, coercions: 35, joins: 0/1} -- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0} $cshow_r1HG :: Timeout -> String [GblId, Arity=1, Unf=OtherCon []] $cshow_r1HG = \ _ [Occ=Dead] -> GHC.CString.unpackCString# "<>"# Rec { -- RHS size: {terms: 4, types: 1, coercions: 0, joins: 0/0} System.Timeout.$fShowTimeout [InlPrag=NOUSERINLINE CONLIKE] :: Show Timeout [GblId[DFunId]] System.Timeout.$fShowTimeout = GHC.Show.C:Show @ Timeout $cshowsPrec_r1Jj $cshow_r1HG $cshowList_r1Ji -- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0} $cshowList_r1Ji :: [Timeout] -> ShowS [GblId] $cshowList_r1Ji = GHC.Show.$dmshowList @ Timeout System.Timeout.$fShowTimeout -- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0} $cshowsPrec_r1Jj :: Int -> Timeout -> ShowS [GblId] $cshowsPrec_r1Jj = GHC.Show.$dmshowsPrec @ Timeout System.Timeout.$fShowTimeout end Rec } -- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0} $c/=_r1Jk :: Unique -> Unique -> Bool [GblId] $c/=_r1Jk = /= @ Unique Data.Unique.$fEqUnique -- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0} $c==_r1Jl :: Unique -> Unique -> Bool [GblId] $c==_r1Jl = == @ Unique Data.Unique.$fEqUnique -- RHS size: {terms: 3, types: 1, coercions: 14, joins: 0/0} System.Timeout.$fEqTimeout [InlPrag=NOUSERINLINE CONLIKE] :: Eq Timeout [GblId[DFunId]] System.Timeout.$fEqTimeout = GHC.Classes.C:Eq @ Timeout ($c==_r1Jl `cast` (Sym (System.Timeout.N:Timeout[0]) ->_R Sym (System.Timeout.N:Timeout[0]) ->_R _R :: (Unique -> Unique -> Bool) ~R# (Timeout -> Timeout -> Bool))) ($c/=_r1Jk `cast` (Sym (System.Timeout.N:Timeout[0]) ->_R Sym (System.Timeout.N:Timeout[0]) ->_R _R :: (Unique -> Unique -> Bool) ~R# (Timeout -> Timeout -> Bool))) -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} $trModule1_r1Jm :: GHC.Prim.Addr# [GblId, Caf=NoCafRefs, Unf=OtherCon []] $trModule1_r1Jm = "base"# -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} $trModule2_r1Jn :: GHC.Types.TrName [GblId, Caf=NoCafRefs, Unf=OtherCon []] $trModule2_r1Jn = GHC.Types.TrNameS $trModule1_r1Jm -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} $trModule3_r1Jo :: GHC.Prim.Addr# [GblId, Caf=NoCafRefs, Unf=OtherCon []] $trModule3_r1Jo = "System.Timeout"# -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} $trModule4_r1Jp :: GHC.Types.TrName [GblId, Caf=NoCafRefs, Unf=OtherCon []] $trModule4_r1Jp = GHC.Types.TrNameS $trModule3_r1Jo -- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} System.Timeout.$trModule :: GHC.Types.Module [GblId, Caf=NoCafRefs, Unf=OtherCon []] System.Timeout.$trModule = GHC.Types.Module $trModule2_r1Jn $trModule4_r1Jp -- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0} $krep_r1Jq :: GHC.Types.KindRep [GblId, Unf=OtherCon []] $krep_r1Jq = GHC.Types.KindRepTyConApp Data.Unique.$tcUnique (GHC.Types.[] @ GHC.Types.KindRep) -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} $tcTimeout1_r1Jr :: GHC.Prim.Addr# [GblId, Caf=NoCafRefs, Unf=OtherCon []] $tcTimeout1_r1Jr = "Timeout"# -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} $tcTimeout2_r1Js :: GHC.Types.TrName [GblId, Caf=NoCafRefs, Unf=OtherCon []] $tcTimeout2_r1Js = GHC.Types.TrNameS $tcTimeout1_r1Jr -- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0} System.Timeout.$tcTimeout :: GHC.Types.TyCon [GblId, Unf=OtherCon []] System.Timeout.$tcTimeout = GHC.Types.TyCon 12946206677618037653## 13297406698289896244## System.Timeout.$trModule $tcTimeout2_r1Js 0# GHC.Types.krep$* -- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0} $krep1_r1Jt :: GHC.Types.KindRep [GblId, Unf=OtherCon []] $krep1_r1Jt = GHC.Types.KindRepTyConApp System.Timeout.$tcTimeout (GHC.Types.[] @ GHC.Types.KindRep) -- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} $krep2_r1Ju :: GHC.Types.KindRep [GblId, Unf=OtherCon []] $krep2_r1Ju = GHC.Types.KindRepFun $krep_r1Jq $krep1_r1Jt -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} $tc'Timeout1_r1Jv :: GHC.Prim.Addr# [GblId, Caf=NoCafRefs, Unf=OtherCon []] $tc'Timeout1_r1Jv = "'Timeout"# -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} $tc'Timeout2_r1Jw :: GHC.Types.TrName [GblId, Caf=NoCafRefs, Unf=OtherCon []] $tc'Timeout2_r1Jw = GHC.Types.TrNameS $tc'Timeout1_r1Jv -- RHS size: {terms: 7, types: 0, coercions: 0, joins: 0/0} System.Timeout.$tc'Timeout :: GHC.Types.TyCon [GblId, Unf=OtherCon []] System.Timeout.$tc'Timeout = GHC.Types.TyCon 8768730315338197410## 3436027728364000481## System.Timeout.$trModule $tc'Timeout2_r1Jw 0# $krep2_r1Ju -- RHS size: {terms: 3, types: 4, coercions: 0, joins: 0/0} $cp1Exception_r1Jx :: Data.Typeable.Internal.TypeRep Timeout [GblId] $cp1Exception_r1Jx = Data.Typeable.Internal.mkTrCon @ * @ Timeout System.Timeout.$tcTimeout (GHC.Types.[] @ Data.Typeable.Internal.SomeTypeRep) Rec { -- RHS size: {terms: 6, types: 1, coercions: 5, joins: 0/0} System.Timeout.$fExceptionTimeout [InlPrag=NOUSERINLINE CONLIKE] :: Exception Timeout [GblId[DFunId]] System.Timeout.$fExceptionTimeout = GHC.Exception.Type.C:Exception @ Timeout ($cp1Exception_r1Jx `cast` (Sym (Data.Typeable.Internal.N:Typeable[0]) <*>_N _N :: Data.Typeable.Internal.TypeRep Timeout ~R# Data.Typeable.Internal.Typeable Timeout)) System.Timeout.$fShowTimeout $ctoException_r1JA $cfromException_r1Jy $cdisplayException_r1Jz -- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0} $cfromException_r1Jy :: GHC.Exception.Type.SomeException -> Maybe Timeout [GblId] $cfromException_r1Jy = asyncExceptionFromException @ Timeout System.Timeout.$fExceptionTimeout -- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0} $cdisplayException_r1Jz :: Timeout -> String [GblId] $cdisplayException_r1Jz = GHC.Exception.Type.$dmdisplayException @ Timeout System.Timeout.$fExceptionTimeout -- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0} $ctoException_r1JA :: Timeout -> GHC.Exception.Type.SomeException [GblId] $ctoException_r1JA = asyncExceptionToException @ Timeout System.Timeout.$fExceptionTimeout end Rec } -- RHS size: {terms: 201, types: 218, coercions: 16, joins: 0/1} timeout :: forall a. Int -> IO a -> IO (Maybe a) [GblId, Arity=2, Unf=OtherCon []] timeout = \ (@ a_a1ng) (n_a17n :: Int) (f_a17o :: IO a_a1ng) -> case < @ Int GHC.Classes.$fOrdInt n_a17n (GHC.Types.I# 0#) of { False -> case == @ Int GHC.Classes.$fEqInt n_a17n (GHC.Types.I# 0#) of { False -> case rtsSupportsBoundThreads of { False -> >>= @ IO GHC.Base.$fMonadIO @ ThreadId @ (Maybe a_a1ng) myThreadId (\ (pid_a1ln :: ThreadId) -> >>= @ IO GHC.Base.$fMonadIO @ Timeout @ (Maybe a_a1ng) (fmap @ IO GHC.Base.$fFunctorIO @ Unique @ Timeout ((\ (v_B1 :: Unique) -> v_B1) `cast` (_R ->_R Sym (System.Timeout.N:Timeout[0]) :: (Unique -> Unique) ~R# (Unique -> Timeout))) newUnique) (\ (ex_a1lo :: Timeout) -> handleJust @ Timeout @ () @ (Maybe a_a1ng) System.Timeout.$fExceptionTimeout (\ (e_a1lp :: Timeout) -> case $c==_r1Jl (e_a1lp `cast` (System.Timeout.N:Timeout[0] :: Timeout ~R# Unique)) (ex_a1lo `cast` (System.Timeout.N:Timeout[0] :: Timeout ~R# Unique)) of { False -> GHC.Maybe.Nothing @ (); True -> GHC.Maybe.Just @ () GHC.Tuple.() }) (\ _ [Occ=Dead] -> return @ IO GHC.Base.$fMonadIO @ (Maybe a_a1ng) (GHC.Maybe.Nothing @ a_a1ng)) (bracket @ ThreadId @ () @ (Maybe a_a1ng) ($ @ 'GHC.Types.LiftedRep @ ((forall a1. IO a1 -> IO a1) -> IO ()) @ (IO ThreadId) forkIOWithUnmask (\ (unmask_a1lq :: forall a1. IO a1 -> IO a1) -> $ @ 'GHC.Types.LiftedRep @ (IO ()) @ (IO ()) (unmask_a1lq @ ()) (>> @ IO GHC.Base.$fMonadIO @ () @ () (threadDelay n_a17n) (throwTo @ Timeout System.Timeout.$fExceptionTimeout pid_a1ln ex_a1lo)))) (. @ (IO ()) @ (IO ()) @ ThreadId (uninterruptibleMask_ @ ()) killThread) (\ _ [Occ=Dead] -> fmap @ IO GHC.Base.$fFunctorIO @ a_a1ng @ (Maybe a_a1ng) (GHC.Maybe.Just @ a_a1ng) f_a17o)))); True -> >>= @ IO GHC.Base.$fMonadIO @ ThreadId @ (Maybe a_a1ng) myThreadId (\ (pid_a1fN :: ThreadId) -> >>= @ IO GHC.Base.$fMonadIO @ Timeout @ (Maybe a_a1ng) (fmap @ IO GHC.Base.$fFunctorIO @ Unique @ Timeout ((\ (v_B1 :: Unique) -> v_B1) `cast` (_R ->_R Sym (System.Timeout.N:Timeout[0]) :: (Unique -> Unique) ~R# (Unique -> Timeout))) newUnique) (\ (ex_a1fO :: Timeout) -> >>= @ IO GHC.Base.$fMonadIO @ GHC.Event.TimerManager.TimerManager @ (Maybe a_a1ng) getSystemTimerManager (\ (tm_a1gd :: GHC.Event.TimerManager.TimerManager) -> >>= @ IO GHC.Base.$fMonadIO @ (MVar ThreadId) @ (Maybe a_a1ng) (newEmptyMVar @ ThreadId) (\ (lock_a1gB :: MVar ThreadId) -> handleJust @ Timeout @ () @ (Maybe a_a1ng) System.Timeout.$fExceptionTimeout (\ (e_a1lm :: Timeout) -> case $c==_r1Jl (e_a1lm `cast` (System.Timeout.N:Timeout[0] :: Timeout ~R# Unique)) (ex_a1fO `cast` (System.Timeout.N:Timeout[0] :: Timeout ~R# Unique)) of { False -> GHC.Maybe.Nothing @ (); True -> GHC.Maybe.Just @ () GHC.Tuple.() }) (\ _ [Occ=Dead] -> return @ IO GHC.Base.$fMonadIO @ (Maybe a_a1ng) (GHC.Maybe.Nothing @ a_a1ng)) (bracket @ GHC.Event.TimerManager.TimeoutKey @ () @ (Maybe a_a1ng) (registerTimeout tm_a1gd n_a17n (>>= @ IO GHC.Base.$fMonadIO @ Bool @ () (isEmptyMVar @ ThreadId lock_a1gB) (\ (v_a1gE :: Bool) -> $ @ 'GHC.Types.LiftedRep @ (IO ()) @ (IO ()) (when @ IO GHC.Base.$fApplicativeIO v_a1gE) ($ @ 'GHC.Types.LiftedRep @ (IO ThreadId) @ (IO ()) (void @ IO @ ThreadId GHC.Base.$fFunctorIO) ($ @ 'GHC.Types.LiftedRep @ ((forall a1. IO a1 -> IO a1) -> IO ()) @ (IO ThreadId) forkIOWithUnmask (\ (unmask_a1gN :: forall a1. IO a1 -> IO a1) -> $ @ 'GHC.Types.LiftedRep @ (IO ()) @ (IO ()) (unmask_a1gN @ ()) (>>= @ IO GHC.Base.$fMonadIO @ Bool @ () (=<< @ IO @ ThreadId @ Bool GHC.Base.$fMonadIO (tryPutMVar @ ThreadId lock_a1gB) myThreadId) (\ (v2_a1gO :: Bool) -> $ @ 'GHC.Types.LiftedRep @ (IO ()) @ (IO ()) (when @ IO GHC.Base.$fApplicativeIO v2_a1gO) (throwTo @ Timeout System.Timeout.$fExceptionTimeout pid_a1fN ex_a1fO))))))))) (let { $dIP_s1J9 :: GHC.Stack.Types.CallStack [LclId] $dIP_s1J9 = GHC.Stack.Types.pushCallStack (GHC.CString.unpackCString# "undefined"#, GHC.Stack.Types.SrcLoc (GHC.CString.unpackCString# "base"#) (GHC.CString.unpackCString# "System.Timeout"#) (GHC.CString.unpackCString# "libraries/base/System/Timeout.hs"#) (GHC.Types.I# 110#) (GHC.Types.I# 38#) (GHC.Types.I# 110#) (GHC.Types.I# 47#)) GHC.Stack.Types.emptyCallStack } in \ (key_a1gP :: GHC.Event.TimerManager.TimeoutKey) -> $ @ 'GHC.Types.LiftedRep @ (IO ()) @ (IO ()) (uninterruptibleMask_ @ ()) (>>= @ IO GHC.Base.$fMonadIO @ Bool @ () (tryPutMVar @ ThreadId lock_a1gB (undefined @ 'GHC.Types.LiftedRep @ ThreadId ($dIP_s1J9 `cast` (Sym (GHC.Classes.N:IP[0] <"callStack">_N _N) :: GHC.Stack.Types.CallStack ~R# (?callStack::GHC.Stack.Types.CallStack))))) (\ (v_a1hX :: Bool) -> case v_a1hX of { False -> >>= @ IO GHC.Base.$fMonadIO @ ThreadId @ () (takeMVar @ ThreadId lock_a1gB) killThread; True -> unregisterTimeout tm_a1gd key_a1gP }))) (\ _ [Occ=Dead] -> fmap @ IO GHC.Base.$fFunctorIO @ a_a1ng @ (Maybe a_a1ng) (GHC.Maybe.Just @ a_a1ng) f_a17o)))))) }; True -> return @ IO GHC.Base.$fMonadIO @ (Maybe a_a1ng) (GHC.Maybe.Nothing @ a_a1ng) }; True -> fmap @ IO GHC.Base.$fFunctorIO @ a_a1ng @ (Maybe a_a1ng) (GHC.Maybe.Just @ a_a1ng) f_a17o }