Your message dated Sun, 4 Sep 2011 00:00:48 +0100
with message-id <20110903230047.GA25731@raleigh>
and subject line Re: [Pkg-haskell-maintainers] Bug#639036: agda does not build 
with alex 3
has caused the Debian Bug report #639036,
regarding does not build with alex 3
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
639036: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=639036
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: agda
Version: 2.2.10-3

I need alex 3.0.1, but agda will not build with it:

[ 73 of 211] Compiling Agda.Syntax.Parser.Lexer ( 
dist-ghc/build/Agda/Syntax/Parser/
Lexer.hs, dist-ghc/build/Agda/Syntax/Parser/Lexer.o )

dist-ghc/build/Agda/Syntax/Parser/Lexer.hs:315:22:
    Not in scope: `alexGetByte'

dist-ghc/build/Agda/Syntax/Parser/Lexer.hs:349:8:
    Not in scope: `alexGetByte'
make: *** [build-ghc-stamp] Error 1



--- End Message ---
--- Begin Message ---
Version: 2.2.10-4

Hi there Ulf,

On Wed, Aug 24, 2011 at 03:06:56PM +0000, Clint Adams wrote:
> On Wed, Aug 24, 2011 at 08:05:35AM +0200, Ulf Norell wrote:
> > Yes. Or rather, there are plans to check out alex 3 to see how
> > much work it would be.
> 
> Great, thanks!

So I just wrote a patch to fix this (I hope). The interface required of
a lexer changed in alex 3 to require you to provide alexGetByte ::
AlexInput -> Maybe (Word8, AlexInput). I just use ord to convert from
the char, so the old alexGetChar can remain for alex 2.x compatibility.
You might want to invert the logic though and store the Word8 directly
in AlexInput.

Anyway, it's attached.

Cheers,

-- 
Iain Lane                                  [ [email protected] ]
Debian Developer                                   [ [email protected] ]
Ubuntu Developer                                   [ [email protected] ]
PhD student                                       [ [email protected] ]
From: Iain Lane <[email protected]>
Date: Sat, 3 Sep 2011 22:01:39 +0100
Subject: Add an alexGetByte function for alex-3.0 compatibility

---
 Agda.cabal                          |    2 +-
 src/full/Agda/Syntax/Parser/Alex.hs |   13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/Agda.cabal b/Agda.cabal
index 3d65b4c..a4fdc37 100644
--- a/Agda.cabal
+++ b/Agda.cabal
@@ -92,7 +92,7 @@ library
                     xhtml == 3000.2.*,
                     syb >= 0.1 && < 0.4
   build-tools:      happy >= 1.15 && < 2,
-                    alex >= 2.0.1 && < 3
+                    alex >= 2.0.1
   extensions:       CPP
   exposed-modules:  Agda.Main
                     Agda.ImpossibleTest
diff --git a/src/full/Agda/Syntax/Parser/Alex.hs b/src/full/Agda/Syntax/Parser/Alex.hs
index 603944b..b53ecad 100644
--- a/src/full/Agda/Syntax/Parser/Alex.hs
+++ b/src/full/Agda/Syntax/Parser/Alex.hs
@@ -6,6 +6,7 @@ module Agda.Syntax.Parser.Alex
     ( -- * Alex requirements
       AlexInput(..)
     , alexInputPrevChar
+    , alexGetByte
     , alexGetChar
       -- * Lex actions
     , LexAction, LexPredicate
@@ -17,6 +18,8 @@ module Agda.Syntax.Parser.Alex
     where
 
 import Control.Monad.State
+import Data.Word (Word8)
+import Data.Char (ord)
 
 import Agda.Syntax.Position
 import Agda.Syntax.Parser.Monad
@@ -35,6 +38,16 @@ data AlexInput = AlexInput
 alexInputPrevChar :: AlexInput -> Char
 alexInputPrevChar = lexPrevChar
 
+-- for alex-3
+alexGetByte :: AlexInput -> Maybe (Word8, AlexInput)
+alexGetByte (AlexInput { lexInput = []  }) = Nothing
+alexGetByte (AlexInput { lexInput = c:s, lexPos = p }) =
+    Just (fromIntegral $ ord c, AlexInput
+		 { lexInput	= s
+		 , lexPos	= movePos p c
+		 , lexPrevChar	= c
+		 }
+	 )
 -- | Lex a character. No surprises.
 alexGetChar :: AlexInput -> Maybe (Char, AlexInput)
 alexGetChar (AlexInput { lexInput = []  }) = Nothing
-- 

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Reply via email to