Re: [Haskell-cafe] oauth in haskell - reviewers?

2009-08-25 Thread Diego Souza
I've found [obviously] a huge thread about licensing on haskell-c...@.
After reading [most] of it, I realized the best thing to do is change
the license and start using BSD3.

-- 
~dsouza
yahoo!im: paravinicius
gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B  9ECE F88E 067F E891 651E
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] oauth in haskell - reviewers?

2009-08-25 Thread Don Stewart
robgreayer:
> On Mon, Aug 24, 2009 at 5:24 PM, Don Stewart wrote:
> > I notice hoauth is packaged as LGPL. Since we use static linking in GHC,
> > this makes it in practice GPL. Is that the intent?
> >
> > -- Don
> >
> 
> I don't think this is 100% true -- the requirement is to allow the end
> user the ability to replace the version of the library they're using
> with something else, which can be accomplished by dynamically linked
> libraries, but also means that if the rest of the program is open
> source (but not GPL), the requirement is satisfied.  LGPL is generally
> compatible with GPL-incompatible open-source, whether statically
> linked or not.  It is true it is incompatible with closed source
> licensing.
> 
> There are some real situations where this might matter -- you could
> use this library in an an executable in which the remainder of the
> source was MPL, I think, as long as there were the possibility of
> relinking with a different version of the LGPL library.  You couldn't
> do this if it were GPL.  This is the section of the LGPL that mentions
> this:
> 
> "Do one of the following:
> 
> * 0) Convey the Minimal Corresponding Source under the terms of
> this License, and the Corresponding Application Code in a form
> suitable for, and under terms that permit, the user to recombine or
> relink the Application with a modified version of the Linked Version
> to produce a modified Combined Work, in the manner specified by
> section 6 of the GNU GPL for conveying Corresponding Source.
> *1) Use a suitable shared library mechanism for linking with the
> Library. A suitable mechanism is one that (a) uses at run time a copy
> of the Library already present on the user's computer system, and (b)
> will operate properly with a modified version of the Library that is
> interface-compatible with the Linked Version."
> 
> So, Haskell libraries licensed under LGPL (without the static linking
> exception) force option 0, but that doesn't make them completely
> equivalent to GPL. At least that's my understanding (which could be
> flawed!).


That's quite true. It's not completely equivalent. It is just very
difficult to distribute your Haskell app in such a way that it can be
relinked against LGPL licensed Haskell libraries.

If the intent is that the improvements to the source remain open, and
are contributed back, but you want to allow commercial use, a different
license would be appropriate.

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] oauth in haskell - reviewers?

2009-08-25 Thread Robert Greayer
On Mon, Aug 24, 2009 at 5:24 PM, Don Stewart wrote:
> I notice hoauth is packaged as LGPL. Since we use static linking in GHC,
> this makes it in practice GPL. Is that the intent?
>
> -- Don
>

I don't think this is 100% true -- the requirement is to allow the end
user the ability to replace the version of the library they're using
with something else, which can be accomplished by dynamically linked
libraries, but also means that if the rest of the program is open
source (but not GPL), the requirement is satisfied.  LGPL is generally
compatible with GPL-incompatible open-source, whether statically
linked or not.  It is true it is incompatible with closed source
licensing.

There are some real situations where this might matter -- you could
use this library in an an executable in which the remainder of the
source was MPL, I think, as long as there were the possibility of
relinking with a different version of the LGPL library.  You couldn't
do this if it were GPL.  This is the section of the LGPL that mentions
this:

"Do one of the following:

* 0) Convey the Minimal Corresponding Source under the terms of
this License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to recombine or
relink the Application with a modified version of the Linked Version
to produce a modified Combined Work, in the manner specified by
section 6 of the GNU GPL for conveying Corresponding Source.
*1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time a copy
of the Library already present on the user's computer system, and (b)
will operate properly with a modified version of the Library that is
interface-compatible with the Linked Version."

So, Haskell libraries licensed under LGPL (without the static linking
exception) force option 0, but that doesn't make them completely
equivalent to GPL. At least that's my understanding (which could be
flawed!).

-Rob

