Re: [Haskell-cafe] Stacking data types

2011-04-11 Thread Job Vranish
carte, I just found it overly complicated. Thanks for you solution, Job. However (and even if it doesn't work without it) I fail to see why you need the functional dependency on Has... Doesn't it implies here that for one 'a' there can only be one 'b' such as 'Has b a'? 2011/4/6 Job Vranish

Re: [Haskell-cafe] Stacking data types

2011-04-06 Thread Job Vranish
I think you want something like this: {-# Language MultiParamTypeClasses , FlexibleInstances , FunctionalDependencies , UndecidableInstances , FlexibleContexts , OverlappingInstances #-} data Character a = Character { life :: Int,

[Haskell-cafe] Missing MaybeT MonadFix instance

2011-04-01 Thread Job Vranish
Is there a particular reason that the transformershttp://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Control-Monad-Trans-Maybe.html#v:MaybeTversion of the MaybeT monad does not have a MonadFix instance? It seems like the following instance would be suitable: instance

Re: [Haskell-cafe] makeTokenParser + LanguageDef

2011-03-08 Thread Job Vranish
The tutorial here: http://legacy.cs.uu.nl/daan/download/parsec/parsec.html#Lexical analysis http://legacy.cs.uu.nl/daan/download/parsec/parsec.html#Lexical analysisis for parsec 2, but it's still quite relevant. - Job On Tue, Mar 8, 2011 at 6:22 AM, Hauschild, Klaus (EXT)

Re: [Haskell-cafe] Convert a function to a string of operators?

2011-03-04 Thread Job Vranish
Make your own expression type and make it an instance of the Num typeclass. Then you can build your expression using the usual operators and then use show to convert to a string. For example: https://github.com/jvranish/grhug/blob/master/SymbolicDifferentiation/SymbolicDifferentiation.hs It

Re: [Haskell-cafe] Infinite types should be optionally allowed

2011-02-22 Thread Job Vranish
Thanks, Perhaps my algorithm works then. I shall have to read up more on these things :) - Job On Mon, Feb 21, 2011 at 4:54 PM, Luke Palmer lrpal...@gmail.com wrote: On Sun, Feb 20, 2011 at 6:01 PM, Job Vranish jvran...@gmail.com wrote: My current algorithm says that neither of the types you

Re: [Haskell-cafe] monadic plumbing

2011-02-22 Thread Job Vranish
You need the MaybeT and EitherT monad transformers: http://hackage.haskell.org/packages/archive/MaybeT/0.1.2/doc/html/Control-Monad-Maybe.html http://hackage.haskell.org/packages/archive/MaybeT/0.1.2/doc/html/Control-Monad-Maybe.html

Re: [Haskell-cafe] Infinite types should be optionally allowed

2011-02-21 Thread Job Vranish
On Sun, Feb 20, 2011 at 8:56 PM, Brandon Moore brandon_m_mo...@yahoo.comwrote: Typechecking with regular types isn't hard. So do I have the right idea then? To check against a signature, I can just unify the two types and then check if the unified type is 'equivalent' (is there a special word

Re: [Haskell-cafe] Faster timeout but is it correct?

2011-02-21 Thread Job Vranish
I'm curious, is it possible that your new timeout implementation would fix this problem?: doesntWork :: Int - Int doesntWork x = last $ cycle [x] test :: IO (Maybe Bool) test = timeout 1 $ evaluate $ doesntWork 5 == 5 -- never terminates, even with the timeout From what I can gather, this

Re: [Haskell-cafe] Infinite types should be optionally allowed

2011-02-20 Thread Job Vranish
is on github here: https://github.com/jvranish/InfiniteTypes Also, is there a book you'd recommend that would explain this in further detail? Thanks, - Job On Mon, Feb 16, 2009 at 5:16 PM, Luke Palmer lrpal...@gmail.com wrote: On Sat, Feb 14, 2009 at 2:06 PM, Job Vranish jvran...@gmail.com wrote

[Haskell-cafe] Timeout exceptions sometimes don't work, even in pure (non FFI) code

2011-02-01 Thread Job Vranish
I'm trying to test some properties with quickcheck. If these tests fail, they will almost certainly fail by nontermination. I've been using the 'within' function to catch these nontermination cases. However, I was surprised to find that this doesn't always work. 'within' uses the 'timeout'

Re: [Haskell-cafe] Timeout exceptions sometimes don't work, even in pure (non FFI) code

2011-02-01 Thread Job Vranish
. This behavior is quite annoying. Thanks for your help, - Job On Tue, Feb 1, 2011 at 11:18 AM, Daniel Fischer daniel.is.fisc...@googlemail.com wrote: On Tuesday 01 February 2011 16:40:43, Job Vranish wrote: I'm trying to test some properties with quickcheck. If these tests fail

Re: [Haskell-cafe] REPL loop

2010-12-20 Thread Job Vranish
The answer is yes, but could you elaborate? What exactly are you wanting? Do you want something similar to ghci? Are you wanting to implement a REPL for some other language in haskell? REPL for haskell, in haskell? - Job On Mon, Dec 20, 2010 at 12:47 PM, Aaron Gray

Re: [Haskell-cafe] Couple of questions about *let* within *do*

2010-08-10 Thread Job Vranish
Yes, and yes :) For example: import Data.Char main = do let prompt s = do putStrLn s getLine firstName - prompt What's your first name? lastName - prompt What's your last name? let bigFirstName = map toUpper firstName bigLastName = map toUpper lastName putStrLn $ hey

