Is it a bug in haskell-src-meta package?

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

Is it a bug in haskell-src-meta package?

bob zhang
Hi, all

parseExp "(,) 3 4 " =>

Right (AppE (AppE (ConE GHC.Unit.(,)) (LitE (IntegerL 3))) (LitE
(IntegerL 4)))

where's GHC.Unit.(,) ?

Many thanks

best, bob

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

Re: Is it a bug in haskell-src-meta package?

Ivan Lazar Miljenovic
On 1 September 2011 11:19, bob zhang <[hidden email]> wrote:
> Hi, all
>
> parseExp "(,) 3 4 " =>
>
> Right (AppE (AppE (ConE GHC.Unit.(,)) (LitE (IntegerL 3))) (LitE
> (IntegerL 4)))
>
> where's GHC.Unit.(,) ?

GHC.Unit (like all GHC.* modules) is an internal module used by GHC to
implement base, containers, etc.  The actual definitions of tuples in
the Prelude "come" from Data.Unit, which for GHC are just re-exported
from GHC.Unit: http://haskell.org/ghc/docs/latest/html/libraries/base/src/Data-Tuple.html

--
Ivan Lazar Miljenovic
[hidden email]
IvanMiljenovic.wordpress.com

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

Re: Is it a bug in haskell-src-meta package?

bob zhang
于 11-8-31 下午10:01, Ivan Lazar Miljenovic 写道:

> On 1 September 2011 11:19, bob zhang<[hidden email]>  wrote:
>> Hi, all
>>
>> parseExp "(,) 3 4 " =>
>>
>> Right (AppE (AppE (ConE GHC.Unit.(,)) (LitE (IntegerL 3))) (LitE
>> (IntegerL 4)))
>>
>> where's GHC.Unit.(,) ?
> GHC.Unit (like all GHC.* modules) is an internal module used by GHC to
> implement base, containers, etc.  The actual definitions of tuples in
> the Prelude "come" from Data.Unit, which for GHC are just re-exported
> from GHC.Unit: http://haskell.org/ghc/docs/latest/html/libraries/base/src/Data-Tuple.html
>
Thanks for your quick-reply.
I tried this does not work.(simplified) in quasiquoter.

import Control.Arrow
import Control.Applicative
import Prelude hiding ((.), id)
import Control.Monad
import Control.Category
import Data.Derive.All
import Data.DeriveTH
import Test.QuickCheck

import Language.Haskell.TH.Quote
import Language.Haskell.TH.Syntax

import Language.Haskell.TH.Lib
import Language.Haskell.Meta

hs = QuasiQuoter { quoteExp = either fail return . parseExp }
---- top-level-------
[hs| (,) 3 4 |] will not compile
do you know how to fix it ?

Thank you !
Best, bob


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

Re: Is it a bug in haskell-src-meta package?

bob zhang
In reply to this post by Ivan Lazar Miljenovic
于 11-8-31 下午10:01, Ivan Lazar Miljenovic 写道:

> On 1 September 2011 11:19, bob zhang<[hidden email]>  wrote:
>> Hi, all
>>
>> parseExp "(,) 3 4 " =>
>>
>> Right (AppE (AppE (ConE GHC.Unit.(,)) (LitE (IntegerL 3))) (LitE
>> (IntegerL 4)))
>>
>> where's GHC.Unit.(,) ?
> GHC.Unit (like all GHC.* modules) is an internal module used by GHC to
> implement base, containers, etc.  The actual definitions of tuples in
> the Prelude "come" from Data.Unit, which for GHC are just re-exported
> from GHC.Unit: http://haskell.org/ghc/docs/latest/html/libraries/base/src/Data-Tuple.html
>
Hi, I tried
    ghc-pkg find-module GHC.Unit --> ghc-prim-0.2.0
:browse GHC.Unit
data () = ()

could not find the function (,) exposed,  thanks



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

Re: Is it a bug in haskell-src-meta package?

Ivan Lazar Miljenovic
On 1 September 2011 12:29, bob zhang <[hidden email]> wrote:

> 于 11-8-31 下午10:01, Ivan Lazar Miljenovic 写道:
>>
>> On 1 September 2011 11:19, bob zhang<[hidden email]>  wrote:
>>>
>>> Hi, all
>>>
>>> parseExp "(,) 3 4 " =>
>>>
>>> Right (AppE (AppE (ConE GHC.Unit.(,)) (LitE (IntegerL 3))) (LitE
>>> (IntegerL 4)))
>>>
>>> where's GHC.Unit.(,) ?
>>
>> GHC.Unit (like all GHC.* modules) is an internal module used by GHC to
>> implement base, containers, etc.  The actual definitions of tuples in
>> the Prelude "come" from Data.Unit, which for GHC are just re-exported
>> from GHC.Unit:
>> http://haskell.org/ghc/docs/latest/html/libraries/base/src/Data-Tuple.html
>>
> Hi, I tried
>   ghc-pkg find-module GHC.Unit --> ghc-prim-0.2.0
> :browse GHC.Unit
> data () = ()
>
> could not find the function (,) exposed,  thanks

Reading the source of Data.Tuple more, it seems that I misunderstood
what was going on.  GHC.Tuple [1] defines the tuples; GHC.Unit [2]
just defines ()

[1]: http://haskell.org/ghc/docs/latest/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html
[2]: http://haskell.org/ghc/docs/latest/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html

As such, this may very well be a bug somewhere, either
haskell-src-meta, template-haskell, or elsewhere.

May I ask though why you're trying to use (,) as an explicit
constructor in a quasi-quotation?

--
Ivan Lazar Miljenovic
[hidden email]
IvanMiljenovic.wordpress.com

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

Re: Is it a bug in haskell-src-meta package?

bob zhang
于 11-8-31 下午10:35, Ivan Lazar Miljenovic 写道:
> May I ask though why you're trying to use (,) as an explicit
> constructor in a quasi-quotation?
Thanks for your reply. I just  generated some code
this way, and it does not work.

this style is common in applicative functor, right?

Best, bob

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

Re: Is it a bug in haskell-src-meta package?

Jonas Almström Duregård-2
In reply to this post by bob zhang
Its a bug in haskell-src-meta. I just reported it:

https://github.com/benmachine/haskell-src-meta/issues/8

Regards,
Jonas



On 1 September 2011 03:19, bob zhang <[hidden email]> wrote:

> Hi, all
>
> parseExp "(,) 3 4 " =>
>
> Right (AppE (AppE (ConE GHC.Unit.(,)) (LitE (IntegerL 3))) (LitE
> (IntegerL 4)))
>
> where's GHC.Unit.(,) ?
>
> Many thanks
>
> best, bob
>
> _______________________________________________
> 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