@@ -128,24 +128,26 @@ rnil = unsafeRNil 0
128-- | An empty record with an initial size for the record
128-- | An empty record with an initial size for the record
129unsafeRNil :: Int -> Rec '[]
129unsafeRNil :: Int -> Rec '[]
130unsafeRNil (I# n#) =
130unsafeRNil (I# n#) =
131− runST' $ ST $ \s# ->
131+ runST' $
132− case newSmallArray# n# (error "No Value") s# of
133+ case newSmallArray# n# (error "No Value") s# of
133− (# s'#, arr# #) ->
134+ (# s'#, arr# #) ->
134− case unsafeFreezeSmallArray# arr# s'# of
135+ case unsafeFreezeSmallArray# arr# s'# of
135− (# s''#, a# #) -> (# s''#, MkRec a# #)
136+ (# s''#, a# #) -> (# s''#, MkRec a# #)
136{-# INLINE unsafeRNil #-}
137{-# INLINE unsafeRNil #-}
138-- Not in superrecord
139-- Not in superrecord
139recCopy :: forall lts rts. RecCopy lts lts rts => Rec lts -> Rec rts
140recCopy :: forall lts rts. RecCopy lts lts rts => Rec lts -> Rec rts
140recCopy r@(MkRec vec#) =
141recCopy r@(MkRec vec#) =
141 let size# = sizeofSmallArray# vec#
142 let size# = sizeofSmallArray# vec#
142− in runST' $ ST $ \s# ->
143+ in runST' $
143− case newSmallArray# size# (error "No value") s# of
145+ case newSmallArray# size# (error "No value") s# of
144− (# s'#, arr# #) ->
146+ (# s'#, arr# #) ->
145− case recCopyInto (Proxy @lts) r (Proxy @rts) arr# s'# of
147+ case recCopyInto (Proxy @lts) r (Proxy @rts) arr# s'# of
147− case unsafeFreezeSmallArray# arr# s''# of
149+ case unsafeFreezeSmallArray# arr# s''# of
148− (# s'''#, a# #) -> (# s'''#, MkRec a# #)
150+ (# s'''#, a# #) -> (# s'''#, MkRec a# #)
149{-# INLINE recCopy #-}
151{-# INLINE recCopy #-}
151class RecCopy (pts :: [*]) (lts :: [*]) (rts :: [*]) where
153class RecCopy (pts :: [*]) (lts :: [*]) (rts :: [*]) where
@@ -195,13 +197,14 @@ unsafeRCons ::
195 Rec lts ->
197 Rec lts ->
196 Rec (l := t ': lts)
198 Rec (l := t ': lts)
197unsafeRCons (_ := val) (MkRec vec#) =
199unsafeRCons (_ := val) (MkRec vec#) =
198− runST' $ ST $ \s# ->
200+ runST' $
199− case unsafeThawSmallArray# vec# s# of
202+ case unsafeThawSmallArray# vec# s# of
200− (# s'#, arr# #) ->
203+ (# s'#, arr# #) ->
201− case writeSmallArray# arr# size# (unsafeCoerce# val) s'# of
204+ case writeSmallArray# arr# size# (unsafeCoerce# val) s'# of
203− case unsafeFreezeSmallArray# arr# s''# of
206+ case unsafeFreezeSmallArray# arr# s''# of
204− (# s'''#, a# #) -> (# s'''#, MkRec a# #)
207+ (# s'''#, a# #) -> (# s'''#, MkRec a# #)
206 !(I# size#) = fromIntegral $ natVal' (proxy# :: Proxy# s)
209 !(I# size#) = fromIntegral $ natVal' (proxy# :: Proxy# s)
207{-# INLINE unsafeRCons #-}
210{-# INLINE unsafeRCons #-}
@@ -308,15 +311,16 @@ set _ !val (MkRec vec#) =
308 dynVal :: Any
311 dynVal :: Any
309 !dynVal = unsafeCoerce# val
312 !dynVal = unsafeCoerce# val
311− runST' $ ST $ \s# ->
314+ runST' $
312− case newSmallArray# size# (error "No value") s# of
316+ case newSmallArray# size# (error "No value") s# of
313− (# s'#, arr# #) ->
317+ (# s'#, arr# #) ->
314− case copySmallArray# vec# 0# arr# 0# size# s'# of
318+ case copySmallArray# vec# 0# arr# 0# size# s'# of
316− case writeSmallArray# arr# (size# -# index# -# 1#) dynVal s''# of
320+ case writeSmallArray# arr# (size# -# index# -# 1#) dynVal s''# of
317− s'''# ->
321+ s'''# ->
318− case unsafeFreezeSmallArray# arr# s'''# of
322+ case unsafeFreezeSmallArray# arr# s'''# of
319− (# s''''#, a# #) -> (# s''''#, MkRec a# #)
323+ (# s''''#, a# #) -> (# s''''#, MkRec a# #)
321{-# INLINE set #-}
325{-# INLINE set #-}
@@ -380,15 +384,16 @@ combine ::
380combine lts rts =
384combine lts rts =
381 let !(I# size#) =
385 let !(I# size#) =
382 fromIntegral $ natVal' (proxy# :: Proxy# (RecSize lhs + RecSize rhs))
386 fromIntegral $ natVal' (proxy# :: Proxy# (RecSize lhs + RecSize rhs))
383− in runST' $ ST $ \s# ->
387+ in runST' $
384− case newSmallArray# size# (error "No value") s# of
389+ case newSmallArray# size# (error "No value") s# of
385− (# s'#, arr# #) ->
390+ (# s'#, arr# #) ->
386− case recCopyInto (Proxy :: Proxy lhs) lts (Proxy :: Proxy res) arr# s'# of
391+ case recCopyInto (Proxy :: Proxy lhs) lts (Proxy :: Proxy res) arr# s'# of
388− case recCopyInto (Proxy :: Proxy rhs) rts (Proxy :: Proxy res) arr# s''# of
393+ case recCopyInto (Proxy :: Proxy rhs) rts (Proxy :: Proxy res) arr# s''# of
389− s'''# ->
394+ s'''# ->
390− case unsafeFreezeSmallArray# arr# s'''# of
395+ case unsafeFreezeSmallArray# arr# s'''# of
391− (# s''''#, a# #) -> (# s''''#, MkRec a# #)
396+ (# s''''#, a# #) -> (# s''''#, MkRec a# #)
392{-# INLINE combine #-}
397{-# INLINE combine #-}
394-- | Alias for 'combine'
399-- | Alias for 'combine'