From: Bernhard Urban Date: Tue, 4 Sep 2012 16:34:01 +0000 (+0200) Subject: basicblock: using arrows X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mate.git;a=commitdiff_plain;h=c2cb52c1fb9f86a4b5d2bc584ce8a7f07a03f014 basicblock: using arrows I feel so awesome now, woooot :D --- diff --git a/Mate/BasicBlocks.hs b/Mate/BasicBlocks.hs index 3fa4a6c..e812820 100644 --- a/Mate/BasicBlocks.hs +++ b/Mate/BasicBlocks.hs @@ -17,6 +17,7 @@ import qualified Data.ByteString.Lazy as B import Data.Maybe import Control.Monad.State import Control.Applicative +import Control.Arrow 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 - | p x = (\(ys, xs') -> (ys, x:xs')) next + | p x = second (x:) next | otherwise = (Just x, [x]) where next = takeWhilePlusOne p omit xs