[Haskell-cafe] Non-derivable Typeable

2013-01-22 Thread Roman Cheplyaka
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 ___

Re: [Haskell-cafe] Non-derivable Typeable

2013-01-22 Thread José Pedro Magalhães
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

Re: [Haskell-cafe] Non-derivable Typeable

2013-01-22 Thread Roman Cheplyaka
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

Re: [Haskell-cafe] Non-derivable Typeable

2013-01-22 Thread Roman Cheplyaka
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

Re: [Haskell-cafe] Non-derivable Typeable

2013-01-22 Thread José Pedro Magalhães
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

Re: [Haskell-cafe] Non-derivable Typeable

2013-01-22 Thread Roman Cheplyaka
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: > >

Re: [Haskell-cafe] Mobile app development?

2013-01-22 Thread Stefan Kersten
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

Re: [Haskell-cafe] [Haskell] ANNOUNCE: MFlow 0.2

2013-01-22 Thread Heinrich Apfelmus
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 _

Re: [Haskell-cafe] Mobile app development?

2013-01-22 Thread Andrew Pennebaker
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

Re: [Haskell-cafe] Mobile app development?

2013-01-22 Thread Brandon Allbery
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

Re: [Haskell-cafe] ANN: Haskell bindings for the igraph C library

2013-01-22 Thread George Giorgidze
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

Re: [Haskell-cafe] ANN: Haskell bindings for the igraph C library

2013-01-22 Thread Jason Dagit
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

[Haskell-cafe] ANN: monad-bool 0.1

2013-01-22 Thread John Wiegley
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

Re: [Haskell-cafe] [Haskell] ANN: monad-bool 0.1

2013-01-22 Thread Henning Thielemann
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

Re: [Haskell-cafe] ANN: monad-bool 0.1

2013-01-22 Thread Conrad Parker
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

Re: [Haskell-cafe] ANN: monad-bool 0.1

2013-01-22 Thread Roman Cheplyaka
* 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:

Re: [Haskell-cafe] [Haskell] ANN: monad-bool 0.1

2013-01-22 Thread John Wiegley
> 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

Re: [Haskell-cafe] ANN: monad-bool 0.1

2013-01-22 Thread John Wiegley
> 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

Re: [Haskell-cafe] Mobile app development?

2013-01-22 Thread Kristopher Micinski
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

Re: [Haskell-cafe] ANN: monad-bool 0.1

2013-01-22 Thread Conrad Parker
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

Re: [Haskell-cafe] ANN: monad-bool 0.1

2013-01-22 Thread Ertugrul Söylemez
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

Re: [Haskell-cafe] ANN: monad-bool 0.1

2013-01-22 Thread John Wiegley
> 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

Re: [Haskell-cafe] ANN: monad-bool 0.1

2013-01-22 Thread John Wiegley
> 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

Re: [Haskell-cafe] ANN: monad-bool 0.1

2013-01-22 Thread John Wiegley
> 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

Re: [Haskell-cafe] ANN: monad-bool 0.1

2013-01-22 Thread John Wiegley
> 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

Re: [Haskell-cafe] ANN: monad-bool 0.1

2013-01-22 Thread Ertugrul Söylemez
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 ___