Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
ghc -ddump-simpl -O2 IndexTest.hs (GHC 7.10.2)
[1 of 1] Compiling Main ( IndexTest.hs, IndexTest.o )
==================== Tidy Core ====================
Result size of Tidy Core = {terms: 184, types: 266, coercions: 76}
lvl1_r5Mc :: [Char]
[GblId, Str=DmdType]
lvl1_r5Mc = GHC.CString.unpackCString# ": safe!"#
$wa_r5Md
:: String
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId, Arity=2, Str=DmdType <L,1*U><L,U>]
$wa_r5Md =
\ (w_s5Hs :: String)
(w1_s5Hu [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
GHC.IO.Handle.Text.hPutStr2
GHC.IO.Handle.FD.stdout
(++ @ Char w_s5Hs lvl1_r5Mc)
GHC.Types.True
w1_s5Hu
a_r5Me
:: String
-> Int
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId, Arity=3, Str=DmdType <L,1*U><L,A><L,U>]
a_r5Me =
\ (w_s5Hs :: String)
_ [Occ=Dead]
(w2_s5Hu [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
$wa_r5Md w_s5Hs w2_s5Hu
check_r2i0 :: String -> Int -> IO ()
[GblId, Arity=3, Str=DmdType <L,1*U><L,A><L,U>]
check_r2i0 =
a_r5Me
`cast` (<String>_R -> <Int>_R -> Sym (GHC.Types.NTCo:IO[0] <()>_R)
:: (String
-> Int
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# (String -> Int -> IO ()))
lvl2_r5Mf :: [Char]
[GblId, Str=DmdType]
lvl2_r5Mf = GHC.CString.unpackCString# "test1"#
a1_r5Mg
:: V.Vector Int
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId, Arity=2, Str=DmdType <S,1*H><L,U>]
a1_r5Mg =
\ (v_a2pg :: V.Vector Int)
(eta_B1 [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
case v_a2pg
of _ [Occ=Dead]
{ Data.Vector.Vector ipv_s2CZ ipv1_s2Db ipv2_s2Dc ->
((check_r2i0
lvl2_r5Mf
(case GHC.Prim.indexArray# @ Int ipv2_s2Dc ipv_s2CZ
of _ [Occ=Dead] { (# ipv3_a5vA #) ->
ipv3_a5vA
}))
`cast` (GHC.Types.NTCo:IO[0] <()>_R
:: IO ()
~R# (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))))
eta_B1
}
test1 [InlPrag=NOINLINE] :: V.Vector Int -> IO ()
[GblId, Arity=2, Str=DmdType <S,1*H><L,U>]
test1 =
a1_r5Mg
`cast` (<V.Vector Int>_R -> Sym (GHC.Types.NTCo:IO[0] <()>_R)
:: (V.Vector Int
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# (V.Vector Int -> IO ()))
lvl3_r5Mh :: [Char]
[GblId, Str=DmdType]
lvl3_r5Mh = GHC.CString.unpackCString# "test3"#
a2_r5Mi
:: V.Vector Int
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId, Arity=2, Str=DmdType <S,1*U(U,A,U)><L,U>]
a2_r5Mi =
\ (v_a2pj :: V.Vector Int)
(eta_B1 [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
case v_a2pj
of _ [Occ=Dead]
{ Data.Vector.Vector ipv_s2Df ipv1_s2Dg ipv2_s2Dh ->
case GHC.Prim.indexArray# @ Int ipv2_s2Dh ipv_s2Df
of _ [Occ=Dead] { (# ipv3_a5vA #) ->
case ipv3_a5vA of vx_a2zI { GHC.Types.I# ipv4_s3c7 ->
((check_r2i0 lvl3_r5Mh vx_a2zI)
`cast` (GHC.Types.NTCo:IO[0] <()>_R
:: IO ()
~R# (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))))
eta_B1
}
}
}
test3 [InlPrag=NOINLINE] :: V.Vector Int -> IO ()
[GblId, Arity=2, Str=DmdType <S,1*U(U,A,U)><L,U>]
test3 =
a2_r5Mi
`cast` (<V.Vector Int>_R -> Sym (GHC.Types.NTCo:IO[0] <()>_R)
:: (V.Vector Int
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# (V.Vector Int -> IO ()))
lvl4_r5Mj :: [Char]
[GblId, Str=DmdType]
lvl4_r5Mj = GHC.CString.unpackCString# "test2"#
a3_r5Mk
:: V.Vector Int
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId, Arity=2, Str=DmdType <S,1*U(U,A,U)><L,U>]
a3_r5Mk =
\ (v_a2ph :: V.Vector Int)
(eta_B1 [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
case v_a2ph
of _ [Occ=Dead]
{ Data.Vector.Vector ipv_s2Dk ipv1_s2Dl ipv2_s2Dm ->
case GHC.Prim.indexArray# @ Int ipv2_s2Dm ipv_s2Dk
of _ [Occ=Dead] { (# ipv3_a5vA #) ->
((check_r2i0 lvl4_r5Mj ipv3_a5vA)
`cast` (GHC.Types.NTCo:IO[0] <()>_R
:: IO ()
~R# (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))))
eta_B1
}
}
test2 [InlPrag=NOINLINE] :: V.Vector Int -> IO ()
[GblId, Arity=2, Str=DmdType <S,1*U(U,A,U)><L,U>]
test2 =
a3_r5Mk
`cast` (<V.Vector Int>_R -> Sym (GHC.Types.NTCo:IO[0] <()>_R)
:: (V.Vector Int
-> GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# (V.Vector Int -> IO ()))
Main.main2
:: forall a_a2qy s_X3eT.
GHC.Prim.State# s_X3eT
-> (# GHC.Prim.State# s_X3eT, V.Vector a_a2qy #)
[GblId,
Arity=1,
Str=DmdType,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [0] 186 30}]
Main.main2 =
\ (@ a4_a2qy)
(@ s_X3eT)
(s1_X3eV [OS=OneShot] :: GHC.Prim.State# s_X3eT) ->
case GHC.Prim.newArray#
@ a4_a2qy
@ (Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))
1
(Data.Vector.Mutable.uninitialised @ a4_a2qy)
(s1_X3eV
`cast` ((GHC.Prim.State#
(Sym (Control.Monad.Primitive.TFCo:R:PrimStateST[0] <s_X3eT>_N)))_R
:: GHC.Prim.State# s_X3eT
~R# GHC.Prim.State#
(Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))))
of _ [Occ=Dead] { (# ipv_a5zB, ipv1_a5zC #) ->
case GHC.Prim.writeArray#
@ (Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))
@ a4_a2qy
ipv1_a5zC
0
(undefined @ a4_a2qy)
ipv_a5zB
of s'#_a5Fo [OS=OneShot] { __DEFAULT ->
letrec {
$wa1_s5HC [InlPrag=[0], Occ=LoopBreaker]
:: GHC.Prim.Int#
-> GHC.Prim.State# s_X3eT -> (# GHC.Prim.State# s_X3eT, () #)
[LclId, Arity=2, Str=DmdType <L,U><L,U>]
$wa1_s5HC =
\ (ww_s5HA :: GHC.Prim.Int#)
(w_s5Hx [OS=OneShot] :: GHC.Prim.State# s_X3eT) ->
case GHC.Prim.tagToEnum#
@ Bool (GHC.Prim.<# (GHC.Prim.*# 2 ww_s5HA) 1)
of _ [Occ=Dead] {
False ->
case GHC.Prim.copyMutableArray#
@ (Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))
@ a4_a2qy
ipv1_a5zC
0
ipv1_a5zC
ww_s5HA
(GHC.Prim.-# 1 ww_s5HA)
(w_s5Hx
`cast` ((GHC.Prim.State#
(Sym (Control.Monad.Primitive.TFCo:R:PrimStateST[0] <s_X3eT>_N)))_R
:: GHC.Prim.State# s_X3eT
~R# GHC.Prim.State#
(Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))))
of s'#1_a5F1 [OS=OneShot] { __DEFAULT ->
(# s'#1_a5F1, GHC.Tuple.() #)
`cast` ((# (GHC.Prim.State#
(Control.Monad.Primitive.TFCo:R:PrimStateST[0] <s_X3eT>_N))_R,
<()>_R #)_R
:: (# GHC.Prim.State#
(Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT)),
() #)
~R# (# GHC.Prim.State# s_X3eT, () #))
};
True ->
case GHC.Prim.copyMutableArray#
@ (Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))
@ a4_a2qy
ipv1_a5zC
0
ipv1_a5zC
ww_s5HA
ww_s5HA
(w_s5Hx
`cast` ((GHC.Prim.State#
(Sym (Control.Monad.Primitive.TFCo:R:PrimStateST[0] <s_X3eT>_N)))_R
:: GHC.Prim.State# s_X3eT
~R# GHC.Prim.State#
(Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))))
of s'#1_a5Fh [OS=OneShot] { __DEFAULT ->
$wa1_s5HC
(GHC.Prim.*# 2 ww_s5HA)
(s'#1_a5Fh
`cast` ((GHC.Prim.State#
(Control.Monad.Primitive.TFCo:R:PrimStateST[0] <s_X3eT>_N))_R
:: GHC.Prim.State#
(Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))
~R# GHC.Prim.State# s_X3eT))
}
}; } in
case $wa1_s5HC
1
(s'#_a5Fo
`cast` ((GHC.Prim.State#
(Control.Monad.Primitive.TFCo:R:PrimStateST[0] <s_X3eT>_N))_R
:: GHC.Prim.State#
(Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))
~R# GHC.Prim.State# s_X3eT))
of _ [Occ=Dead] { (# ipv6_a5xn, ipv7_a5xo #) ->
case GHC.Prim.unsafeFreezeArray#
@ (Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))
@ a4_a2qy
ipv1_a5zC
(ipv6_a5xn
`cast` ((GHC.Prim.State#
(Sym (Control.Monad.Primitive.TFCo:R:PrimStateST[0] <s_X3eT>_N)))_R
:: GHC.Prim.State# s_X3eT
~R# GHC.Prim.State#
(Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))))
of _ [Occ=Dead] { (# ipv2_a5Bk, ipv3_a5Bl #) ->
(# ipv2_a5Bk
`cast` ((GHC.Prim.State#
(Control.Monad.Primitive.TFCo:R:PrimStateST[0] <s_X3eT>_N))_R
:: GHC.Prim.State#
(Control.Monad.Primitive.PrimState (GHC.ST.ST s_X3eT))
~R# GHC.Prim.State# s_X3eT),
Data.Vector.Vector @ a4_a2qy 0 1 ipv3_a5Bl #)
}
}
}
}
Main.main_v :: forall a_a2qw. V.Vector a_a2qw
[GblId,
Str=DmdType,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 20 0}]
Main.main_v =
\ (@ a4_a2qy) ->
GHC.ST.runSTRep @ (V.Vector a4_a2qy) (Main.main2 @ a4_a2qy)
Main.main1
:: GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId,
Arity=1,
Str=DmdType <L,U>,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
Tmpl= \ (s_X3zS [Occ=Once, OS=OneShot]
:: GHC.Prim.State# GHC.Prim.RealWorld) ->
case ((test1 (Main.main_v @ Int))
`cast` (GHC.Types.NTCo:IO[0] <()>_R
:: IO ()
~R# (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))))
s_X3zS
of _ [Occ=Dead] { (# ipv_a3z6 [Occ=Once], _ [Occ=Dead] #) ->
case ((test2 (Main.main_v @ Int))
`cast` (GHC.Types.NTCo:IO[0] <()>_R
:: IO ()
~R# (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))))
ipv_a3z6
of _ [Occ=Dead] { (# ipv2_X3A1 [Occ=Once], _ [Occ=Dead] #) ->
((test3 (Main.main_v @ Int))
`cast` (GHC.Types.NTCo:IO[0] <()>_R
:: IO ()
~R# (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))))
ipv2_X3A1
}
}}]
Main.main1 =
\ (s_X3zS [OS=OneShot] :: GHC.Prim.State# GHC.Prim.RealWorld) ->
case ((test1 (Main.main_v @ Int))
`cast` (GHC.Types.NTCo:IO[0] <()>_R
:: IO ()
~R# (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))))
s_X3zS
of _ [Occ=Dead] { (# ipv_a3z6, ipv1_a3z7 #) ->
case ((test2 (Main.main_v @ Int))
`cast` (GHC.Types.NTCo:IO[0] <()>_R
:: IO ()
~R# (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))))
ipv_a3z6
of _ [Occ=Dead] { (# ipv2_X3A1, ipv3_X3A3 #) ->
((test3 (Main.main_v @ Int))
`cast` (GHC.Types.NTCo:IO[0] <()>_R
:: IO ()
~R# (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))))
ipv2_X3A1
}
}
main :: IO ()
[GblId,
Arity=1,
Str=DmdType <L,U>,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)
Tmpl= Main.main1
`cast` (Sym (GHC.Types.NTCo:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ())}]
main =
Main.main1
`cast` (Sym (GHC.Types.NTCo:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ())
Main.main3
:: GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)
[GblId,
Arity=1,
Str=DmdType,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 60}]
Main.main3 =
GHC.TopHandler.runMainIO1
@ ()
(Main.main1
`cast` (Sym (GHC.Types.NTCo:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ()))
:Main.main :: IO ()
[GblId,
Arity=1,
Str=DmdType,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=True)
Tmpl= Main.main3
`cast` (Sym (GHC.Types.NTCo:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ())}]
:Main.main =
Main.main3
`cast` (Sym (GHC.Types.NTCo:IO[0] <()>_R)
:: (GHC.Prim.State# GHC.Prim.RealWorld
-> (# GHC.Prim.State# GHC.Prim.RealWorld, () #))
~R# IO ())
Linking IndexTest ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment