Skip to content

Instantly share code, notes, and snippets.

@AndrasKovacs
Last active February 6, 2025 13:01
Show Gist options
  • Save AndrasKovacs/8c98deb0b8d7fc8fdb584a4f42626559 to your computer and use it in GitHub Desktop.
Save AndrasKovacs/8c98deb0b8d7fc8fdb584a4f42626559 to your computer and use it in GitHub Desktop.
ParsleyFlatparse

Comparing GHC Core for Parsley and flatparse for a simple s-expression parser. GHC 8.6.6, flatparse 0.5.2.1, parsley 2.0.0.1

Flatparse source:

{-# language TemplateHaskell #-}

module FP (runSexp) where

import FlatParse.Basic

ws, open, close, ident, sexp, src :: Parser () ()
ws      = skipMany $(switch [| case _ of " " -> pure (); "\n" -> pure () |])
open    = $(char '(') >> ws
close   = $(char ')') >> ws
ident   = skipSome (skipSatisfyAscii isLatinLetter) >> ws
sexp    = branch open (skipSome sexp >> close) ident
src     = sexp >> eof
runSexp = runParser src

Parsley source needs two modules because of the TH runner for parsers:

{-# language TemplateHaskell #-}

module PS (src) where

import Prelude hiding ((<$), (*>), (<*), (<*>))
import Parsley
import Parsley.Combinator

isLatinLetter :: Char -> Bool
isLatinLetter c = ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')

ws, open, close, ident, sexp, src :: Parser ()
ws      = void (many (char ' ' <|> char '\n'))
open    = char '(' *> ws
close   = char ')' *> ws
ident   = some (satisfy (makeQ isLatinLetter [||isLatinLetter||])) *> ws
sexp    = (open *> some sexp *> close) <|> ident
src     = sexp *> eof
{-# language TemplateHaskell #-}

module PSImpl (runSexp) where

import Data.ByteString
import Parsley
import PS

runSexp :: ByteString -> Maybe ()
runSexp = $$(parse src)

Flatparse Core. Note: PureMode is Proxy# Void, i.e. is guaranteed to be erased at runtime. ghc -O1 -ddump-simpl -dsuppress-all -dno-suppress-type-signatures FP.hs:

Rec {
$wgo_r2Z8 :: Addr# -> Addr# -> PureMode -> Res# PureMode () ()
$wgo_r2Z8
  = \ (eob_s2Xw :: Addr#) (s_s2Xx :: Addr#) (st1_s2Xy :: PureMode) ->
      case <=# 1# (minusAddr# eob_s2Xw s_s2Xx) of {
        __DEFAULT -> (# st1_s2Xy, (# _| | #) (# (), s_s2Xx #) #);
        1# ->
          case indexWord8OffAddr# s_s2Xx 0# of ds1_a2R7 { __DEFAULT ->
          case word8ToWord# ds1_a2R7 of {
            __DEFAULT -> (# st1_s2Xy, (# _| | #) (# (), s_s2Xx #) #);
            10## -> $wgo_r2Z8 eob_s2Xw (plusAddr# s_s2Xx 1#) st1_s2Xy;
            32## -> $wgo_r2Z8 eob_s2Xw (plusAddr# s_s2Xx 1#) st1_s2Xy
          }
          }
      }
end Rec }

$wp_r2Z9
  :: Addr#
     -> Addr#
     -> PureMode
     -> (# PureMode, (# (# (), Addr# #) | (# #) | (# () #) #) #)
$wp_r2Z9
  = \ (eta1_s2XE :: Addr#)
      (eta2_s2XF :: Addr#)
      (eta3_s2XG :: PureMode) ->
      case eqAddr# eta1_s2XE eta2_s2XF of {
        __DEFAULT -> (# eta3_s2XG, (# |_| #) (##) #);
        0# ->
          case derefChar8# eta2_s2XF of c1_a2Uf { __DEFAULT ->
          case leChar# 'A'# c1_a2Uf of {
            __DEFAULT ->
              case leChar# 'a'# c1_a2Uf of {
                __DEFAULT -> (# eta3_s2XG, (# |_| #) (##) #);
                1# ->
                  case leChar# c1_a2Uf 'z'# of {
                    __DEFAULT -> (# eta3_s2XG, (# |_| #) (##) #);
                    1# -> (# eta3_s2XG, (# _| | #) (# (), plusAddr# eta2_s2XF 1# #) #)
                  }
              };
            1# ->
              case leChar# c1_a2Uf 'Z'# of {
                __DEFAULT ->
                  case leChar# 'a'# c1_a2Uf of {
                    __DEFAULT -> (# eta3_s2XG, (# |_| #) (##) #);
                    1# ->
                      case leChar# c1_a2Uf 'z'# of {
                        __DEFAULT -> (# eta3_s2XG, (# |_| #) (##) #);
                        1# -> (# eta3_s2XG, (# _| | #) (# (), plusAddr# eta2_s2XF 1# #) #)
                      }
                  };
                1# -> (# eta3_s2XG, (# _| | #) (# (), plusAddr# eta2_s2XF 1# #) #)
              }
          }
          }
      }

Rec {
$wgo1_r2Za
  :: Addr# -> Addr# -> PureMode -> Res# (Proxy# Void) () ()
$wgo1_r2Za
  = \ (eob_s2XM :: Addr#) (s_s2XN :: Addr#) (st1_s2XO :: PureMode) ->
      case $wp_r2Z9 eob_s2XM s_s2XN st1_s2XO of ds_a2TM
      { (# ipv2_a2TN, ipv3_a2TO #) ->
      case ipv3_a2TO of {
        (# _| | #) ds1_a2TR ->
          case ds1_a2TR of { (# a2_s2Yr, s2_s2Ys #) ->
          $wgo1_r2Za eob_s2XM s2_s2Ys ipv2_a2TN
          };
        (# |_| #) ds1_a2TX -> (# ipv2_a2TN, (# _| | #) (# (), s_s2XN #) #);
        (# | |_ #) ipv4_a2TZ -> ds_a2TM
      }
      }
end Rec }

Rec {
$wgo2_r2Zb
  :: Addr# -> Addr# -> PureMode -> Res# (Proxy# Void) () ()
$wgo2_r2Zb
  = \ (eob_s2XU :: Addr#) (s_s2XV :: Addr#) (st1_s2XW :: PureMode) ->
      case $wsexp eob_s2XU s_s2XV st1_s2XW of ds_a2TM
      { (# ipv2_a2TN, ipv3_a2TO #) ->
      case ipv3_a2TO of {
        (# _| | #) ds1_a2TR ->
          case ds1_a2TR of { (# a2_s2Yy, s2_s2Yz #) ->
          $wgo2_r2Zb eob_s2XU s2_s2Yz ipv2_a2TN
          };
        (# |_| #) ds1_a2TX -> (# ipv2_a2TN, (# _| | #) (# (), s_s2XV #) #);
        (# | |_ #) ipv4_a2TZ -> ds_a2TM
      }
      }

$wsexp :: Addr# -> Addr# -> PureMode -> Res# PureMode () ()
$wsexp
  = \ (eob_s2Yc :: Addr#) (s_s2Yd :: Addr#) (st1_s2Ye :: PureMode) ->
      join {
        $w$j_s2Y9 :: Proxy# Void -> ResI# () () -> Res# PureMode () ()
        $w$j_s2Y9 (ipv_s2Y5 :: Proxy# Void) (ipv1_s2Y6 :: ResI# () ())
          = join {
              $j_s2X4 :: PureMode -> ResI# () () -> Res# PureMode () ()
              $j_s2X4 (ipv2_a2Pp :: PureMode) (ipv3_a2Pq :: ResI# () ())
                = case ipv3_a2Pq of wild1_a2Ps {
                    (# _| | #) ds1_a2Pt ->
                      case ds1_a2Pt of { (# a1_s2YF, s1_s2YG #) ->
                      case $wsexp eob_s2Yc s1_s2YG ipv2_a2Pp of ds2_a2Tt
                      { (# ipv4_a2Tu, ipv5_a2Tv #) ->
                      case ipv5_a2Tv of {
                        __DEFAULT -> ds2_a2Tt;
                        (# _| | #) ds3_a2TB ->
                          case ds3_a2TB of { (# a2_s2YJ, s2_s2YK #) ->
                          case $wgo2_r2Zb eob_s2Yc s2_s2YK ipv4_a2Tu of ds4_XA
                          { (# ipv6_XB, ipv7_XC #) ->
                          case ipv7_XC of {
                            __DEFAULT -> ds4_XA;
                            (# _| | #) ds5_a2S4 ->
                              case ds5_a2S4 of { (# a3_s2YN, s3_s2YO #) ->
                              case <=# 1# (minusAddr# eob_s2Yc s3_s2YO) of {
                                __DEFAULT -> (# ipv6_XB, (# |_| #) (##) #);
                                1# ->
                                  case indexWord8OffAddr# s3_s2YO 0# of ds_a2T9 { __DEFAULT ->
                                  case word8ToWord# ds_a2T9 of {
                                    __DEFAULT -> (# ipv6_XB, (# |_| #) (##) #);
                                    41## -> $wgo_r2Z8 eob_s2Yc (plusAddr# s3_s2YO 1#) ipv6_XB
                                  }
                                  }
                              }
                              }
                          }
                          }
                          }
                      }
                      }
                      };
                    (# |_| #) ds1_a2Pz ->
                      case $wp_r2Z9 eob_s2Yc s_s2Yd ipv2_a2Pp of ds2_a2Tt
                      { (# ipv4_a2Tu, ipv5_a2Tv #) ->
                      case ipv5_a2Tv of {
                        __DEFAULT -> ds2_a2Tt;
                        (# _| | #) ds3_a2TB ->
                          case ds3_a2TB of { (# a1_s2YR, s1_s2YS #) ->
                          case $wgo1_r2Za eob_s2Yc s1_s2YS ipv4_a2Tu of ds4_XA
                          { (# ipv6_XB, ipv7_XC #) ->
                          case ipv7_XC of {
                            __DEFAULT -> ds4_XA;
                            (# _| | #) ds5_a2S4 ->
                              case ds5_a2S4 of { (# a2_s2YV, s2_s2YW #) ->
                              $wgo_r2Z8 eob_s2Yc s2_s2YW ipv6_XB
                              }
                          }
                          }
                          }
                      }
                      };
                    (# | |_ #) ipv4_a2PB -> (# ipv2_a2Pp, wild1_a2Ps #)
                  } } in
            case ipv1_s2Y6 of wild_a2S0 {
              __DEFAULT -> jump $j_s2X4 ipv_s2Y5 wild_a2S0;
              (# _| | #) ds3_a2S4 ->
                case ds3_a2S4 of { (# a1_s2Z2, s1_s2Z3 #) ->
                case $wgo_r2Z8 eob_s2Yc s1_s2Z3 ipv_s2Y5 of
                { (# ipv2_a2Pp, ipv3_a2Pq #) ->
                jump $j_s2X4 ipv2_a2Pp ipv3_a2Pq
                }
                }
            } } in
      case <=# 1# (minusAddr# eob_s2Yc s_s2Yd) of {
        __DEFAULT -> jump $w$j_s2Y9 st1_s2Ye ((# |_| #) (##));
        1# ->
          case indexWord8OffAddr# s_s2Yd 0# of ds_a2T9 { __DEFAULT ->
          case word8ToWord# ds_a2T9 of {
            __DEFAULT -> jump $w$j_s2Y9 st1_s2Ye ((# |_| #) (##));
            40## ->
              jump $w$j_s2Y9 st1_s2Ye ((# _| | #) (# (), plusAddr# s_s2Yd 1# #))
          }
          }
      }
end Rec }

runSexp2
  :: ForeignPtrContents
     -> Addr# -> Addr# -> PureMode -> Res# PureMode () ()
runSexp2
  = \ _
      (eob_s2Yc :: Addr#)
      (s_s2Yd :: Addr#)
      (st1_s2Ye :: PureMode) ->
      $wsexp eob_s2Yc s_s2Yd st1_s2Ye

runSexp1
  :: ForeignPtrContents
     -> Addr# -> Addr# -> Proxy# Void -> Res# (Proxy# Void) () ()
runSexp1
  = \ _ (eob_XD :: Addr#) (s_XE :: Addr#) (st1_XF :: Proxy# Void) ->
      case $wsexp eob_XD s_XE st1_XF of ds2_a2RW
      { (# ipv_a2RX, ipv1_a2RY #) ->
      case ipv1_a2RY of {
        __DEFAULT -> ds2_a2RW;
        (# _| | #) ds3_a2S4 ->
          case ds3_a2S4 of { (# a1_s2Z6, s1_s2Z7 #) ->
          case eqAddr# eob_XD s1_s2Z7 of {
            __DEFAULT -> (# ipv_a2RX, (# |_| #) (##) #);
            1# -> (# ipv_a2RX, (# _| | #) (# (), s1_s2Z7 #) #)
          }
          }
      }
      }

runSexp :: ByteString -> Result () ()
runSexp = runParser (runSexp1 `cast` <Co:7> :: ...)

Parsley Core. ghc PSImpl.hs -O1 -ddump-simpl -dsuppress-all -dno-suppress-type-signatures:

$wrunSexp :: Addr# -> ForeignPtrContents -> Int# -> Maybe ()
$wrunSexp
  = \ (ww_s4Os :: Addr#)
      (ww1_s4Ot :: ForeignPtrContents)
      (ww2_s4Ou :: Int#) ->
      runRW#
        (\ (s_a4JF :: State# RealWorld) ->
           let {
             $wsub1_s4NK
               :: forall {s1} {b}.
                  (() -> Pos -> Int# -> ST s1 b)
                  -> Pos
                  -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                  -> State# s1
                  -> (# State# s1, b #)
             $wsub1_s4NK
               = \ (@s1_s4NC)
                   (@b_s4ND)
                   (ret_s4NE :: () -> Pos -> Int# -> ST s1_s4NC b_s4ND)
                   (ds_s4NG :: Pos)
                   (ds1_s4NH :: (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N))
                   (s2_s4NI :: State# s1_s4NC) ->
                   case newMutVar# id s2_s4NI of { (# ipv_a4Kk, ipv1_a4Kl #) ->
                   join {
                     exit_X2
                       :: Pos
                          -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                          -> State# s1_s4NC
                          -> (# State# s1_s4NC, b_s4ND #)
                     exit_X2 (ds3_d4IK :: Pos)
                             (ds4_d4IL :: (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N))
                             (eta2_B0 :: State# s1_s4NC)
                       = case readMutVar# ipv1_a4Kl eta2_B0 of
                         { (# ipv2_a4K5, ipv3_X3 #) ->
                         ((ret_s4NE () ds3_d4IK (ds4_d4IL `cast` <Co:16> :: ...))
                          `cast` <Co:3> :: ...)
                           ipv2_a4K5
                         } } in
                   join {
                     exit1_X3
                       :: Pos
                          -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                          -> State# s1_s4NC
                          -> (# State# s1_s4NC, b_s4ND #)
                     exit1_X3 (ds3_d4IK :: Pos)
                              (ds4_d4IL :: (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N))
                              (eta2_B0 :: State# s1_s4NC)
                       = case readMutVar# ipv1_a4Kl eta2_B0 of
                         { (# ipv2_a4K5, ipv3_X8 #) ->
                         ((ret_s4NE () ds3_d4IK (ds4_d4IL `cast` <Co:16> :: ...))
                          `cast` <Co:3> :: ...)
                           ipv2_a4K5
                         } } in
                   joinrec {
                     loop_s4Lu
                       :: Pos
                          -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                          -> State# s1_s4NC
                          -> (# State# s1_s4NC, b_s4ND #)
                     loop_s4Lu (ds3_d4IK :: Pos)
                               (ds4_d4IL :: (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N))
                               (eta2_B0 :: State# s1_s4NC)
                       = case <# (ds4_d4IL `cast` <Co:16> :: ...) ww2_s4Ou of {
                           __DEFAULT -> case lvl1_r4OE of wild_00 { };
                           0# -> jump exit_X2 ds3_d4IK ds4_d4IL eta2_B0;
                           1# ->
                             case readWord8OffAddr#
                                    (plusAddr# ww_s4Os (ds4_d4IL `cast` <Co:16> :: ...))
                                    0#
                                    realWorld#
                             of
                             { (# ipv2_s4Jr, ipv3_s4Js #) ->
                             case touch# ww1_s4Ot ipv2_s4Jr of { __DEFAULT ->
                             case chr# (word2Int# (word8ToWord# ipv3_s4Js)) of {
                               __DEFAULT -> jump exit1_X3 ds3_d4IK ds4_d4IL eta2_B0;
                               '\n'# ->
                                 case readMutVar# ipv1_a4Kl eta2_B0 of { (# ipv4_a4K5, ipv5_X8 #) ->
                                 case writeMutVar#
                                        ipv1_a4Kl
                                        (\ (x_a42M :: [Char]) -> ipv5_X8 (: eta_r4OF x_a42M))
                                        ipv4_a4K5
                                 of s2#_a4KW
                                 { __DEFAULT ->
                                 jump loop_s4Lu
                                   (plusWord# (and# ds3_d4IK 18446744069414584320##) 4294967297##)
                                   ((+# (ds4_d4IL `cast` <Co:16> :: ...) 1#) `cast` <Co:15> :: ...)
                                   s2#_a4KW
                                 }
                                 };
                               ' '# ->
                                 case readMutVar# ipv1_a4Kl eta2_B0 of { (# ipv4_a4K5, ipv5_X8 #) ->
                                 case writeMutVar#
                                        ipv1_a4Kl
                                        (\ (x_a42M :: [Char]) -> ipv5_X8 (: eta1_r4OG x_a42M))
                                        ipv4_a4K5
                                 of s2#_a4KW
                                 { __DEFAULT ->
                                 jump loop_s4Lu
                                   (plusWord# ds3_d4IK 1##)
                                   ((+# (ds4_d4IL `cast` <Co:16> :: ...) 1#) `cast` <Co:15> :: ...)
                                   s2#_a4KW
                                 }
                                 }
                             }
                             }
                             }
                         }; } in
                   jump loop_s4Lu ds_s4NG ds1_s4NH ipv_a4Kk
                   } } in
           letrec {
             self_s4LC
               :: (() -> Pos -> Int# -> ST RealWorld (Maybe ()))
                  -> (Pos -> Int# -> ST RealWorld (Maybe ()))
                  -> Pos
                  -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                  -> STRep RealWorld (Maybe ())
             self_s4LC
               = \ (ret_a41j :: () -> Pos -> Int# -> ST RealWorld (Maybe ()))
                   (h_a41k :: Pos -> Int# -> ST RealWorld (Maybe ()))
                   (ds_d4I4 :: Pos)
                   (ds1_d4I5 :: (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N))
                   (eta2_B0 :: State# RealWorld) ->
                   case <# (ds1_d4I5 `cast` <Co:16> :: ...) ww2_s4Ou of {
                     __DEFAULT -> case lvl1_r4OE of wild_00 { };
                     0# ->
                       ((h_a41k ds_d4I4 (ds1_d4I5 `cast` <Co:16> :: ...))
                        `cast` <Co:4> :: ...)
                         eta2_B0;
                     1# ->
                       case readWord8OffAddr#
                              (plusAddr# ww_s4Os (ds1_d4I5 `cast` <Co:16> :: ...)) 0# realWorld#
                       of
                       { (# ipv_s4Jr, ipv1_s4Js #) ->
                       case touch# ww1_s4Ot ipv_s4Jr of { __DEFAULT ->
                       let {
                         c#_a4vN :: Char#
                         c#_a4vN = chr# (word2Int# (word8ToWord# ipv1_s4Js)) } in
                       let {
                         yesSame_s4LG :: STRep RealWorld (Maybe ())
                         yesSame_s4LG
                           = \ (eta3_X1 :: State# RealWorld) ->
                               join {
                                 $j_s4MU :: (# State# RealWorld, Maybe () #)
                                 $j_s4MU
                                   = case newMutVar# id eta3_X1 of { (# ipv2_a4Kk, ipv3_a4Kl #) ->
                                     join {
                                       exit_X7
                                         :: Pos
                                            -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                                            -> State# RealWorld
                                            -> (# State# RealWorld, Maybe () #)
                                       exit_X7 (ds6_d4It :: Pos)
                                               (ds7_d4Iu
                                                  :: (DynRep ByteString |> (TYPE
                                                                              (D:R:RepKind[3]))_N))
                                               (eta4_X5 :: State# RealWorld)
                                         = case readMutVar# ipv3_a4Kl eta4_X5 of
                                           { (# ipv4_a4K5, ipv5_X8 #) ->
                                           $wsub1_s4NK ret_a41j ds6_d4It ds7_d4Iu ipv4_a4K5
                                           } } in
                                     join {
                                       exit1_Xa
                                         :: Pos
                                            -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                                            -> State# RealWorld
                                            -> (# State# RealWorld, Maybe () #)
                                       exit1_Xa (ds6_d4It :: Pos)
                                                (ds7_d4Iu
                                                   :: (DynRep ByteString |> (TYPE
                                                                               (D:R:RepKind[3]))_N))
                                                (eta4_X5 :: State# RealWorld)
                                         = case readMutVar# ipv3_a4Kl eta4_X5 of
                                           { (# ipv4_a4K5, ipv5_Xe #) ->
                                           $wsub1_s4NK ret_a41j ds6_d4It ds7_d4Iu ipv4_a4K5
                                           } } in
                                     join {
                                       exit2_Xb
                                         :: Pos
                                            -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                                            -> State# RealWorld
                                            -> (# State# RealWorld, Maybe () #)
                                       exit2_Xb (ds6_d4It :: Pos)
                                                (ds7_d4Iu
                                                   :: (DynRep ByteString |> (TYPE
                                                                               (D:R:RepKind[3]))_N))
                                                (eta4_X5 :: State# RealWorld)
                                         = case readMutVar# ipv3_a4Kl eta4_X5 of
                                           { (# ipv4_a4K5, ipv5_Xc #) ->
                                           $wsub1_s4NK ret_a41j ds6_d4It ds7_d4Iu ipv4_a4K5
                                           } } in
                                     join {
                                       exit3_Xc
                                         :: Pos
                                            -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                                            -> State# RealWorld
                                            -> (# State# RealWorld, Maybe () #)
                                       exit3_Xc (ds6_d4It :: Pos)
                                                (ds7_d4Iu
                                                   :: (DynRep ByteString |> (TYPE
                                                                               (D:R:RepKind[3]))_N))
                                                (eta4_X5 :: State# RealWorld)
                                         = case readMutVar# ipv3_a4Kl eta4_X5 of
                                           { (# ipv4_a4K5, ipv5_Xd #) ->
                                           $wsub1_s4NK ret_a41j ds6_d4It ds7_d4Iu ipv4_a4K5
                                           } } in
                                     join {
                                       exit4_Xd
                                         :: Pos
                                            -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                                            -> State# RealWorld
                                            -> (# State# RealWorld, Maybe () #)
                                       exit4_Xd (ds6_d4It :: Pos)
                                                (ds7_d4Iu
                                                   :: (DynRep ByteString |> (TYPE
                                                                               (D:R:RepKind[3]))_N))
                                                (eta4_X5 :: State# RealWorld)
                                         = case readMutVar# ipv3_a4Kl eta4_X5 of
                                           { (# ipv4_a4K5, ipv5_Xe #) ->
                                           $wsub1_s4NK ret_a41j ds6_d4It ds7_d4Iu ipv4_a4K5
                                           } } in
                                     joinrec {
                                       loop_s4LE
                                         :: Pos
                                            -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                                            -> State# RealWorld
                                            -> (# State# RealWorld, Maybe () #)
                                       loop_s4LE (ds6_d4It :: Pos)
                                                 (ds7_d4Iu
                                                    :: (DynRep ByteString |> (TYPE
                                                                                (D:R:RepKind[3]))_N))
                                                 (eta4_X5 :: State# RealWorld)
                                         = case <# (ds7_d4Iu `cast` <Co:16> :: ...) ww2_s4Ou of {
                                             __DEFAULT -> case lvl1_r4OE of wild_00 { };
                                             0# -> jump exit_X7 ds6_d4It ds7_d4Iu eta4_X5;
                                             1# ->
                                               case readWord8OffAddr#
                                                      (plusAddr#
                                                         ww_s4Os (ds7_d4Iu `cast` <Co:16> :: ...))
                                                      0#
                                                      realWorld#
                                               of
                                               { (# ipv4_Xf, ipv5_X8 #) ->
                                               case touch# ww1_s4Ot ipv4_Xf of { __DEFAULT ->
                                               let {
                                                 c#1_a4y7 :: Char#
                                                 c#1_a4y7
                                                   = chr# (word2Int# (word8ToWord# ipv5_X8)) } in
                                               case leChar# 'A'# c#1_a4y7 of {
                                                 __DEFAULT ->
                                                   case leChar# 'a'# c#1_a4y7 of {
                                                     __DEFAULT ->
                                                       jump exit1_Xa ds6_d4It ds7_d4Iu eta4_X5;
                                                     1# ->
                                                       case leChar# c#1_a4y7 'z'# of {
                                                         __DEFAULT ->
                                                           jump exit2_Xb ds6_d4It ds7_d4Iu eta4_X5;
                                                         1# ->
                                                           case readMutVar# ipv3_a4Kl eta4_X5 of
                                                           { (# ipv6_a4K5, ipv7_Xg #) ->
                                                           let {
                                                             lvl4_s4ME :: Char
                                                             lvl4_s4ME = C# c#1_a4y7 } in
                                                           case writeMutVar#
                                                                  ipv3_a4Kl
                                                                  (\ (x_a41H :: [Char]) ->
                                                                     ipv7_Xg (: lvl4_s4ME x_a41H))
                                                                  ipv6_a4K5
                                                           of s2#_a4KW
                                                           { __DEFAULT ->
                                                           jump loop_s4LE
                                                             (plusWord# ds6_d4It 1##)
                                                             ((+#
                                                                 (ds7_d4Iu `cast` <Co:16> :: ...)
                                                                 1#)
                                                              `cast` <Co:15> :: ...)
                                                             s2#_a4KW
                                                           }
                                                           }
                                                       }
                                                   };
                                                 1# ->
                                                   case leChar# c#1_a4y7 'Z'# of {
                                                     __DEFAULT ->
                                                       case leChar# 'a'# c#1_a4y7 of {
                                                         __DEFAULT ->
                                                           jump exit3_Xc ds6_d4It ds7_d4Iu eta4_X5;
                                                         1# ->
                                                           case leChar# c#1_a4y7 'z'# of {
                                                             __DEFAULT ->
                                                               jump exit4_Xd
                                                                 ds6_d4It ds7_d4Iu eta4_X5;
                                                             1# ->
                                                               case readMutVar# ipv3_a4Kl eta4_X5 of
                                                               { (# ipv6_a4K5, ipv7_Xg #) ->
                                                               let {
                                                                 lvl4_s4ME :: Char
                                                                 lvl4_s4ME = C# c#1_a4y7 } in
                                                               case writeMutVar#
                                                                      ipv3_a4Kl
                                                                      (\ (x_a41H :: [Char]) ->
                                                                         ipv7_Xg
                                                                           (: lvl4_s4ME x_a41H))
                                                                      ipv6_a4K5
                                                               of s2#_a4KW
                                                               { __DEFAULT ->
                                                               jump loop_s4LE
                                                                 (plusWord# ds6_d4It 1##)
                                                                 ((+#
                                                                     (ds7_d4Iu
                                                                      `cast` <Co:16> :: ...)
                                                                     1#)
                                                                  `cast` <Co:15> :: ...)
                                                                 s2#_a4KW
                                                               }
                                                               }
                                                           }
                                                       };
                                                     1# ->
                                                       case readMutVar# ipv3_a4Kl eta4_X5 of
                                                       { (# ipv6_a4K5, ipv7_Xg #) ->
                                                       let {
                                                         lvl4_s4ME :: Char
                                                         lvl4_s4ME = C# c#1_a4y7 } in
                                                       case writeMutVar#
                                                              ipv3_a4Kl
                                                              (\ (x_a41H :: [Char]) ->
                                                                 ipv7_Xg (: lvl4_s4ME x_a41H))
                                                              ipv6_a4K5
                                                       of s2#_a4KW
                                                       { __DEFAULT ->
                                                       jump loop_s4LE
                                                         (plusWord# ds6_d4It 1##)
                                                         ((+# (ds7_d4Iu `cast` <Co:16> :: ...) 1#)
                                                          `cast` <Co:15> :: ...)
                                                         s2#_a4KW
                                                       }
                                                       }
                                                   }
                                               }
                                               }
                                               }
                                           }; } in
                                     jump loop_s4LE
                                       (plusWord# ds_d4I4 1##)
                                       ((+# (ds1_d4I5 `cast` <Co:16> :: ...) 1#)
                                        `cast` <Co:15> :: ...)
                                       ipv2_a4Kk
                                     } } in
                               case leChar# 'A'# c#_a4vN of {
                                 __DEFAULT ->
                                   case leChar# 'a'# c#_a4vN of {
                                     __DEFAULT ->
                                       ((h_a41k ds_d4I4 (ds1_d4I5 `cast` <Co:16> :: ...))
                                        `cast` <Co:4> :: ...)
                                         eta3_X1;
                                     1# ->
                                       case leChar# c#_a4vN 'z'# of {
                                         __DEFAULT ->
                                           ((h_a41k ds_d4I4 (ds1_d4I5 `cast` <Co:16> :: ...))
                                            `cast` <Co:4> :: ...)
                                             eta3_X1;
                                         1# -> jump $j_s4MU
                                       }
                                   };
                                 1# ->
                                   case leChar# c#_a4vN 'Z'# of {
                                     __DEFAULT ->
                                       case leChar# 'a'# c#_a4vN of {
                                         __DEFAULT ->
                                           ((h_a41k ds_d4I4 (ds1_d4I5 `cast` <Co:16> :: ...))
                                            `cast` <Co:4> :: ...)
                                             eta3_X1;
                                         1# ->
                                           case leChar# c#_a4vN 'z'# of {
                                             __DEFAULT ->
                                               ((h_a41k ds_d4I4 (ds1_d4I5 `cast` <Co:16> :: ...))
                                                `cast` <Co:4> :: ...)
                                                 eta3_X1;
                                             1# -> jump $j_s4MU
                                           }
                                       };
                                     1# -> jump $j_s4MU
                                   }
                               } } in
                       case c#_a4vN of {
                         __DEFAULT -> yesSame_s4LG eta2_B0;
                         '('# ->
                           let {
                             handler_s4LI
                               :: Pos
                                  -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                                  -> STRep RealWorld (Maybe ())
                             handler_s4LI
                               = \ (ds5_d4Iq :: Pos)
                                   (ds6_d4Ir :: (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N))
                                   (eta3_X2 :: State# RealWorld) ->
                                   case ==#
                                          (ds1_d4I5 `cast` <Co:16> :: ...)
                                          (ds6_d4Ir `cast` <Co:16> :: ...)
                                   of {
                                     __DEFAULT ->
                                       ((h_a41k ds5_d4Iq (ds6_d4Ir `cast` <Co:16> :: ...))
                                        `cast` <Co:4> :: ...)
                                         eta3_X2;
                                     1# -> yesSame_s4LG eta3_X2
                                   } } in
                           let {
                             $wlvl_s4Oh
                               :: Pos
                                  -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                                  -> State# RealWorld
                                  -> (# State# RealWorld, Maybe () #)
                             $wlvl_s4Oh
                               = \ (ds5_s4Od :: Pos)
                                   (ds6_s4Oe :: (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N))
                                   (s1_s4Of :: State# RealWorld) ->
                                   case newMutVar# id s1_s4Of of { (# ipv2_a4Kk, ipv3_a4Kl #) ->
                                   letrec {
                                     lvl4_s4MG
                                       :: ()
                                          -> Pos
                                          -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                                          -> State# RealWorld
                                          -> (# State# RealWorld, Maybe () #)
                                     lvl4_s4MG
                                       = \ (x_a42i :: ())
                                           (ds8_d4Ic :: Pos)
                                           (ds9_d4Id
                                              :: (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N))
                                           (s2_X7 :: State# RealWorld) ->
                                           case readMutVar# ipv3_a4Kl s2_X7 of
                                           { (# ipv4_a4K5, ipv5_X8 #) ->
                                           case writeMutVar#
                                                  ipv3_a4Kl
                                                  (\ (x1_a42n :: [()]) ->
                                                     ipv5_X8 (: x_a42i x1_a42n))
                                                  ipv4_a4K5
                                           of s2#_a4KW
                                           { __DEFAULT ->
                                           loop_s4LK ds8_d4Ic ds9_d4Id s2#_a4KW
                                           }
                                           };
                                     loop_s4LK
                                       :: Pos
                                          -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                                          -> STRep RealWorld (Maybe ())
                                     loop_s4LK
                                       = \ (ds8_d4Ia :: Pos)
                                           (ds9_d4Ib
                                              :: (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N))
                                           (eta3_X6 :: State# RealWorld) ->
                                           self_s4LC
                                             (lvl4_s4MG `cast` <Co:30> :: ...)
                                             ((\ (ds10_d4Ii :: Pos)
                                                 (ds11_d4Ij
                                                    :: (DynRep ByteString |> (TYPE
                                                                                (D:R:RepKind[3]))_N))
                                                 (eta4_X7 :: State# RealWorld) ->
                                                 case ==#
                                                        (ds9_d4Ib `cast` <Co:16> :: ...)
                                                        (ds11_d4Ij `cast` <Co:16> :: ...)
                                                 of {
                                                   __DEFAULT ->
                                                     handler_s4LI ds10_d4Ii ds11_d4Ij eta4_X7;
                                                   1# ->
                                                     case <#
                                                            (ds9_d4Ib `cast` <Co:16> :: ...)
                                                            ww2_s4Ou
                                                     of {
                                                       __DEFAULT -> case lvl1_r4OE of wild1_00 { };
                                                       0# -> handler_s4LI ds8_d4Ia ds9_d4Ib eta4_X7;
                                                       1# ->
                                                         case readWord8OffAddr#
                                                                (plusAddr#
                                                                   ww_s4Os
                                                                   (ds9_d4Ib `cast` <Co:16> :: ...))
                                                                0#
                                                                realWorld#
                                                         of
                                                         { (# ipv4_X9, ipv5_Xa #) ->
                                                         case touch# ww1_s4Ot ipv4_X9 of
                                                         { __DEFAULT ->
                                                         case chr#
                                                                (word2Int# (word8ToWord# ipv5_Xa))
                                                         of {
                                                           __DEFAULT ->
                                                             handler_s4LI ds8_d4Ia ds9_d4Ib eta4_X7;
                                                           ')'# ->
                                                             case readMutVar# ipv3_a4Kl eta4_X7 of
                                                             { (# ipv6_a4K5, ipv7_Xd #) ->
                                                             $wsub1_s4NK
                                                               ret_a41j
                                                               (plusWord# ds8_d4Ia 1##)
                                                               ((+#
                                                                   (ds9_d4Ib `cast` <Co:16> :: ...)
                                                                   1#)
                                                                `cast` <Co:15> :: ...)
                                                               ipv6_a4K5
                                                             }
                                                         }
                                                         }
                                                         }
                                                     }
                                                 })
                                              `cast` <Co:26> :: ...)
                                             ds8_d4Ia
                                             ds9_d4Ib
                                             eta3_X6; } in
                                   loop_s4LK ds5_s4Od ds6_s4Oe ipv2_a4Kk
                                   } } in
                           let {
                             lvl4_s4MK
                               :: ()
                                  -> Pos
                                  -> (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N)
                                  -> State# RealWorld
                                  -> (# State# RealWorld, Maybe () #)
                             lvl4_s4MK
                               = \ _
                                   (ds5_s4Od :: Pos)
                                   (ds6_s4Oe :: (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N))
                                   (s1_s4Of :: State# RealWorld) ->
                                   $wlvl_s4Oh ds5_s4Od ds6_s4Oe s1_s4Of } in
                           $wsub1_s4NK
                             ((\ _
                                 (eta3_X5 :: Pos)
                                 (eta4_B1 :: (DynRep ByteString |> (TYPE (D:R:RepKind[3]))_N))
                                 (eta5_B2 :: State# RealWorld) ->
                                 self_s4LC
                                   (lvl4_s4MK `cast` <Co:29> :: ...)
                                   (handler_s4LI `cast` <Co:26> :: ...)
                                   eta3_X5
                                   eta4_B1
                                   eta5_B2)
                              `cast` <Co:29> :: ...)
                             (plusWord# ds_d4I4 1##)
                             ((+# (ds1_d4I5 `cast` <Co:16> :: ...) 1#) `cast` <Co:15> :: ...)
                             eta2_B0
                       }
                       }
                       }
                   }; } in
           case self_s4LC
                  ((\ _ _ (ds1_d4HV :: Int#) (eta2_B0 :: State# RealWorld) ->
                      case <# ds1_d4HV ww2_s4Ou of {
                        __DEFAULT -> case lvl1_r4OE of wild_00 { };
                        0# -> (# eta2_B0, lvl2_r4OH #);
                        1# ->
                          case readWord8OffAddr# (plusAddr# ww_s4Os ds1_d4HV) 0# realWorld#
                          of
                          { (# ipv_s4Jr, ipv1_s4Js #) ->
                          case touch# ww1_s4Ot ipv_s4Jr of { __DEFAULT ->
                          (# eta2_B0, Nothing #)
                          }
                          }
                      })
                   `cast` <Co:14> :: ...)
                  (lvl3_r4OI `cast` <Co:11> :: ...)
                  4294967297##
                  (0# `cast` <Co:15> :: ...)
                  s_a4JF
           of
           { (# ipv_a4JJ, ipv1_a4JK #) ->
           ipv1_a4JK
           })

runSexp :: ByteString -> Maybe ()
runSexp
  = \ (input_s4Oq :: ByteString) ->
      case input_s4Oq of { BS ww_s4Os ww1_s4Ot ww2_s4Ou ->
      $wrunSexp ww_s4Os ww1_s4Ot ww2_s4Ou
      }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment