I need to declare a Typeable instance for a type which has an argument
of kind * -> *. GHC refuses to derive it.
What is a recommended way to go about it?
In particular, if I write the instance by hand, how important is the
fingerprint, and how could I generate it?
Roman
___
Won't it derive it with StandaloneDeriving?
Cheers,
Pedro
On Tue, Jan 22, 2013 at 1:28 PM, Roman Cheplyaka wrote:
> I need to declare a Typeable instance for a type which has an argument
> of kind * -> *. GHC refuses to derive it.
>
> What is a recommended way to go about it?
>
> In particular
It doesn't seem to — am I doing something wrong?
GHCi, version 7.6.1.20121207: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :set -XDeriveDataTy
I just found mkTyCon3 which generates the fingerprint automatically.
(I was looking at Data.Typeable.Internal.mkTyCon before.)
That answers my question.
(Of course, a way to derive the instance would be even better...)
Roman
* Roman Cheplyaka [2013-01-22 15:28:55+0200]
> I need to declare a Typ
Yes, that will work. But soon we'll have poly-kinded Typeable in HEAD,
which will be able to derive that instance.
Cheers,
Pedro
On Tue, Jan 22, 2013 at 2:34 PM, Roman Cheplyaka wrote:
> I just found mkTyCon3 which generates the fingerprint automatically.
> (I was looking at Data.Typeable.Inte
Thanks, looking forward to it!
Roman
* José Pedro Magalhães [2013-01-22 14:41:25+]
> Yes, that will work. But soon we'll have poly-kinded Typeable in HEAD,
> which will be able to derive that instance.
>
>
> Cheers,
> Pedro
>
> On Tue, Jan 22, 2013 at 2:34 PM, Roman Cheplyaka wrote:
>
>
On Jan 19, 2013, at 10:29 PM, Nathan Hüsken wrote:
> Recently I managed to get ghc to target android working (this still
> needs some work): [4].
this is great news, thanks!
> Of couse, ffi bindings for all these platforms would be needed to get
> serious.
i think that you can get quite seriou
Alberto G. Corona wrote:
The template look is very simple but it uses a lot of dynamic code behind
I changed the template to something more light.
http://haskell-web.blogspot.com.es/
Much better, thanks!
Best regards,
Heinrich Apfelmus
--
http://apfelmus.nfshost.com
_
Can we un-deprecate GHC's ability to compile to C code? C may be the best
option to bridge to mobile, as Android, iOS, and Windows RT do support
C/C++ apps.
On Jan 22, 2013 2:14 PM, "Dan Choi" wrote:
>
> What about the option of using Haskell's Parsec or AttoParsec to implement
> a Haskell-ish la
On Tue, Jan 22, 2013 at 2:40 PM, Andrew Pennebaker <
andrew.penneba...@gmail.com> wrote:
> Can we un-deprecate GHC's ability to compile to C code? C may be the best
> option to bridge to mobile, as Android, iOS, and Windows RT do support
> C/C++ apps.
>
The C code generated by GHC, except in unreg
Hi Jason,
> How does this compare with fgl? http://hackage.haskell.org/package/fgl
A couple of months ago, I was working on a project where I had to do
some graph analysis. I encountered two problems with the fgl library:
(1) The fgl library did not work for large graphs, even graph
construction
On Tue, Jan 22, 2013 at 3:20 PM, George Giorgidze wrote:
> Hi Jason,
>
> > How does this compare with fgl? http://hackage.haskell.org/package/fgl
>
> A couple of months ago, I was working on a project where I had to do
> some graph analysis. I encountered two problems with the fgl library:
>
Than
monad-bool implements a pair of Boolean monoids and monads, to support
short-circuiting, value-returning computations similar to what Python and Ruby
offer with their native && and || operators.
For example, in Python you might see this:
x = [1,2,3,0]
print x[1] || x[3] -- p
On Tue, 22 Jan 2013, John Wiegley wrote:
Use 'onlyIf' with AndM and AndMT to guard later statements, which are only
evaluated if every preceding 'onlyIf' evaluates to True. For example:
foo :: AndM Int
foo = do onlyIf (True == True)
return 100
onlyIf (True == Tru
On 23 January 2013 08:04, John Wiegley wrote:
> monad-bool implements a pair of Boolean monoids and monads, to support
> short-circuiting, value-returning computations similar to what Python and Ruby
> offer with their native && and || operators.
> ...
> Use 'onlyIf' with AndM and AndMT to guard l
* John Wiegley [2013-01-22 18:04:36-0600]
> monad-bool implements a pair of Boolean monoids and monads, to support
> short-circuiting, value-returning computations similar to what Python and Ruby
> offer with their native && and || operators.
Random thoughts after compiling/looking at the code:
> Henning Thielemann writes:
> Does the And monad fulfill the monad laws? In a proper monad an interim
> (return x) (without a '<-') is a no-op.
You are very right. I will make the necessary changes.
--
John Wiegley
FP Complete Haskell tools, training and consultin
> Conrad Parker writes:
> these sound powerful, but how would I do something esoteric like
> if/elseIf/endIf ?
Can you show me an example of what you'd like to express?
--
John Wiegley
FP Complete Haskell tools, training and consulting
http://fpcomplete.com
I don't believe that was really the point of the C compiler, and I'd
suspect you'd have a hard time with the runtime.
By the way, the Android APIs aren't really meant to be used by native
code: the only real use for native code in Android is GPU code and
math code (think games and DSP-type program
On 23 January 2013 09:25, John Wiegley wrote:
>> Conrad Parker writes:
>
>> these sound powerful, but how would I do something esoteric like
>> if/elseIf/endIf ?
>
> Can you show me an example of what you'd like to express?
Your examples look vaguely like an if/elseif/else block from other
l
Roman Cheplyaka wrote:
> - what do you need unsafeCoerce for?
The unsafeCoerce is needed because the library is severely broken.
Consider this:
do onlyIf False
x <- c
onlyIf True
return x
There is a good reason why Haskell's type system would never have
allowed to writ
> Roman Cheplyaka writes:
> - what do you need unsafeCoerce for?
Ok, after much discussion with edwardk and shachaf, I came to realize a few
things:
1. The functionality of my two monads 'AndM' and 'OrR' can be boiled down to
two helper functions inside EitherT:
returnIf :: Mo
> Ertugrul Söylemez writes:
> There is a good reason why Haskell's type system would never have allowed to
> write this library. I recommend the author to try again without
> unsafeCoerce. It won't work.
You are right, and in fact what I wanted to do cannot be done. It requires
distinguis
> John Wiegley writes:
> And EitherT can already do that, it just lacks a convenience function to
> make it easier (i.e, not having to write lots of nested if statements).
Never mind, when/unless + left work just fine for this.
--
John Wiegley
FP Complete Haskell to
> John Wiegley writes:
> Never mind, when/unless + left work just fine for this.
You know, it's been a humorous day.
First ekmett showed that I can't make a sane Monad instance for AndM or OrM.
Then I discovered I can't make a reasonable Monoid (no mempty, given only
'toBool'), so I droppe
John Wiegley wrote:
> And poof, all my code just disappeared...
Welcome to Haskell. =)
Greets,
Ertugrul
--
Not to be or to be and (not to be or to be and (not to be or to be and
(not to be or to be and ... that is the list monad.
signature.asc
Description: PGP signature
___
26 matches
Mail list logo