> wei.hoo:
>> I recommend "Learn you a Haskell for great good":
>> http://learnyouahaskell.com/functors-applicative-functors-and-monoids#applicative-functors
>>
>> On Sun, Aug 23, 2009 at 12:25 PM, Diego Souza wrote:
>> > A quick search pointed me to this:
>> > http://www.soi.city.ac.uk/~ross/papers/Applicative.html
>> >
>> > Is there any other resources you would suggest me to read?
>> >
>> > Thanks at lot,
>> > --
>> > ~dsouza
>> > yahoo!im: paravinicius
>> > gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B  9ECE F88E 067F E891 651E
>> > ___
>> > Haskell-Cafe mailing list
>> > Haskell-Cafe@haskell.org
>> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>> >
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] oauth in haskell - reviewers?

2009-08-24 Thread Diego Souza
Hi Don,

no, not really, I completely missed that point. But if that is the case,
I presume there is no difference in using other licenses, like BSD3. Is
that the case?

Thanks,

On Mon, Aug 24, 2009 at 02:24:09PM -0700, Don Stewart wrote:
> I notice hoauth is packaged as LGPL. Since we use static linking in GHC,
> this makes it in practice GPL. Is that the intent?

-- 
~dsouza
yahoo!im: paravinicius
gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B  9ECE F88E 067F E891 651E
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] oauth in haskell - reviewers?

2009-08-24 Thread Don Stewart
I notice hoauth is packaged as LGPL. Since we use static linking in GHC,
this makes it in practice GPL. Is that the intent?

-- Don

wei.hoo:
> I recommend "Learn you a Haskell for great good":
> http://learnyouahaskell.com/functors-applicative-functors-and-monoids#applicative-functors
> 
> On Sun, Aug 23, 2009 at 12:25 PM, Diego Souza wrote:
> > A quick search pointed me to this:
> > http://www.soi.city.ac.uk/~ross/papers/Applicative.html
> >
> > Is there any other resources you would suggest me to read?
> >
> > Thanks at lot,
> > --
> > ~dsouza
> > yahoo!im: paravinicius
> > gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B  9ECE F88E 067F E891 651E
> > ___
> > Haskell-Cafe mailing list
> > Haskell-Cafe@haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] oauth in haskell - reviewers?

2009-08-24 Thread Wei Hu
I recommend "Learn you a Haskell for great good":
http://learnyouahaskell.com/functors-applicative-functors-and-monoids#applicative-functors

On Sun, Aug 23, 2009 at 12:25 PM, Diego Souza wrote:
> A quick search pointed me to this:
> http://www.soi.city.ac.uk/~ross/papers/Applicative.html
>
> Is there any other resources you would suggest me to read?
>
> Thanks at lot,
> --
> ~dsouza
> yahoo!im: paravinicius
> gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B  9ECE F88E 067F E891 651E
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] oauth in haskell - reviewers?

2009-08-24 Thread Diego Souza
Hi Alex,

It indeed helped a lot. I'm still reading more about
Control.Applicative, but I applied your other suggestions and they in
fact reduced duplication.

I'm going to upload it to hackage and let's see how it goes.

Thanks,
-- 
~dsouza
yahoo!im: paravinicius
gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B  9ECE F88E 067F E891 651E
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] oauth in haskell - reviewers?

2009-08-23 Thread Alexander Dunlap
On Sun, Aug 23, 2009 at 9:25 AM, Diego Souza wrote:
> Hi Alex,
>
>> - In the Token datatype, you can automatically create the accessor
>> functions (oath_token, etc.) by using named fields:
> I though about that too and I was not sure about what to do. The reason
> I didn't use it is because I don't export the value constructors of
> Token type, that is why I created the access functions explicitly.

I'm pretty sure you can export just the access functions and not the
data constructors. They're just ordinary functions with a bit of
syntactic sugar, so they can be exported even if the constructors
aren't.

>> - I think you can use join from Control.Monad and functions from
>> Control.Applicative in your "response" function to make it quite a bit
>> cleaner.
> To be honest I'm not familiar with Control.Applicative at all.  I'll
> read about it and see if I can figure how to do this.
>
> A quick search pointed me to this:
> http://www.soi.city.ac.uk/~ross/papers/Applicative.html
>
> Is there any other resources you would suggest me to read?
>

The rule of thumb I use is that you can replace