Re: [Haskell-cafe] More Flexible Monad Transformer OR Bad Coding Style

2010-08-09 Thread Job Vranish
For monads like StateT, WriterT, ReaderT, the order doesn't matter (except perhaps for some pesky performance details). However, for monad transformers like ErrorT or ListT, the order _does_ matter. The code you have there is perfectly fine, sometimes the added generality can be quite handy

Re: [Haskell-cafe] real-time audio processing [Was: can Haskell do everyting as we want?]

2010-08-05 Thread Job Vranish
Yeah Atom is pretty slick, though unfortunately it's not quite powerful enough for much of the stuff that we do. John Van Enk and I are actually working on a language that's similar to C (and compiles to C), but has polymorphism, type inference and other goodies. The goal is to make working on

Re: [Haskell-cafe] ANNOUNCE: DSTM 0.1.1

2010-08-04 Thread Job Vranish
Both Git and GitHub are fantastic. (and very convenient for contributors) Also if you're the kind of person who's into GUI's, SmartGit is quite good as well. - Job On Wed, Aug 4, 2010 at 3:28 PM, Frank Kupke f...@informatik.uni-kiel.dewrote: John, a very nice idea. I have not worked with

Re: [Haskell-cafe] real-time audio processing [Was: can Haskell do everyting as we want?]

2010-08-04 Thread Job Vranish
+ 1 This is probably the biggest obstacle to using Haskell where I work. (Aviation industry, software for flight management systems for airplanes) We often need to perform some computations with hard deadlines, say every 20ms, with very little jitter. Major GC's spoil the fun; It's quite easy

Re: [Haskell-cafe] Fail to install SDL with Cabal

2010-07-30 Thread Job Vranish
You might try emailing the maintainer directly. The package appears to be actively maintained. - Job On Fri, Jul 30, 2010 at 3:17 AM, Eitan Goldshtrom thesource...@gmail.comwrote: I'm trying to install SDL through Cabal -- I don't know another way to install it. However, I'm getting this:

Re: [Haskell-cafe] [Yi Editor]Cabal Problem

2010-07-30 Thread Job Vranish
I think you can just install the windows gtk dev libraries from here: http://www.gtk.org/download.html - Job On Thu, Jul 29, 2010 at 5:20 PM, Alessandro Stamatto astama...@gmail.comwrote: Installing Yi Editor i get the following error: --

Re: [Haskell-cafe] Problem with haskell types

2010-07-30 Thread Job Vranish
Yeah I recently ran into this myself. ( http://osdir.com/ml/haskell-cafe@haskell.org/2010-07/msg00020.html). It's not a bug, just a limitation of haskell's inference algorithm for mutually recursive groups of functions. The problem is that haskell infers groups (the strongly connected components)

Re: [Haskell-cafe] Memory and Threads - MVars or TVars

2010-07-29 Thread Job Vranish
You might try pulling downloading the package ('cabal fetch org' will do this) and changing the base dependency (to = 4.1) in the orc.cabal file and then build it manually (cabal configure cabal build cabal install (while in the same directory as the .cabal file)) and see what happens. I don't

Re: [Haskell-cafe] OpenGL Speed!

2010-07-29 Thread Job Vranish
Yeah, using openGL Points to draw 2D images will probably be pretty slow. However, if you don't need to change your points every frame, a display list might improve the speed quite a bit (you could still transform the points as a whole). Also, you could try the SDL bindings for haskell:

Re: [Haskell-cafe] Memory and Threads - MVars or TVars

2010-07-28 Thread Job Vranish
Atomic operations are special operations where you don't have to worry about some other process messing with things while the operation is taking place. For a simple example of why atomic operations are important: (taken from: http://en.wikipedia.org/wiki/Linearizability#Non-atomic) The naive,

Re: [Haskell-cafe] Actors and message-passing a la Erlang

2010-07-26 Thread Job Vranish
I think most of the Erlang style actors with message passing can be done in Haskell with just TChan and forkIO. http://en.wikibooks.org/wiki/Haskell/Concurrency - Job On Sun, Jul 25, 2010 at 4:55 PM, Yves Parès limestr...@gmail.com wrote: Hello ! I've been studying Erlang and Scala, and I

Re: [Haskell-cafe] Haskell Forum

2010-07-26 Thread Job Vranish
I agree. A web forum would be more friendly to newcomers, easier to browse, and better organized, than the mailing list. Some people will still prefer the mailing list of course, but I think there will be enough demand to justify a forum :) - Job On Mon, Jul 26, 2010 at 9:57 AM, Daniel Díaz

Re: [Haskell-cafe] Yet another monad transformer or silly usage of Either?

2010-07-25 Thread Job Vranish
Yeah, ErrorT should do what you want (EitherT is probably essentially the same thing) login would have the type: login :: String - String - ErrorT DServError IO LoginResponse and you would use it like this: result - runErrorT $ authenticatedReq You can use runErrorT, or catch when you want to

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-19 Thread Job Vranish
Martijn van Steenbergen has a good blog post that describes the method I generally use: http://martijn.van.steenbergen.nl/journal/2010/06/24/generically-adding-position-information-to-a-datatype/ In his example he annotates the expression tree with position information, but you can use the same

Re: [Haskell-cafe] qtHaskell

2010-07-19 Thread Job Vranish
I haven't used the Gtk bindings much, but the qtHaskell bindings work quite well. If you've used Qt before, it should be pretty easy to pick up. - Job On Mon, Jul 19, 2010 at 10:19 AM, Ali Razavi ali.raz...@gmail.com wrote: Greetings, I have only used the wxHaskell library before, but I am

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-19 Thread Job Vranish
questions about it. - Job http://hpaste.org/fastcgi/hpaste.fcgi/view?id=27823#a27823 2010/7/19 Job Vranish job.vran...@gmail.com I didn't get any attachments from you, but haskell-cafe might filter them out (I'm not sure). But, the usual derived instances for Show should work fine for your

Re: [Haskell-cafe] use of modules to save typing

2010-07-08 Thread Job Vranish
For working with record fields inside of state monads I would recommend trying out one of these packages: lenses fclabels data-accessor (I think I'm forgetting a couple) They all have special mechanisms for working with record fields inside state monads (and have lots of other cool stuff) I'm

Re: Re: [Haskell-cafe] Criteria for determining if a recursive function can be implemented in constant memory

2010-07-06 Thread Job Vranish
If your integers have a bounded size, then your Turing machine is not Turing complete and can't run a Haskell interpreter. You might be tempted to just make the numbers really big, but bounded, and then say that you can still run most interesting programs while skirting the issue of non

[Haskell-cafe] Inferring the most general type

2010-06-22 Thread Job Vranish
Esteemed fellow haskellers, I recently ran into a very simple real life case where Haskell's rules for inferring the types for mutually recursive definitions resulted in a type that was less general than it could be. It took me a while to realize that the type error I was getting wasn't actually

Re: [Haskell-cafe] How to browse code written by others

2010-06-14 Thread Job Vranish
I've been using the geany http://www.geany.org/ editor recently and I was shocked to find that it has decent source browsing capabilities (that work with haskell even!). You can find where something is defined and find other usages of things. It's a bit crude, but gets the job done well enough. -

Re: [Haskell-cafe] Using the ContT monads for early exits of IO ?

2010-06-10 Thread Job Vranish
Yeah I don't see why not. The ContT monad should work great. Also, depending on what you're doing, the ErrorT monad might do what you want as well. - Job 2010/6/10 Günther Schmidt gue.schm...@web.de Hi everyone, I'm about to write a rather lengthy piece of IO code. Depending on the results

Re: [Haskell-cafe] Re: Using the ContT monads for early exits of IO ?

2010-06-10 Thread Job Vranish
Yeah, I might actually prefer calling it EitherT instead of ErrorT. It doesn't have to be used for error, it's just what it is most often used for. - Job On Thu, Jun 10, 2010 at 3:57 PM, Maciej Piechotka uzytkown...@gmail.comwrote: On Thu, 2010-06-10 at 14:09 -0500, Tim Wawrzynczak wrote:

Re: [Haskell-cafe] Proposal to solve Haskell's MPTC dilemma

2010-06-08 Thread Job Vranish
Sorry for reopening an old thread, but I thought I'd counter some of the negative feedback :) I think this proposal is a great idea! It seems like this would make working with MPTCs much easier. When programming, I generally want to only specify the minimum amount of information to make my code

[Haskell-cafe] Good US Grad schools for functional languages?

2010-05-13 Thread Job Vranish
Anybody know of a good grad school in the US for functional languages? (good = has Ph.D. program that covers functional languages, type systems, correctness proofs, etc...) So far Indiana University is the only one I've found that has a strong showing in this area. A way to get into one of the

Re: [Haskell-cafe] Good US Grad schools for functional languages?

2010-05-13 Thread Job Vranish
://mpri.master.univ-paris7.fr/ Which gathers the best french students (from such schools as Ecole Polytechnique, ENS Ulm, ENS Cachan). Or I know else of people who did a Ph.D. in sweden with Thierry Coquand for instance. Per Martin-Löf is there too. Cheers, PE El 13/05/2010, a las 13:41, Job

Re: [Haskell-cafe] Re: GSoC: Hackage 2.0

2010-04-09 Thread Job Vranish
I vote for adding a feature that would let people post comments/code snippets to the documentation of other peoples packages :) It would be even nicer if you could post comments to individual haskell definitions on the haddock page, and then hide most of them by default under an expander of some

Re: [Haskell-cafe] Re: GSoC: Hackage 2.0

2010-04-09 Thread Job Vranish
On Fri, Apr 9, 2010 at 9:46 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Job Vranish job.vran...@gmail.com writes: I vote for adding a feature that would let people post comments/code snippets to the documentation of other peoples packages :) You mean turn every hackage

Re: [Haskell-cafe] Re: GSoC: Hackage 2.0

2010-04-09 Thread Job Vranish
On Fri, Apr 9, 2010 at 10:31 AM, Edward Kmett ekm...@gmail.com wrote: On Fri, Apr 9, 2010 at 10:21 AM, Job Vranish job.vran...@gmail.comwrote: On Fri, Apr 9, 2010 at 9:46 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Job Vranish job.vran...@gmail.com writes: I vote

Re: [Haskell-cafe] Re: GSoC: Hackage 2.0

2010-04-09 Thread Job Vranish
On Fri, Apr 9, 2010 at 10:46 AM, Malcolm Wallace malcolm.wall...@cs.york.ac.uk wrote: It would be even nicer if you could post comments to individual haskell definitions on the haddock page, and then hide most of them by default under an expander of some sort. Rather than, you know,

[Haskell-cafe] Why does Haskell not infer most general type?

2010-04-06 Thread Job Vranish
Is haskell supposed to always infer the most general type (barring extensions)? I found a simple case where this is not true: f _ = undefined where _ = y :: Int - Int y x = undefined where _ = f x Haskell infers the types of 'y' and 'f' as: f :: Int - a y :: Int - Int This

Re: [Haskell-cafe] Why does Haskell not infer most general type?

2010-04-06 Thread Job Vranish
So in Haskell 98, would the added constraints result in a type error? - Job On Tue, Apr 6, 2010 at 5:12 PM, Ross Paterson r...@soi.city.ac.uk wrote: On Tue, Apr 06, 2010 at 03:56:32PM -0400, Job Vranish wrote: f _ = undefined where _ = y :: Int - Int y x = undefined where

Re: [Haskell-cafe] Why does Haskell not infer most general type?

2010-04-06 Thread Job Vranish
Thank you all for your replies. This is all much more clear now :) - Job On Tue, Apr 6, 2010 at 7:00 PM, Ross Paterson r...@soi.city.ac.uk wrote: On Tue, Apr 06, 2010 at 05:18:34PM -0400, Job Vranish wrote: So in Haskell 98, would the added constraints result in a type error? Yes, because

Re: [Haskell-cafe] ANN: fixed-list -- A fixed length list library

2010-03-21 Thread Job Vranish
sophisticated way to keep track of the list lengths that doesn't have this problem, but I really like the simplicity of the current implementation. - Job On Sun, Mar 21, 2010 at 2:37 AM, Casey McCann syntaxgli...@gmail.comwrote: Job Vranish job.vran...@gmail.com wrote: Its main advantages

[Haskell-cafe] ANN: fixed-list -- A fixed length list library

2010-03-20 Thread Job Vranish
I uploaded a new fixed length list library to hackage: http://hackage.haskell.org/package/fixed-list Its main advantages are: Very easy to use. Almost entirely Haskell98 (the non Haskell98 pieces are not critical, just nice) The datatype is a member of Foldable, Traverable, Applicative,

Re: [Haskell-cafe] Abstraction in data types

2010-03-18 Thread Job Vranish
A phantom type might do what you want: -- notice the type parameter on point that isn't used in the type data Point a = Cartesian (Cartesian_coord, Cartesian_coord) | Spherical (Latitude, Longitude) -- make some dummy types data SphericalP data CartesianP --make some

Re: [Haskell-cafe] Parsec monad transformer with IO?

2010-03-18 Thread Job Vranish
Hoogle is a great tool for finding haskell functions: http://www.haskell.org/hoogle/ You can punch in the type of a function you want and it will give you a list of functions that might do what you need. Generalizing the types a bit usually helps. Searching for either m a - n m a or IO a -

