shithub: MicroHs

Download patch

ref: c30577d2e7251c9693d136c5ce4477d6cd277a74
parent: eeca3858929746ef5c5648756fac99f930cd859b
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Sun Oct 22 15:37:42 EDT 2023

Use some Eq functions.

--- a/src/MicroHs/Interactive.hs
+++ b/src/MicroHs/Interactive.hs
@@ -1,5 +1,6 @@
 module MicroHs.Interactive(module MicroHs.Interactive) where
 import Prelude
+--Ximport Data.List
 import Control.DeepSeq
 import Control.Exception
 import qualified MicroHs.StateIO as S
@@ -49,7 +50,7 @@
   case words s of
     [] -> S.return True
     c : ws ->
-      case filter (isPrefixOfBy eqChar c . fst) commands of
+      case filter (isPrefixOf c . fst) commands of
         [] -> S.do
           S.liftIO $ putStrLn "Unrecognized command"
           S.return True
@@ -68,7 +69,7 @@
       S.return True
     )
   , ("delete", \ del -> S.do
-      updateLines (unlines . filter (not . isPrefixOfBy eqChar del) . lines)
+      updateLines (unlines . filter (not . isPrefixOf del) . lines)
       S.return True
     )
   , ("help", \ _ -> S.do
--- a/src/MicroHs/Main.hs
+++ b/src/MicroHs/Main.hs
@@ -4,6 +4,7 @@
 module MicroHs.Main(main) where
 import Prelude
 import qualified MicroHs.IdentMap as M
+--Ximport Data.List
 import Data.Maybe
 import System.Environment
 import MicroHs.Compile
@@ -21,8 +22,8 @@
     ss = filter (not . (eqString "-") . take 1) args
     flags = Flags (length (filter (eqString "-v") args))
                   (elemBy eqString "-r" args)
-                  ("." : catMaybes (map (stripPrefixBy eqChar "-i") args))
-                  (head $ catMaybes (map (stripPrefixBy eqChar "-o") args) ++ ["out.comb"])
+                  ("." : catMaybes (map (stripPrefix "-i") args))
+                  (head $ catMaybes (map (stripPrefix "-o") args) ++ ["out.comb"])
   case ss of
     [] -> mainInteractive flags
     [s] -> mainCompile flags (mkIdent s)
--