Created
April 14, 2014 23:00
-
-
Save danbst/10688720 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Main.mapM_IndexReverse = (f :: GHC.Word.Word8 -> m ()) (PS payload rb1_a1UY offset length) -> | |
let return :: m () | |
return = GHC.Base.return @ m $dMonad_a1Dq @ () GHC.Tuple.() | |
>> :: m () -> m () -> m () | |
>> = GHC.Base.>> @ m $dMonad_a1Dq @ () @ () | |
in | |
letrec { | |
loop :: Int# -> m () | |
loop index -> | |
case index of | |
0 -> return | |
_ -> | |
let new_index = index -# 1 | |
in (if new_index <# 0 | |
then case check_negative_index new_index of wild2_00 { } | |
else | |
if new_index >=# length | |
then case check_index_too_large length new_index of wild2_00 { } | |
else | |
let (# world, word #) = readWord8OffAddr# RealWorld (plusAddr# payload (offset +# new_index)) 0 realWorld# | |
in case touch# GHC.ForeignPtr.ForeignPtrContents rb1_a1UY world of | |
_ -> f (W8# word) | |
) | |
>> loop new_index | |
in loop length |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment