basicblock: using arrows
authorBernhard Urban <lewurm@gmail.com>
Tue, 4 Sep 2012 16:34:01 +0000 (18:34 +0200)
committerBernhard Urban <lewurm@gmail.com>
Tue, 4 Sep 2012 16:34:01 +0000 (18:34 +0200)
I feel so awesome now, woooot :D

Mate/BasicBlocks.hs

index 3fa4a6c699b73931ec8045d50db8a458e07af622..e81282022ceb9ba2b7f423bb54ea7934f0d5017e 100644 (file)
@@ -17,6 +17,7 @@ import qualified Data.ByteString.Lazy as B
 import Data.Maybe
 import Control.Monad.State
 import Control.Applicative
 import Data.Maybe
 import Control.Monad.State
 import Control.Applicative
+import Control.Arrow
 
 import JVM.ClassFile
 import JVM.Converter
 
 import JVM.ClassFile
 import JVM.Converter
@@ -173,7 +174,7 @@ parseBasicBlock i insns = BasicBlock insonly endblock
     takeWhilePlusOne _ _ [] = (Nothing, [])
     takeWhilePlusOne p omit (x:xs)
       | omit x    = next
     takeWhilePlusOne _ _ [] = (Nothing, [])
     takeWhilePlusOne p omit (x:xs)
       | omit x    = next
-      | p x       = (\(ys, xs') -> (ys, x:xs')) next
+      | p x       = second (x:) next
       | otherwise = (Just x, [x])
       where
         next = takeWhilePlusOne p omit xs
       | otherwise = (Just x, [x])
       where
         next = takeWhilePlusOne p omit xs