Re: [Haskell-cafe] GPL answers from the SFLC (WAS: Re: ANN: hakyll-0.1)

2010-03-05 Thread Job Vranish
This seems really confusing. It would imply that if I write a library that is designed to talk to some part of the linux kernel API (which is GPL'd) then I'd have to release my library under the GPL. And anything that used my libraries API would need to be GPL'd too, etc... Which would mean that

Re: [Haskell-cafe] Haskell platform for GHC 6.12.1?

2010-03-04 Thread Job Vranish
I'm pretty sure you don't need mingw and all that. I've bootstrapped cabal-install on windows a few times now without needing anything more than ghc (though I haven't done 6.12 yet so I might be totally off base here...) You can't use the nice bootstrap script, but you can download and build the

Re: [Haskell-cafe] ANNOUNCE: Parsec 3.1.0

2010-03-04 Thread Job Vranish
Sweet :) I'm glad that notFollowedBy has been fixed. I've often had to redefine it because the type was to restrictive. - Job On Wed, Mar 3, 2010 at 11:45 PM, Derek Elkins derek.a.elk...@gmail.comwrote: Parsec is a monadic combinator library that is well-documented, simple to use, and

Re: [Haskell-cafe] Real-time garbage collection for Haskell

2010-03-01 Thread Job Vranish
My current area of work is on realtime embedded software programming for avionics systems. We do most of our coding in Ada but I've been dreaming of using haskell instaed. However, the garbage collector is actually one of the larger obsticles to making this happen. All of our avionics software

Re: [Haskell-cafe] Real-time garbage collection for Haskell

2010-03-01 Thread Job Vranish
On Mon, Mar 1, 2010 at 2:37 PM, Thomas Schilling nomin...@googlemail.comwrote: On 1 March 2010 16:27, Job Vranish job.vran...@gmail.com wrote: My current area of work is on realtime embedded software programming for avionics systems. We do most of our coding in Ada but I've been dreaming

Re: [Haskell-cafe] save/restore of STRef state

2010-02-27 Thread Job Vranish
On Sat, Feb 27, 2010 at 11:53 AM, Andrew Coppin andrewcop...@btinternet.com wrote: If you use something like the State or Reader monad, it becomes trivial to temporarily modify the carried state. But maybe something like this is occasionally useful. (In particular, it seems to allow you to

[Haskell-cafe] haskell-src type inference algorithm?

2010-02-11 Thread Job Vranish
Anyone know of a type inference utility that can run right on haskell-src types? or one that could be easily adapted? I want to be able to pass in an HsExp and get back an HsQualType. It doesn't have to be fancy, plain Haskell98 types would do. It wouldn't be to hard to make one myself, but I

Re: [Haskell-cafe] matrix question

2010-02-02 Thread Job Vranish
I have a little haskell matrix library for fixed sized matricies on github: http://github.com/jvranish/VectorMatix which I've just realized is horribly out of date...I'll update it tonight and probably push it to hackage too... but if you're really want to stick with the [[Double]] type, you can

Re: [Haskell-cafe] Re: OT: Literature on translation of lambda calculus to combinators

2010-01-29 Thread Job Vranish
Cool, Thanks :D also quickcheck says the two algorithms are equivalent :) On Fri, Jan 29, 2010 at 4:33 AM, Nick Smallbone nick.smallb...@gmail.comwrote: Job Vranish jvran...@gmail.com writes: Ideally we'd like the type of convert to be something like: convert :: LambdaExpr - SKIExpr

Re: [Haskell-cafe] OT: Literature on translation of lambda calculus to combinators

2010-01-28 Thread Job Vranish
There is a nice simple algorithm on wikipedia: http://en.wikipedia.org/wiki/Combinatory_logic (for both SKI and BCKW) translated to haskell: -- The anoying thing about the algorithm is that it is difficult to separate the SKI and LC expression types -- it's easiest to just combine them. data

Re: [Haskell-cafe] OT: Literature on translation of lambda calculus to combinators

2010-01-28 Thread Job Vranish
))) A while ago I tried modifying the algorithm to be pure top-down so that it wouldn't have this problem, but I didn't have much luck. Anybody know of a way to fix this? - Job On Thu, Jan 28, 2010 at 10:21 AM, Felipe Lessa felipe.le...@gmail.comwrote: On Thu, Jan 28, 2010 at 09:23:23AM -0500, Job

Re: [Haskell-cafe] Re: Why?

2009-12-10 Thread Job Vranish
I won't mention the name so as not to offend anyone. Oh I'm sure we can handle it ;) Though I'm curious as to how a language could be effect free in a practical sense, but not a strict one? could you give an example? To answer your original question, there are many benefits haskell gains