foo = do
  x1 <- action1
  x2 <- action2
  x3 <- action3
  ...
  xn <- actionn
  return (bar x1 x2 x3 ... xn)

by

foo = bar <$> action1 <*> action2 <*> action3 <*> ... <*> actionn

for any number of actions. (<$>) is a synonym for fmap and (<*>) is
the same as Control.Monad.ap if the applicative functor is also a
monad. (All monads can be made instances of Applicative, and most
[all?] of the standard ones are.)

Alex
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] oauth in haskell - reviewers?

2009-08-23 Thread Diego Souza
Hi Alex,

> - In the Token datatype, you can automatically create the accessor
> functions (oath_token, etc.) by using named fields:
I though about that too and I was not sure about what to do. The reason
I didn't use it is because I don't export the value constructors of
Token type, that is why I created the access functions explicitly.

> - When you have multiple datatype constructors with similar arguments
> (as with Token or Request), it may be better to use a Boolean-type
> flag saying which one it is (e.g. HTTP or HTTPS) and then a single
> datatype with all of the different arguments in it. This may help you
> remove code duplication elsewhere.
Right, it makes sense.

> - I think you can use join from Control.Monad and functions from
> Control.Applicative in your "response" function to make it quite a bit
> cleaner.
To be honest I'm not familiar with Control.Applicative at all.  I'll
read about it and see if I can figure how to do this.

A quick search pointed me to this:
http://www.soi.city.ac.uk/~ross/papers/Applicative.html

Is there any other resources you would suggest me to read?

Thanks at lot,
-- 
~dsouza
yahoo!im: paravinicius
gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B  9ECE F88E 067F E891 651E
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] oauth in haskell - reviewers?

2009-08-22 Thread Alexander Dunlap
On Sat, Aug 22, 2009 at 4:36 PM, Diego Souza wrote:
> Hi all,
>
> I wrote a small library in haskell do deal with oauth authentication. It
> turns out it is my first library in haskell as well. As I'm beginner in
> haskell, I'm asking for a review of someone more experienced/proficient
> before even daring to create a cabal pkg and dist it to hackage. :-)
>
> Any help/comments on this will be highly welcome.
>
> http://projects.bitforest.org/hoauth/
>
> $ darcs get http://projects.bitforest.org/hoauth/
> # should do the trick
>
> Thanks in advance,
> --
> ~dsouza
> yahoo!im: paravinicius
> gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B  9ECE F88E 067F E891 651E
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

Hi,

I'm not familiar at all with OAuth but I have some general suggestions
that might make your code in "Consumer.hs" a bit nicer. These
suggestions also probably apply elsewhere in your code.

- In the Token datatype, you can automatically create the accessor
functions (oath_token, etc.) by using named fields:

data Token
  = Request { oath_token :: String, oath_token_secret :: String,
oath_extra :: R.Parameter }
  | Access { oath_token :: String, oath_token_secret :: String,
oath_extra :: R.Parameter }

This will create your accessor functions for free, and you get update
syntax to boot. (Google for "haskell named fields" for details.)

- When you have multiple datatype constructors with similar arguments
(as with Token or Request), it may be better to use a Boolean-type
flag saying which one it is (e.g. HTTP or HTTPS) and then a single
datatype with all of the different arguments in it. This may help you
remove code duplication elsewhere.

- I think you can use join from Control.Monad and functions from
Control.Applicative in your "response" function to make it quite a bit
cleaner.

I know this email has been a bit terse; ask if you have any questions
about the above.

Hope that helps,
Alex
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] oauth in haskell - reviewers?

2009-08-22 Thread Diego Souza
Hi all,

I wrote a small library in haskell do deal with oauth authentication. It
turns out it is my first library in haskell as well. As I'm beginner in
haskell, I'm asking for a review of someone more experienced/proficient
before even daring to create a cabal pkg and dist it to hackage. :-)

Any help/comments on this will be highly welcome.

http://projects.bitforest.org/hoauth/

$ darcs get http://projects.bitforest.org/hoauth/
# should do the trick

Thanks in advance,
-- 
~dsouza
yahoo!im: paravinicius
gpg key fingerprint: 71B8 CE21 3A6E F894 5B1B  9ECE F88E 067F E891 651E
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe