Gentoo Archives: gentoo-commits

From: "Sergei Trofimovich (slyfox)" <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-haskell/alex/files: alex-3.1.4-ghc-7.10.patch
Date: Mon, 01 Jun 2015 20:45:51
Message-Id: 20150601204545.5FDD5A19@oystercatcher.gentoo.org
1 slyfox 15/06/01 20:45:45
2
3 Added: alex-3.1.4-ghc-7.10.patch
4 Log:
5 Port to upcoming ghc-7.10.
6
7 (Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key 611FF3AA)
8
9 Revision Changes Path
10 1.1 dev-haskell/alex/files/alex-3.1.4-ghc-7.10.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-haskell/alex/files/alex-3.1.4-ghc-7.10.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-haskell/alex/files/alex-3.1.4-ghc-7.10.patch?rev=1.1&content-type=text/plain
14
15 Index: alex-3.1.4-ghc-7.10.patch
16 ===================================================================
17 diff --git a/templates/wrappers.hs b/templates/wrappers.hs
18 index a1a1a6d..c020cc7 100644
19 --- a/templates/wrappers.hs
20 +++ b/templates/wrappers.hs
21 @@ -284,6 +284,19 @@ runAlex input (Alex f)
22
23 newtype Alex a = Alex { unAlex :: AlexState -> Either String (AlexState, a) }
24
25 +instance Functor Alex where
26 + fmap f a = Alex $ \s -> case unAlex a s of
27 + Left msg -> Left msg
28 + Right (s', a') -> Right (s', f a')
29 +
30 +instance Applicative Alex where
31 + pure a = Alex $ \s -> Right (s, a)
32 + fa <*> a = Alex $ \s -> case unAlex fa s of
33 + Left msg -> Left msg
34 + Right (s', f) -> case unAlex a s' of
35 + Left msg -> Left msg
36 + Right (s'', b) -> Right (s'', f b)
37 +
38 instance Monad Alex where
39 m >>= k = Alex $ \s -> case unAlex m s of
40 Left msg -> Left msg