Re: [Haskell-cafe] IORefs and weak pointers

2009-11-04 Thread Job Vranish
Wow, this looks like a bug to me. If it's not a bug, then it's horribly unintuitive. I extended your example in an effort to figure out what was going on. Apparently weak pointers loath live IORefs: import Data.IORef import Data.Maybe import System.Mem import System.Mem.Weak import Control.Monad

Re: [Haskell-cafe] IORefs and weak pointers

2009-11-02 Thread Job Vranish
Could mkWeakPair do what you want? http://haskell.org/ghc/docs/latest/html/libraries/base/System-Mem-Weak.html#v:mkWeakPair Or are you trying to do something else? - Job 2009/11/2 Patai Gergely patai_gerg...@fastmail.fm Hello all, I wanted to create a weak pointer with an IORef as the key

Re: [Haskell-cafe] Applicative but not Monad

2009-10-30 Thread Job Vranish
If you use a monad instance for ZipLists as follows: instance Monad ZipList where return x = ZipList $ repeat x ZipList [] = _ = ZipList [] xs = f = diagonal $ fmap f xs (where diagonal pulls out the diagonal elements of a ziplist of ziplists) It will satisfy all the monad laws _except_

Re: [Haskell-cafe] Test cases for type inference

2009-10-21 Thread Job Vranish
I was recently working on an type inference algorithm and to test it I did the following: Used the quickcheck Arbitrary typeclass to generate expressions Inferred types of the expressions using my algorithm, converted the expressions that passed inference to haskell and wrote them to a file

Re: [Haskell-cafe] Why there is not standard Monoid instance for ZipList a?

2009-10-16 Thread Job Vranish
Nope, Other than possibly adding library clutter. I have a package that provides many instances and common functions for ZipLists. Eventually I might stick it on hackage, but currently it's here: http://github.com/jvranish/ZipList I really with there was a way to switch Applicative (or other)

Re: [Haskell-cafe] Genuine Need For Persistent Global State?

2009-10-16 Thread Job Vranish
Stable pointers might do what you want: http://haskell.org/ghc/docs/latest/html/libraries/base/Foreign-StablePtr.html Though an IORef would probably work just as well, depending on how you needed to use it.. - Job On Fri, Oct 16, 2009 at 2:59 PM, Alan Carter alangcar...@gmail.com wrote: Hi,

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Job Vranish
You are in luck! Such an instance is very simple with Applicative. If the type you want a Num instance for is a member of the Applicative type class you can define it like this: instance (Num a) = Num (Vector2 a) where a + b = pure (+) * a * b a - b = pure (-) * a * b a * b = pure (*) * a

Re: [Haskell-cafe] Num instances for 2-dimensional types

2009-10-05 Thread Job Vranish
In what way is it not a number? data MyNumber a = MyNum a a deriving (Show, Eq) instance Functor MyNum where fmap f (MyNum a b) = MyNum (f a) (f b) instance Applicative MyNum where pure a = MyNum a a MyNum f g * MyNum a b = MyNum (f a) (g b) instance (Num a) = Num (MyNum a) where a

Re: [Haskell-cafe] Splitting data and function declarations over multiple files

2009-10-01 Thread Job Vranish
Along the projection/co-algebra lines (I actually didn't know that's what they were called until today :) yay for learning new things!) How about something like this: -- Define prototypes for your class of actions here data Actor = Actor {pos::Vector2 Float, move::Vector2 Float - Actor} --

Re: [Haskell-cafe] Splitting data and function declarations over multiple files

2009-10-01 Thread Job Vranish
. - Job On Thu, Oct 1, 2009 at 11:35 AM, Job Vranish jvran...@gmail.com wrote: Along the projection/co-algebra lines (I actually didn't know that's what they were called until today :) yay for learning new things!) How about something like this: -- Define prototypes for your class of actions

Re: [Haskell-cafe] Market Place for Haskell development teams?

2009-09-29 Thread Job Vranish
If there is demand for shops to work on smaller jobs in haskell then I think a having a more specific marketplace/communication platform for haskell work would be very helpful. If there is a perceived demand, supply will soon follow. - Job On Tue, Sep 29, 2009 at 5:48 AM, Jörg Roman Rudnick

Re: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.

2009-09-29 Thread Job Vranish
Andrew Coppin andrewcop...@btinternet.com wrote: how do we fix all this? I think the key here is to reduce the cost of contribution to a minimum. Make it as easy as possible to contribute an example, or to fill in some missing documentation (and to find it later). Cabal and hackage have made

Re: [Haskell-cafe] Strong duck typing / structural subtyping / type class aliases / ??? in Haskell

2009-09-25 Thread Job Vranish
Short answer: There is no good way of doing what you want. This is actually one of my biggest annoyances with haskell (right up there with disallowing infinite types). They are many techniques that work better or worse depending on the application, but non are very satisfactory IMO. Your typeclass

Re: [Haskell-cafe] weak pointers and memoization (was Re: memoization)

2009-09-18 Thread Job Vranish
table or the graph structure itself will outgrow available memory. -Rod On Thu, 17 Sep 2009 13:32:13 -0400 Job Vranish jvran...@gmail.com wrote: What are you trying to use this for? It seems to me that for memo tables you almost never have references to they keys outside

Re: [Haskell-cafe] weak pointers and memoization (was Re: memoization)

2009-09-18 Thread Job Vranish
Hey it works :D Here is a proof of concept: http://gist.github.com/189104 Maybe later today I'll try to make a version that can be safely used outside IO. - Job On Fri, Sep 18, 2009 at 10:19 AM, Job Vranish jvran...@gmail.com wrote: Yeah it seems like the general solution to the problem

Re: [Haskell-cafe] code-build-test cycle

2009-09-18 Thread Job Vranish
Yeah linking in windows is _very_ slow. Supposedly this is because the linker forks a lot of processes. In linux this is fine as forking is dirt cheap, but in windows (at least older versions, not completely sure about vista or 7) forking is expensive. Building a Qt app on my EEE in linux only

Re: [Haskell-cafe] Re: [Haskell-beginners] map question

2009-09-17 Thread Job Vranish
(-) happens to be the only prefix operator in haskell, it also an infix operator. so: 4 - 2 2 -3 -3 ((-) 5) 3 -- note that in this case (-) is treated like any regular function so 5 is the first parameter 2 (5 - ) 3 2 (-5 ) -5 (flip (-) 5) 3 -2 It's a little wart brought about by the

Re: [Haskell-cafe] weak pointers and memoization (was Re: memoization)

2009-09-17 Thread Job Vranish
What are you trying to use this for? It seems to me that for memo tables you almost never have references to they keys outside the lookup table since the keys are usually computed right at the last minute, and then discarded (otherwise it might be easier to just cache stuff outside the function).

Re: [Haskell-cafe] Peano axioms

2009-09-17 Thread Job Vranish
The problem is that you are using 'suc' as if it is a constructor: ((suc m) `eq` (suc n) = m `eq` n) You'll have to change it to something else, and it will probably require adding an unpacking function to your class and it will probably be messy. I'd suggest you make use of the Eq typeclass and

[Haskell-cafe] Fixed length list type?

2009-09-09 Thread Job Vranish
Does anyone know of a hackage package that has fixed length list type that is an instance of Applicative, Foldable and Traversable? (a list type that somehow encodes its length in the type) I've found lots of fixed length list types, but non that are members of the common typeclasses. I've

Re: [Haskell-cafe] ANNOUNCE: lenses -- Simple Functional Lenses

2009-09-03 Thread Job Vranish
Steenbergen mart...@van.steenbergen.nl wrote: Job Vranish wrote: A simple but powerful implementation of function lenses (aka functional references, accessors, etc..). Nice! I will definitely give it a whirl when I pick up my MUD again. I'm currently using accessors there. I see your

Re: [Haskell-cafe] Re: cabal: : openFile: does not exist (No such file or directory)

2009-09-02 Thread Job Vranish
Did you by chance use the prebuilt ghc binaries? or build ghc manually? - Job On Mon, Aug 31, 2009 at 5:23 PM, Paulo Tanimoto tanim...@arizona.eduwrote: Hello, On Mon, Aug 31, 2009 at 3:29 PM, Job Vranishjvran...@gmail.com wrote: I got around this problem by downgrading to 6.10.3 (I think

Re: [Haskell-cafe] Cabal install specific version of a package

2009-09-02 Thread Job Vranish
cabal install derive-0.1.4 On Wed, Sep 2, 2009 at 1:12 PM, Grigory Sarnitskiy sargrig...@ya.ru wrote: How to install specific version of a package (derive 0.1.4)? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

[Haskell-cafe] ANNOUNCE: lenses -- Simple Functional Lenses

2009-09-02 Thread Job Vranish
A simple but powerful implementation of function lenses (aka functional references, accessors, etc..). This library provides a convenient way to access and update the elements of a structure. It is very similar to Data.Accessors, but simpler, a bit more generic and has fewer dependencies. I

Re: Re[2]: [Haskell-cafe] GUI library

2009-09-01 Thread Job Vranish
Deallocation is automatic (just like C++ Qt) C++ Qt has excellent unicode support. I haven't explicit tried it in qtHaskell, but as far as I know it should work just fine. Unfortunatly it does not currently build just with cabal, however the build scripts are very clean (no configure) and the

Re: [Haskell-cafe] GUI library

2009-09-01 Thread Job Vranish
Job Vranish wrote: I recommend qtHaskell. I am a big fan of Qt in general. It has good documentation and extensive examples, is very well designed, and has a good license. I'd even say the C++ version is good choice for beginners (certainly easier to understand/use than say GTK). The qtHaskell

Re: [Haskell-cafe] Cleaning up stable names?

2009-09-01 Thread Job Vranish
that function, stable names are not that useful I guess? they would cause a space leak? On Mon, Aug 31, 2009 at 10:59 PM, Job Vranish jvran...@gmail.com wrote: I also would like a isStableNameTargetAlive function. Though if you had such a function then you probably _could_ make a deRefStableName

Re: [Haskell-cafe] Re: cabal: : openFile: does not exist (No such file or directory)

2009-08-31 Thread Job Vranish
ghc 6.8.x... HTH Mike. Job Vranish wrote: lol, yep you're right. I'd assumed the haskell platform shipped with the latest parsec, when in fact it does not :) my bad... However, I fixed the cabal issue by installing ghc 6.10.3 and rebuilding the haskell platform. Apparently

