diff --git a/MyPrelude.hs b/MyPrelude.hs index 5caad81..51c7a44 100644 --- a/MyPrelude.hs +++ b/MyPrelude.hs @@ -40,3 +40,8 @@ tailInit :: [a] -> [a] tailInit xs | length xs > 2 = tail . init $ xs | otherwise = [] + + +-- |Apply a function to the first element of a tuple. +first :: (a -> b) -> (a,c) -> (b,c) +first f (x,y) = (f x, y) diff --git a/Parser/Core.hs b/Parser/Core.hs index a258311..66f620d 100644 --- a/Parser/Core.hs +++ b/Parser/Core.hs @@ -14,6 +14,7 @@ module Parser.Core (Parser, import Control.Applicative import Data.Char +import MyPrelude -- |The parser type. It allows us to create specific parsers, @@ -49,10 +50,6 @@ inParser :: ((String -> Maybe (a1, String)) inParser f p = MkParser . f . runParser $ p -first :: (a -> b) -> (a,c) -> (b,c) -first f (x,y) = (f x, y) - - -- |Creates a Parser that parses a Char depending on a given condition. satisfy :: (Char -> Bool) -- ^ condition -> Parser Char -- ^ created Parser