Strafunski

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Strafunski

C.M.Brown
Hi,

I am trying to use Strafunski with GHC 6.5 and was wondering if  
someone could help me. I have all the instances for Term and Typeable  
defined for my data types, but when I try to compile with GHC 6.5 I  
get lots of "overlapping instance" errors. In particular, it seems  
the instances I am using (generated by DrIFT) are clashing with the  
ones in Data.Typeable. Is there a way I can fix this?

Also I have heard that it is possible to add "deriving Typeable" to  
each data type and I don't need to use the instances I have created.  
However, now it complains that it can't find instances for Term - but  
I can't derive from Term. Does anyone have any ideas how I can get  
Strafunski working with GHC 6.5?

Thanks.

Chris.



Christopher Brown
PhD Student, University of Kent.
http://www.cs.kent.ac.uk/people/rpg/cmb21/
[hidden email]



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Strafunski

Christian Maeder
Christopher Brown wrote:
> Hi,
>
> I am trying to use Strafunski with GHC 6.5 and was wondering if  someone
> could help me. I have all the instances for Term and Typeable  defined
> for my data types, but when I try to compile with GHC 6.5 I  get lots of
> "overlapping instance" errors. In particular, it seems  the instances I
> am using (generated by DrIFT) are clashing with the  ones in
> Data.Typeable. Is there a way I can fix this?

Did you try the switch -fallow-overlapping-instances when compiling?

Cheers Christian
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Strafunski

C.M.Brown
Christian,

>
> Did you try the switch -fallow-overlapping-instances when compiling?

Yes, but it doesn't seem to make much difference.

Cheers,
Chris.

>
> Cheers Christian

Christopher Brown
PhD Student, University of Kent.
http://www.cs.kent.ac.uk/people/rpg/cmb21/
[hidden email]



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Re: Strafunski

Bulat Ziganshin-2
Hello Christopher,

the trick is that there is another approach to generics, largely based
on the Strafunski. it's named "scrap your boilerplate!" (SYB) and it's
implementation is included in ghc. you can find 3 SYB papers and it
seems better to just learn and use this approach to generic
programming instead of Strafunski. in this case you will got
automatic Typeable derivation, among other things

--
Best regards,
 Bulat                            mailto:[hidden email]

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Strafunski

Joost Visser
In reply to this post by C.M.Brown
Hi Chris,

Changes in the libraries of GHC have broken Strafunski compatibility  
in the past. I have not upgraded to GHC 6.5 myself so I'm not sure if  
this is the case again. Which versions of DrIFT and Strafunski are  
you using?

Based on what you write, it seems new instances for Typeable have  
been added to the libs (possibly using deriving), which means some of  
your own instances are now redundant. You'll have to remove them  
(which will then break compatibility of your code with 6.4.1, sigh).

Alternatively, you may consider to switch from the "drift-default"  
mode of Strafunski to the "deriving" mode. This means that you will  
be relying on the Typeable+Data classes rather than on the Typeable
+Term classes. You make the switch simply by changing the search  
path, all your strategic functions should work like before. I guess  
GHC 6.5 supports deriving both for Typeable and Data (personally, I  
prefer to use DriFT rather than the deriving clause, because it gives  
me a bit more control over visibility of instances). For details, see  
the section "Supported models of functional strategies" in the README  
file of StrategyLib.

Regards,
Joost

--
Dr. ir. Joost Visser   | Departamento de Inform├ítica
phone  +351-253-604461 | Universidade do Minho
fax    +351-253-604471 | mailto:[hidden email]
mobile +351-91-6253618 | http://www.di.uminho.pt/~joost.visser


On Apr 3, 2006, at 3:41 PM, Christopher Brown wrote:

> Hi,
>
> I am trying to use Strafunski with GHC 6.5 and was wondering if  
> someone could help me. I have all the instances for Term and  
> Typeable defined for my data types, but when I try to compile with  
> GHC 6.5 I get lots of "overlapping instance" errors. In particular,  
> it seems the instances I am using (generated by DrIFT) are clashing  
> with the ones in Data.Typeable. Is there a way I can fix this?
>
> Also I have heard that it is possible to add "deriving Typeable" to  
> each data type and I don't need to use the instances I have  
> created. However, now it complains that it can't find instances for  
> Term - but I can't derive from Term. Does anyone have any ideas how  
> I can get Strafunski working with GHC 6.5?
>
> Thanks.
>
> Chris.
>
>
>
> Christopher Brown
> PhD Student, University of Kent.
> http://www.cs.kent.ac.uk/people/rpg/cmb21/
> [hidden email]
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Strafunski/overlapping instances in ghc-6.5