Re: [Haskell-cafe] Cleaning up stable names?

2009-08-31 Thread Job Vranish
I also would like a isStableNameTargetAlive function. Though if you had such a function then you probably _could_ make a deRefStableName function, which, since there isn't one, probably means that such a function would be hard to make. - Job On Sun, Aug 30, 2009 at 4:54 PM, Peter Verswyvelen

Re: [Haskell-cafe] GUI library

2009-08-31 Thread Job Vranish
I recommend qtHaskell. I am a big fan of Qt in general. It has good documentation and extensive examples, is very well designed, and has a good license. I'd even say the C++ version is good choice for beginners (certainly easier to understand/use than say GTK). The qtHaskell bindings are also

Re: [Haskell-cafe] Re: Time constrained computation

2009-08-28 Thread Job Vranish
I tried this using timeout, but was never able to get it to work. The timeout doesn't behave like I expect. I can take several seconds for it to timeout, even with very low timeouts. Any ideas? - Job module Main where import Data.IORef import System.Timeout import System.IO.Unsafe tailScan f

Re: [Haskell-cafe] Applicative and Monad transformers

2009-08-27 Thread Job Vranish
You could test your instance using the checkers package on hackage (has quickcheck properties for common typeclasses) to see if it fulfills the applicative laws. But I'm not sure if it is acceptable to define applicative instances that don't match the monad instance. Does anyone know of libraries

Re: [Haskell-cafe] Re: Keeping an indexed collection of values?

2009-08-21 Thread Job Vranish
in the collection, if they don't match either raise an error or return Nothing. Not sure if I feel that evil though :D Thanks again for the input :) - Job On Fri, Aug 21, 2009 at 7:26 AM, Heinrich Apfelmus apfel...@quantentunnel.de wrote: Heinrich Apfelmus wrote: Job Vranish wrote: I've been

Re: [Haskell-cafe] Re: Keeping an indexed collection of values?

2009-08-21 Thread Job Vranish
s...@informatik.uni-kiel.de wrote: On Aug 21, 2009, at 5:11 PM, Job Vranish wrote: I also added an extra phantom type parameter to the collection (and key) so that I can prevent keys from being used on different collections even if they hold elements of the same type. I have

Re: [Haskell-cafe] Parsec lookahead and |

2009-08-20 Thread Job Vranish
Yeah, that's weird. I played around with la and it seems to only cause problems when the parser passed into lookAhead succeeds, which seem to go directly against it's stated purpose. lookAhead isn't consuming, (hence the unexpected b) but still prevents | from doing it's thing. Seems like a

Re: [Haskell-cafe] Right way to implement setPixel function

2009-08-20 Thread Job Vranish
Your setPixel function is almost ready to work in a State monad If you modify your setPixel function slightly like so: setPixel' :: Int - Int - Color - B.ByteString - ((), B.ByteString) setPixel' x y (r,g,b) image = ((), B.concat [beforePixel, pixel, afterPixel]) and then wrap it in the State

Re: [Haskell-cafe] Right way to implement setPixel function

2009-08-20 Thread Job Vranish
Opps: setPixel = State setPixel' should be: setPixel x y rgb = State $ setPixel' x y rgb - Job On Thu, Aug 20, 2009 at 1:05 PM, Job Vranish jvran...@gmail.com wrote: Your setPixel function is almost ready to work in a State monad If you modify your setPixel function slightly like so

Re: [Haskell-cafe] Re: Parsec lookahead and |

2009-08-20 Thread Job Vranish
try works in this case, but it won't if we are using a parser which can consume and then fail (instead of char 'a'). In which case we may want it to fail without exploring the second option. Hmmm though you might be right. Having lookAhead return Consumed is only a problem if the parser passed to

  1   2   >