@@ -128,24 +128,26 @@ rnil = unsafeRNil 0
128128-- | An empty record with an initial size for the record
129129unsafeRNil :: Int -> Rec '[]
130130unsafeRNil (I# n#) =
131− runST' $ ST $ \s# ->
132− case newSmallArray# n# (error "No Value") s# of
133− (# s'#, arr# #) ->
134− case unsafeFreezeSmallArray# arr# s'# of
135− (# s''#, a# #) -> (# s''#, MkRec a# #)
131+ runST' $
132+ ST $ \s# ->
133+ case newSmallArray# n# (error "No Value") s# of
134+ (# s'#, arr# #) ->
135+ case unsafeFreezeSmallArray# arr# s'# of
136+ (# s''#, a# #) -> (# s''#, MkRec a# #)
136137{-# INLINE unsafeRNil #-}
137138
138139-- Not in superrecord
139140recCopy :: forall lts rts. RecCopy lts lts rts => Rec lts -> Rec rts
140141recCopy r@(MkRec vec#) =
141142 let size# = sizeofSmallArray# vec#
142− in runST' $ ST $ \s# ->
143− case newSmallArray# size# (error "No value") s# of
144− (# s'#, arr# #) ->
145− case recCopyInto (Proxy @lts) r (Proxy @rts) arr# s'# of
146− s''# ->
147− case unsafeFreezeSmallArray# arr# s''# of
148− (# s'''#, a# #) -> (# s'''#, MkRec a# #)
143+ in runST' $
144+ ST $ \s# ->
145+ case newSmallArray# size# (error "No value") s# of
146+ (# s'#, arr# #) ->
147+ case recCopyInto (Proxy @lts) r (Proxy @rts) arr# s'# of
148+ s''# ->
149+ case unsafeFreezeSmallArray# arr# s''# of
150+ (# s'''#, a# #) -> (# s'''#, MkRec a# #)
149151{-# INLINE recCopy #-}
150152
151153class RecCopy (pts :: [*]) (lts :: [*]) (rts :: [*]) where
@@ -195,13 +197,14 @@ unsafeRCons ::
195197 Rec lts ->
196198 Rec (l := t ': lts)
197199unsafeRCons (_ := val) (MkRec vec#) =
198− runST' $ ST $ \s# ->
199− case unsafeThawSmallArray# vec# s# of
200− (# s'#, arr# #) ->
201− case writeSmallArray# arr# size# (unsafeCoerce# val) s'# of
202− s''# ->
203− case unsafeFreezeSmallArray# arr# s''# of
204− (# s'''#, a# #) -> (# s'''#, MkRec a# #)
200+ runST' $
201+ ST $ \s# ->
202+ case unsafeThawSmallArray# vec# s# of
203+ (# s'#, arr# #) ->
204+ case writeSmallArray# arr# size# (unsafeCoerce# val) s'# of
205+ s''# ->
206+ case unsafeFreezeSmallArray# arr# s''# of
207+ (# s'''#, a# #) -> (# s'''#, MkRec a# #)
205208 where
206209 !(I# size#) = fromIntegral $ natVal' (proxy# :: Proxy# s)
207210{-# INLINE unsafeRCons #-}
@@ -308,15 +311,16 @@ set _ !val (MkRec vec#) =
308311 dynVal :: Any
309312 !dynVal = unsafeCoerce# val
310313 r2 =
311− runST' $ ST $ \s# ->
312− case newSmallArray# size# (error "No value") s# of
313− (# s'#, arr# #) ->
314− case copySmallArray# vec# 0# arr# 0# size# s'# of
315− s''# ->
316− case writeSmallArray# arr# (size# -# index# -# 1#) dynVal s''# of
317− s'''# ->
318− case unsafeFreezeSmallArray# arr# s'''# of
319− (# s''''#, a# #) -> (# s''''#, MkRec a# #)
314+ runST' $
315+ ST $ \s# ->
316+ case newSmallArray# size# (error "No value") s# of
317+ (# s'#, arr# #) ->
318+ case copySmallArray# vec# 0# arr# 0# size# s'# of
319+ s''# ->
320+ case writeSmallArray# arr# (size# -# index# -# 1#) dynVal s''# of
321+ s'''# ->
322+ case unsafeFreezeSmallArray# arr# s'''# of
323+ (# s''''#, a# #) -> (# s''''#, MkRec a# #)
320324 in r2
321325{-# INLINE set #-}
322326
@@ -380,15 +384,16 @@ combine ::
380384combine lts rts =
381385 let !(I# size#) =
382386 fromIntegral $ natVal' (proxy# :: Proxy# (RecSize lhs + RecSize rhs))
383− in runST' $ ST $ \s# ->
384− case newSmallArray# size# (error "No value") s# of
385− (# s'#, arr# #) ->
386− case recCopyInto (Proxy :: Proxy lhs) lts (Proxy :: Proxy res) arr# s'# of
387− s''# ->
388− case recCopyInto (Proxy :: Proxy rhs) rts (Proxy :: Proxy res) arr# s''# of
389− s'''# ->
390− case unsafeFreezeSmallArray# arr# s'''# of
391− (# s''''#, a# #) -> (# s''''#, MkRec a# #)
387+ in runST' $
388+ ST $ \s# ->
389+ case newSmallArray# size# (error "No value") s# of
390+ (# s'#, arr# #) ->
391+ case recCopyInto (Proxy :: Proxy lhs) lts (Proxy :: Proxy res) arr# s'# of
392+ s''# ->
393+ case recCopyInto (Proxy :: Proxy rhs) rts (Proxy :: Proxy res) arr# s''# of
394+ s'''# ->
395+ case unsafeFreezeSmallArray# arr# s'''# of
396+ (# s''''#, a# #) -> (# s''''#, MkRec a# #)
392397{-# INLINE combine #-}
393398
394399-- | Alias for 'combine'