Created
June 28, 2018 22:22
-
-
Save Tarmean/4599919e307382a7ca6990f7b317711e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| -- RHS size: {terms: 57, types: 15, coercions: 0, joins: 2/2} | |
| $wprocess | |
| $wprocess | |
| = \ ww_s4lX ww1_s4lY ww2_s4lZ -> | |
| joinrec { | |
| $s$wfoldlM'_loop_s4oJ | |
| $s$wfoldlM'_loop_s4oJ sc_s4oI | |
| = case tagToEnum# (>=# sc_s4oI ww1_s4lY) of { | |
| False -> | |
| case indexWord8Array# ww2_s4lZ (+# ww_s4lX sc_s4oI) of { | |
| __DEFAULT -> jump $s$wfoldlM'_loop_s4oJ (+# sc_s4oI 1#); | |
| 47## -> jump $s$wfoldlM'_loop1_s4oG (+# sc_s4oI 1#) | |
| }; | |
| True -> False | |
| }; | |
| $s$wfoldlM'_loop1_s4oG | |
| $s$wfoldlM'_loop1_s4oG sc_s4oF | |
| = case tagToEnum# (>=# sc_s4oF ww1_s4lY) of { | |
| False -> | |
| case indexWord8Array# ww2_s4lZ (+# ww_s4lX sc_s4oF) of { | |
| __DEFAULT -> jump $s$wfoldlM'_loop1_s4oG (+# sc_s4oF 1#); | |
| 47## -> jump $s$wfoldlM'_loop_s4oJ (+# sc_s4oF 1#) | |
| }; | |
| True -> True | |
| }; } in | |
| jump $s$wfoldlM'_loop1_s4oG 0# | |
| -- RHS size: {terms: 8, types: 7, coercions: 3, joins: 0/0} | |
| process | |
| process | |
| = \ w_s4lU -> | |
| case w_s4lU `cast` <Co:3> of { Vector ww1_s4lX ww2_s4lY ww3_s4lZ -> | |
| $wprocess ww1_s4lX ww2_s4lY ww3_s4lZ | |
| } | |
This file contains hidden or 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
| {-# LANGUAGE BangPatterns #-} | |
| module Test where | |
| import Data.Vector.Unboxed as U | |
| import GHC.Word | |
| data State = A | B | |
| process :: U.Vector Word8 -> Bool | |
| process bs = acceptable (U.foldl' step A bs) | |
| step :: State -> Word8 -> State | |
| step A 47 = B | |
| step A !_ = A | |
| step B 47 = A | |
| step B !_ = B | |
| acceptable :: State -> Bool | |
| acceptable A = True | |
| acceptable B = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment