You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jesper Reenberg (JIRA)" <ji...@apache.org> on 2011/01/04 16:03:47 UTC

[jira] Commented: (THRIFT-1028) field names of structs used with wrong casing in the generated haskell code

    [ https://issues.apache.org/jira/browse/THRIFT-1028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12977301#action_12977301 ] 

Jesper Reenberg commented on THRIFT-1028:
-----------------------------------------

Ah ok, didn't look through all the closed issues.

I have cloned the dreiss github repo as I haven't really worked with svn before and didn't want to mess anything up. As far as I understand then this repo should be updated each time there is a new commit to the apache svn.  But maybe not as it has version 0.6.0-dev?

However there are multiple issues regarding the Haskell part when trying to make it.

The licence part of the update Thrift.cabal file is not valid according to my cabal: https://github.com/dreiss/thrift/blob/master/lib/hs/Thrift.cabal#L23

     /usr/bin/runhaskell Setup.lhs configure 
     Setup.lhs: Thrift.cabal:23: Parse of field 'license' failed.

When changed to something valid, ex Apache2 I only get the warnings that it is not a known license as would be expected. 
However it seems that i have three versions of network installed, which gave me a hard time when trying to compile the 0.5.0 from the tar.


     /var/lib/ghc-6.12.1/package.conf.d
        network-2.2.1.7
        network-2.3                <-- Manually hidden
    /home/jesper/.ghc/i386-linux-6.12.1/package.conf.d
        network-2.2.1.10       <-- Manually hidden

So to conpile the 0.5.0 i manually hided the 2.2.1.10 and 2.3 to make it compile.

But both the 0.5.0 tar and the dreiss git gives the following warning:

   Warning: This package indirectly depends on multiple versions of the same
   package. This is highly likely to cause a compile failure.
   package HTTP-4000.0.9 requires network-2.2.1.7
   package thrift-0.6.0 requires network-2.3


This however gave som issues when compiling from the dreiss git

   src/Thrift/Transport/HttpClient.hs:85:30:
       Couldn't match expected type `network-2.2.1.7:Network.URI.URI'
              against inferred type `URI'
       In the `rqURI' field of a record
   ......

even though the HttpClient.hs files are exactly the same
I gues that it is cabal that makes it think that it needs network-2.3 even though i have hidden it :S  But when adding the constraing network == 2.2.1.7 to Thrift.cabal made it compile.


It still doesn't work, after unregistering the old thrift package which wrongly is called Thrift-0.2.0, note the capital T whereas the new is called thrift-0.6.0
Same errors as before..

I gues I will have to try the svn and make sure. But it seems "silly" that the 0.5.0 isn't updated with these changes as it is basicly useless for Haskell. Also the configure script failed in the 0.5.0 tar due to some php that it didn't detect that wasn't present, this however is fixed in the 0.6.0-dev i got.


> field names of structs used with wrong casing in the generated haskell code
> ---------------------------------------------------------------------------
>
>                 Key: THRIFT-1028
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1028
>             Project: Thrift
>          Issue Type: Bug
>          Components: Haskell - Compiler
>    Affects Versions: 0.5
>         Environment: ghc 6.12.1, Thrift version 0.5.0, ubuntu 10.10
>            Reporter: Jesper Reenberg
>            Assignee: Christian Lavoie
>            Priority: Minor
>
> Invalid haskell code is generated using the following thrift code:
> --------------------------------------------------------
> struct Test {
>   1:string Foo,
>   3:i32 BarBaz,
>   4:i32 HestTest
> }
> service Test {
>   bool makeTest(1:Test tst, 2:double i)        
> }
> --------------------------------------------------------
> The wrong casing is generated in the record setter parts of the generated data in read_Test_fields and generation of the initial "record" in read_Test.
> The wrong casing is the first letter from the thrift struct specification always being lowercase when used in the above two generated functions.
> The generated data type is 
> data Test = Test 
>             {
>               f_Test_Foo :: Maybe String
>             , f_Test_BarBaz :: Maybe Int32
>             ,  f_Test_HestTest :: Maybe Int32
>             } 
>           deriving (Show,Eq,Ord,Typeable)
> Where it is used with the field names f_Test_foo, f_Test_barBaz and f_Test_hestTest as seen below
> read_Test iprot = do
>   _ <- readStructBegin iprot
>   record <- read_Test_fields iprot 
>             (Test{f_Test_foo=Nothing,f_Test_barBaz=Nothing,f_Test_hestTest=Nothing})
>   readStructEnd iprot
>   return record
> I have downloaded and build the 0.5.0 from http://thrift.apache.org/ and i don't know if it affect older versions as well.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.