<div dir="ltr">what version of cabal-install are you using?</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 23, 2014 at 10:46 AM, Dominic Steinitz <span dir="ltr"><<a href="mailto:dominic@steinitz.org" target="_blank">dominic@steinitz.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok I have a cut down version of the problem and am cross posting to glasgow-haskell-users.<br>
<br>
To restate the problem: this is from code that has not been changed for 2 years. I get<br>
<br>
> Examples.hs:42:42: Parse error in pattern: con<br>
> Failed, modules loaded: none.<br>
<br>
Any help would be very gratefully received.<br>
<br>
> {-# LANGUAGE         TypeFamilies, MultiParamTypeClasses, FunctionalDependencies #-}<br>
> {-# LANGUAGE         FlexibleContexts #-}<br>
> {-# LANGUAGE         EmptyDataDecls #-}<br>
> {-# LANGUAGE         FlexibleInstances, TypeSynonymInstances #-}<br>
> {-# LANGUAGE         UndecidableInstances, OverlappingInstances #-}<br>
> {-# LANGUAGE         GeneralizedNewtypeDeriving, StandaloneDeriving #-}<br>
> {-# LANGUAGE         RankNTypes, ScopedTypeVariables #-}<br>
> {-# LANGUAGE         MagicHash, BangPatterns, UnboxedTuples #-}<br>
> {-# LANGUAGE         TemplateHaskell, CPP #-}<br>
><br>
> module Examples where<br>
><br>
> import GHC.Prim<br>
> import GHC.Exts<br>
> import GHC.Types<br>
> import GHC.Word<br>
> import GHC.Int<br>
><br>
> class Touchable a where<br>
>     touch :: a -> IO ()<br>
><br>
> instance Touchable Bool where<br>
>     touch b = IO (\s -> case touch# b s of s' -> (# s', () #))<br>
>     {-# INLINE touch #-}<br>
><br>
> #define TOUCHABLE_INST(ty,con)                                          \<br>
> instance Touchable ty where {                                           \<br>
>     touch (con x#) = IO (\s -> case touch# x# s of s' -> (# s', () #)); \<br>
>     {-# INLINE touch #-};                                               \<br>
> }<br>
><br>
> TOUCHABLE_INST(Int, I#)<br>
><br>
> #define PRIM_COMP_INST(ty,con,le,ge)                                 \<br>
> instance PrimitiveOrd ty where {                                     \<br>
>     minM' (con a#) (con b#) =                                        \<br>
>         IO (\s ->                                                    \<br>
>             let r# = if le a# b# then a# else b#                     \<br>
>             in case touch# r# s of s' -> (# s', (con r#) #));        \<br>
> }<br>
><br>
> PRIM_COMP_INST(Int, I#, (<=#), (>=#))<br>
<br>
Dominic Steinitz<br>
<a href="mailto:dominic@steinitz.org">dominic@steinitz.org</a><br>
<a href="http://idontgetoutmuch.wordpress.com" target="_blank">http://idontgetoutmuch.wordpress.com</a><br>
<br>
On 23 Dec 2014, at 15:06, Dominic Steinitz <<a href="mailto:dominic@steinitz.org">dominic@steinitz.org</a>> wrote:<br>
<br>
> Hi Erik,<br>
><br>
> Thank you very much. With that clue the compilation now doesn’t fail at that particular point.<br>
><br>
> The bad news is it now fails to compile this module<br>
><br>
> <a href="https://hackage.haskell.org/package/yarr-1.3.2/docs/src/Data-Yarr-Utils-Primitive.html#clampM%27" target="_blank">https://hackage.haskell.org/package/yarr-1.3.2/docs/src/Data-Yarr-Utils-Primitive.html#clampM%27</a><br>
><br>
> with a parse error(!). Not only do I not have much experience with TH but this has now exposed my ignorance of CPP.<br>
><br>
>> Data/Yarr/Utils/Primitive.hs:119:126: Parse error in pattern: con<br>
><br>
> If I comment out the last four lines<br>
><br>
>> PRIM_COMP_INST(Int, I#, (<=#), (>=#))<br>
>> PRIM_COMP_INST(Char, C#, leChar#, geChar#)<br>
>> PRIM_COMP_INST(Word, W#, leWord#, geWord#)<br>
>> PRIM_COMP_INST(Double, D#, (<=##), (>=##))<br>
>> PRIM_COMP_INST(Float, F#, leFloat#, geFloat#)<br>
><br>
> then the module compiles but of course then the whole package does *not* compile.<br>
><br>
> Did something change in 7.8.3 with regard to CPP (this code has not been modified for at least two years)?<br>
><br>
> Thanks once again.<br>
><br>
> Dominic Steinitz<br>
> <a href="mailto:dominic@steinitz.org">dominic@steinitz.org</a><br>
> <a href="http://idontgetoutmuch.wordpress.com" target="_blank">http://idontgetoutmuch.wordpress.com</a><br>
><br>
> On 23 Dec 2014, at 13:42, Erik Hesselink <<a href="mailto:hesselink@gmail.com">hesselink@gmail.com</a>> wrote:<br>
><br>
>> Hi Dominic,<br>
>><br>
>> It looks like just a representation change: a TySynEqn is a data type<br>
>> containing a [Type] and a Type, and those were the original two<br>
>> arguments. So it looks like with a little bit of CPP, you could<br>
>> support both versions. Something like<br>
>><br>
>> #if MIN_VERSION_template_haskell(2,9,0)<br>
>> ...<br>
>> #else<br>
>> ...<br>
>> #endif<br>
>><br>
>> In general, I think each major release of template haskell has quite<br>
>> some breaking changes, but I don't know of any place where they're<br>
>> enumerated. The GHC changelog only has a couple of high level bullet<br>
>> points.<br>
>><br>
>> Regards,<br>
>><br>
>> Erik<br>
>><br>
>> On Tue, Dec 23, 2014 at 2:20 PM, Dominic Steinitz <<a href="mailto:dominic@steinitz.org">dominic@steinitz.org</a>> wrote:<br>
>>> I realise I should have sent this to the libraries list.<br>
>>><br>
>>> Dominic Steinitz<br>
>>> <a href="mailto:dominic@steinitz.org">dominic@steinitz.org</a><br>
>>> <a href="http://idontgetoutmuch.wordpress.com" target="_blank">http://idontgetoutmuch.wordpress.com</a><br>
>>><br>
>>> Begin forwarded message:<br>
>>><br>
>>> From: Dominic Steinitz <<a href="mailto:dominic@steinitz.org">dominic@steinitz.org</a>><br>
>>> Subject: Latest Template Haskell Breaks Package<br>
>>> Date: 23 December 2014 13:14:26 GMT<br>
>>> To: Haskell-Cafe <<a href="mailto:haskell-cafe@haskell.org">haskell-cafe@haskell.org</a>><br>
>>><br>
>>> Hello Fellow Haskellers,<br>
>>><br>
>>> I have become a maintainer for yarr<br>
>>> (<a href="https://hackage.haskell.org/package/yarr" target="_blank">https://hackage.haskell.org/package/yarr</a>). This no longer compiles with<br>
>>> ghc-7.8.3 because it specifies base == 4.6. Relaxing this to base >=4.6 &&<br>
>>> <4.8 tells me I need a newer version of Template Haskell<br>
>>><br>
>>> rejecting: template-haskell-2.7.0.0, 2.6.0.0, 2.5.0.0, 2.4.0.1, 2.4.0.0,<br>
>>> 2.3.0.1, 2.3.0.0, 2.2.0.0 (conflict: yarr => template-haskell>=2.8 && <2.9)<br>
>>><br>
>>><br>
>>> If I now relax the constraint for Template Haskell I get a compiler error as<br>
>>> there has been a breaking change from Template Haskell 2.9 to 2.10.<br>
>>><br>
>>> Data/Yarr/Utils/FixedVector/VecTuple.hs:45:16:<br>
>>>   Couldn't match expected type ‘TypeQ -> Q Dec’<br>
>>>               with actual type ‘Q Dec’<br>
>>>   The function ‘tySynInstD’ is applied to three arguments,<br>
>>>   but its type ‘Name -> TySynEqnQ -> DecQ’ has only two<br>
>>><br>
>>><br>
>>> And indeed looking at the changes in<br>
>>> <a href="http://git.haskell.org/packages/template-haskell.git/commitdiff/ccd7891c536b29b8bea96eb92520f46e21390e39" target="_blank">http://git.haskell.org/packages/template-haskell.git/commitdiff/ccd7891c536b29b8bea96eb92520f46e21390e39</a><br>
>>> I can see that the function in question has changed.<br>
>>><br>
>>> -tySynInstD :: Name -> [TypeQ] -> TypeQ -> DecQ<br>
>>> -tySynInstD tc tys rhs =<br>
>>> +tySynInstD :: Name -> [TySynEqnQ] -> DecQ<br>
>>> +tySynInstD tc eqns =<br>
>>><br>
>>><br>
>>> Did I miss some announcement of this breaking change and the advice on what<br>
>>> to do about it?<br>
>>><br>
>>> If I did can someone please point me at the relevant document. If not then I<br>
>>> feel sad and would be very grateful if someone could help me as I know very<br>
>>> little about Template Haskell.<br>
>>><br>
>>> Many thanks<br>
>>><br>
>>> Dominic Steinitz<br>
>>> <a href="mailto:dominic@steinitz.org">dominic@steinitz.org</a><br>
>>> <a href="http://idontgetoutmuch.wordpress.com" target="_blank">http://idontgetoutmuch.wordpress.com</a><br>
>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> Libraries mailing list<br>
>>> <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
>>> <a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
>>><br>
><br>
<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
</blockquote></div><br></div>