Christian Maeder
In reply to this post by C.M.Brown
Christopher Brown wrote:
> Christian,
>
>>
>> Did you try the switch -fallow-overlapping-instances when compiling?
>
> Yes, but it doesn't seem to make much difference.

Maybe a couple of more library files have not been translated with the
above flag.

http://article.gmane.org/gmane.comp.lang.haskell.glasgow.bugs/3625

In fact I became a problem with a Show instance and ghc-6.5.20060211

Christian

OMDoc/HetsDefs.hs:649:0:
     Overlapping instances for Show AllMaps
       arising from use of `GHC.Show.$dmshowList' at OMDoc/HetsDefs.hs:649:0
     Matching instances:
       instance (Show a, Show b, Show c, Show d, Show e, Show f) =>
                Show (a, b, c, d, e, f)
         -- Imported from GHC.Show
       instance [overlap ok] Show AllMaps
         -- Defined at OMDoc/HetsDefs.hs:649:0
     In the expression: GHC.Show.$dmshowList
     In the definition of `showList': showList = GHC.Show.$dmshowList
     In the definition for method `showList'
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: Strafunski

C.M.Brown
In reply to this post by Joost Visser
Joost,

Thanks very much - this solved my problem!

Cheers

Chris.

On 3 Apr 2006, at 17:03, Joost Visser wrote:

> Hi Chris,
>
> Changes in the libraries of GHC have broken Strafunski  
> compatibility in the past. I have not upgraded to GHC 6.5 myself so  
> I'm not sure if this is the case again. Which versions of DrIFT and  
> Strafunski are you using?
>
> Based on what you write, it seems new instances for Typeable have  
> been added to the libs (possibly using deriving), which means some  
> of your own instances are now redundant. You'll have to remove them  
> (which will then break compatibility of your code with 6.4.1, sigh).
>
> Alternatively, you may consider to switch from the "drift-default"  
> mode of Strafunski to the "deriving" mode. This means that you will  
> be relying on the Typeable+Data classes rather than on the Typeable
> +Term classes. You make the switch simply by changing the search  
> path, all your strategic functions should work like before. I guess  
> GHC 6.5 supports deriving both for Typeable and Data (personally, I  
> prefer to use DriFT rather than the deriving clause, because it  
> gives me a bit more control over visibility of instances). For  
> details, see the section "Supported models of functional  
> strategies" in the README file of StrategyLib.
>
> Regards,
> Joost
>
> --
> Dr. ir. Joost Visser   | Departamento de Inform├ítica
> phone  +351-253-604461 | Universidade do Minho
> fax    +351-253-604471 | mailto:[hidden email]
> mobile +351-91-6253618 | http://www.di.uminho.pt/~joost.visser
>
>
> On Apr 3, 2006, at 3:41 PM, Christopher Brown wrote:
>
>> Hi,
>>
>> I am trying to use Strafunski with GHC 6.5 and was wondering if  
>> someone could help me. I have all the instances for Term and  
>> Typeable defined for my data types, but when I try to compile with  
>> GHC 6.5 I get lots of "overlapping instance" errors. In  
>> particular, it seems the instances I am using (generated by DrIFT)  
>> are clashing with the ones in Data.Typeable. Is there a way I can  
>> fix this?
>>
>> Also I have heard that it is possible to add "deriving Typeable"  
>> to each data type and I don't need to use the instances I have  
>> created. However, now it complains that it can't find instances  
>> for Term - but I can't derive from Term. Does anyone have any  
>> ideas how I can get Strafunski working with GHC 6.5?
>>
>> Thanks.
>>
>> Chris.
>>
>>
>>
>> Christopher Brown
>> PhD Student, University of Kent.
>> http://www.cs.kent.ac.uk/people/rpg/cmb21/
>> [hidden email]
>>
>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> [hidden email]
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

Christopher Brown
PhD Student, University of Kent.
http://www.cs.kent.ac.uk/people/rpg/cmb21/
[hidden email]



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe