Re: [Haskell-cafe] deriving Data.HashTable - stack overflow

2013-08-08 Thread Lyle Kopnicky
Here's another way to do it: data ValType = FloatType | IntType | StringType deriving (Show,Eq) instance Hashable ValType where hash FloatType = 0 hash IntType = 1 hash StringType = 2 data VarName = VarName ValType String deriving (Show,Eq) instance Hashable VarName where

Re: [Haskell-cafe] deriving Data.HashTable - stack overflow

2013-08-08 Thread Lyle Kopnicky
I chose not to introduce another dependency. I just implemented the hash function by delegating to the Show instance of the nested type: data ValType = FloatType | IntType | StringType deriving (Show,Eq) data VarName = VarName ValType String deriving (Show,Eq) instance Hashable VarName w

Re: [Haskell-cafe] deriving Data.HashTable - stack overflow

2013-08-08 Thread Lyle Kopnicky
Ah, thanks, folks! I'll just implement my own hashing by generating a string and calling the hash function on that. That's what I was doing in the old version of my code, anyway. It's just that in the core Data.HashTable, you had to provide a hash function, so the point where I used the hash tabl

[Haskell-cafe] deriving Data.HashTable - stack overflow

2013-08-08 Thread Lyle Kopnicky
Hi folks, In GHC 7.6.3, the base Data.HashTable is deprecated, so I installed the hashtables package. In order to work on your datatype, you need an instance of Data.Hashable.Hashable. So I went to the Data.Hashable page and looked up examples on how to derive a Hashable instance for my datatype:

[Haskell-cafe] Re: Haskell Platform install fails on mtl

2009-09-11 Thread Lyle Kopnicky
ipping..." > else > cd "${pkg}" || die "The directory for the component ${PKG} is missing" > echo "Installing ${pkg}..." > install_pkg ${pkg} > cd .. > fi On Fri, Sep 11, 2009 at 1:04 PM, Lyle Kopnicky wrote: > O

[Haskell-cafe] Haskell Platform install fails on mtl

2009-09-11 Thread Lyle Kopnicky
OK, I was able to build the Haskell Platform on Ubuntu 9.04 with GHC 6.10.4. But when I try to install it, I get an error: Registering haskell-platform-2009.2.0.2... Reading package info from "dist/inplace-pkg-config" ... done. Writing new package config file... done. *

Re: [Haskell-cafe] Unable to install Haskell Platform without editline

2009-09-11 Thread Lyle Kopnicky
On Fri, Sep 11, 2009 at 12:01 PM, Judah Jacobson wrote: > The above editline requirement is for the editline C library, not the > Haskell bindings: > http://www.thrysoee.dk/editline > > My guess is that you need to install a recent version of the > libedit-dev package. > After installing libedit-

[Haskell-cafe] Re: Unable to install Haskell Platform without editline

2009-09-11 Thread Lyle Kopnicky
I mean editline, not readline. On Fri, Sep 11, 2009 at 11:46 AM, Lyle Kopnicky wrote: > Hi folks, > > I just installed GHC 6.10.4 on Ubuntu 9.04 32-bit, and then tried to > install the Haskell Platform from source. It built quite a bit of stuff, > with many warnings but no e

[Haskell-cafe] Unable to install Haskell Platform without readline

2009-09-11 Thread Lyle Kopnicky
Hi folks, I just installed GHC 6.10.4 on Ubuntu 9.04 32-bit, and then tried to install the Haskell Platform from source. It built quite a bit of stuff, with many warnings but no errors, and then finally died with the error below. To install editline, I need cabal, which is of course why I install

[Haskell-cafe] Build 32-bit apps on 64-bit Windows?

2009-07-14 Thread Lyle Kopnicky
If I am running GHC on 64-bit Windows, do I have a choice of building a 32-bit or 64-bit app? On a cursory glance through the command-line options, I didn't find anything. - Lyle ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.o

[Haskell-cafe] Re: lift in TemplateHaskell?

2009-04-14 Thread Lyle Kopnicky
OK, I figured it out. The class is Language.Haskell.TH.Syntax.Lift. The function is Language.Haskell.TH.Syntax.lift. And I can rewrite my function as: let double n = [| 2 * n |] I wish this were explained in the TemplateHaskell documentation. - Lyle On Tue, Apr 14, 2009 at 2:51 PM, Lyle

[Haskell-cafe] lift in TemplateHaskell?

2009-04-14 Thread Lyle Kopnicky
Hi folks, I'm having trouble reading the TemplateHaskell docs and trying to do something that seems like it should be simple. In MetaML, there is a 'lift' function which does exactly what I want to do. Here's an example function: let double n = [| 2 * $( litE (integerL n) ) |] This works as inte

[Haskell-cafe] Missing dependency?

2009-04-02 Thread Lyle Kopnicky
Hi folks, Since the time package is not included in ghc-6.10.2, I installed it via cabal. Then I tried to configure my project, and it says that the dependency is missing. Mysterious. Can anyone explain? l...@lwk-desktop:~/devel/vintage-basic$ ghc-pkg list /usr/local/lib/ghc-6.10.2/./package.conf

Re: [Haskell-cafe] ANNOUNCE: Vintage BASIC 1.0

2009-03-14 Thread Lyle Kopnicky
I've posted a new version, 1.0.1, that has a usage message if you run it with no arguments. There is a package for Windows now (not just a binary) as well as Linux. Both packages include documentation and example programs. Thanks for pointing that out! On Fri, Mar 13, 2009 at 1:31 AM, Wolfgang Je

Re: [Haskell-cafe] ANNOUNCE: Vintage BASIC 1.0

2009-03-13 Thread Lyle Kopnicky
On Fri, Mar 13, 2009 at 1:31 AM, Wolfgang Jeltsch < jelt...@informatik.tu-cottbus.de> wrote: > When running the executable, nothing happens. The executable should show a > usage message instead. Where are the BASIC programs? I think, you have to > grab them from the source. They should be installe

Re: [Haskell-cafe] Distributing Linux binaries

2009-03-12 Thread Lyle Kopnicky
Thanks, folks. I have decided for now just to release a tarball with an executable and some docs, that can be expanded where the user deems appropriate. I'll try a static link if people are having problems with it. - Lyle ___ Haskell-Cafe mailing list Has

[Haskell-cafe] ANNOUNCE: Vintage BASIC 1.0

2009-03-12 Thread Lyle Kopnicky
I am pleased to announce the initial release of Vintage BASIC, an interpreter for microcomputer-era BASIC. Fully unit-tested, it faithfully implements the common elements of the language. On the web site, you can find 102 games from the classic book BASIC Computer Games, all of which run flawlessly

Re: [Haskell-cafe] Distributing Linux binaries

2009-03-10 Thread Lyle Kopnicky
Thanks folks for your replies. I did learn, from your e-mails and from the cabal documentation (example 9 on page http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/builders.htm), how to build a tarball with an executable and LICENSE file, via cabal copy. It would have been nice to

[Haskell-cafe] Distributing Linux binaries

2009-03-09 Thread Lyle Kopnicky
Hi folks, I've got an application to release. I'm releasing the source, but I also wanted to release binary versions for people that don't have GHC. I developed on Windows, so making a Windows executable was simple. I also have access to an Ubuntu Linux box, on which I can easily build and test my

[Haskell-cafe] Haskell Fest

2009-02-09 Thread Lyle Kopnicky
Looks like a lot of fun! http://www.haskellchamber.com/page6.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] GHC 6.11 missing time package?

2009-02-08 Thread Lyle Kopnicky
to complete this build. Here you can > find instructions regarding MSYS (and also GLUT, but you can ignore that > part): > http://www.haskell.org/pipermail/haskell-cafe/2007-September/031535.html > > All best > > Christopher Skrzętnicki > > 2009/2/1 Lyle Kopnicky > >&

Re: [Haskell-cafe] GHC 6.11 missing time package?

2009-02-01 Thread Lyle Kopnicky
ow if there's something wrong with the package, or I don't have something set up right to build it on Windows. On Sat, Jan 31, 2009 at 10:13 PM, Antoine Latter wrote: > 2009/1/31 Lyle Kopnicky : > > Hi folks, > > I'm getting ready to release a piece of software. Unfo

[Haskell-cafe] GHC 6.11 missing time package?

2009-01-31 Thread Lyle Kopnicky
Hi folks, I'm getting ready to release a piece of software. Unfortunately due to a bug in GHC 6.10 on Windows it does not handle Ctrl+C properly. Since the bug has been fixed (thank you Simon Marlow), I figured I'd download a 6.11 build (I grabbed the 2009-01-29 version). Unfortunately, my project

Re: [Haskell-cafe] How does one use Text.Regex.Base.RegexLike?

2008-12-23 Thread Lyle Kopnicky
12:30 PM, Daniel Fischer wrote: > Am Dienstag, 23. Dezember 2008 21:09 schrieb Lyle Kopnicky: > > Yes, sort of. It enables me to get some simple examples working with > (=~). > > But I still don't know how to get makeRegex to work. You need it to > specify > >

Re: [Haskell-cafe] How does one use Text.Regex.Base.RegexLike?

2008-12-23 Thread Lyle Kopnicky
> > Does this help? > > > http://www.serpentine.com/blog/2007/02/27/a-haskell-regular-expression-tutorial/ > > j. > > At Tue, 23 Dec 2008 11:21:41 -0800, > Lyle Kopnicky wrote: > > > > [1 ] > > [1.1 ] > > I'm trying to migrate code fro

[Haskell-cafe] How does one use Text.Regex.Base.RegexLike?

2008-12-23 Thread Lyle Kopnicky
I'm trying to migrate code from using the old Text.Regex to the new Text.Regex.Base. But, I'm getting type errors. I can't even create a regex. Looking at the docs, it seems like this should print "bcd": import Data.Array import Text.Regex.Base import Text.Regex.Posix rx = makeRegex "a(.*)A" Jus

Re: [Haskell-cafe] Re: TimeDiff to Int?

2008-11-13 Thread Lyle Kopnicky
:: IO Int secondsSinceMidnight = do zonedTime <- getZonedTime return $ floor $ toRational $ timeOfDayToTime $ localTimeOfDay $ zonedTimeToLocalTime zonedTime On Thu, Nov 13, 2008 at 2:29 AM, Jon Fairbairn <[EMAIL PROTECTED]>wrote: > "Lyle Kopnicky" <[EMAIL PROTECTED]&g

[Haskell-cafe] getLine and ^C on Windows

2008-11-12 Thread Lyle Kopnicky
Hi folks, I'm using System.IO.getLine to read input in my program. I've compiled it on Windows Vista with ghc-6.10.1. I've noticed that if I press Ctrl+C while the program is waiting for input, it will get stuck. No keypresses can get me out of the program - I have to kill the shell. I've tried cmd

Re: [Haskell-cafe] TimeDiff to Int?

2008-11-12 Thread Lyle Kopnicky
c classes are a bit hard to follow. Especially confusing is the conversions. I'm thinking of making a multiparameter Coercible class, with a coerce function, to help address that. - Lyle On Wed, Nov 12, 2008 at 9:43 AM, Philip Weaver <[EMAIL PROTECTED]>wrote: > > > 2008/11

[Haskell-cafe] TimeDiff to Int?

2008-11-12 Thread Lyle Kopnicky
Hi folks, I had some code using the oldtime package, and want to convert it to use the time package. One of the things I need to do is calculate the number of seconds since midnight. The easy part is getting a TimeDiff result: utc <- getCurrentTime tz <- getCurrentTimeZone let td = timeOfDayToTi

Re: [Haskell-cafe] uvector and the stream interface

2008-07-14 Thread Lyle Kopnicky
Don Stewart wrote: Yes, we have long been discussing a generic Stream library to which the various sequence structures can be translated to and from. Already it is useful to say, stream bytestrings into uvectors and out to lists. Isn't there already such a thing? http://www.haskell.org/h

Re: [Haskell-cafe] vector vs uvector

2008-07-14 Thread Lyle Kopnicky
stefan kersten wrote: hi, what's the difference between the vector [1] and uvector [2] packages? should one of those preferred over the other? thanks, [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vector-0.1 [2] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/uv

Re: [Haskell-cafe] Poor Parsec error message

2008-07-10 Thread Lyle Kopnicky
I figured it out, but it's not pretty. The problem is that the eof parser had no awareness of the showTok function. To fix the problem, I had to replace eof with its definition in terms of notFollowedBy, then replace notFollowedBy with its definition in terms of try and unexpected. Then, I chan

[Haskell-cafe] Poor Parsec error message

2008-07-10 Thread Lyle Kopnicky
Hi folks, I'm using Parsec to parse a stream of tokens. The token primitive takes, among other arguments, a function to print tokens. However, this function is not always applied. Try the code below: - import Text.ParserCombinators.Parsec import Text.ParserCombinators.Parsec.Pos(newPo

Re: [Haskell-cafe] Aim Of Haskell

2006-12-11 Thread Lyle Kopnicky
Taral wrote: On 12/11/06, Nia Rium <[EMAIL PROTECTED]> wrote: In my humble opinion, in this context, GUI doesn't mean a library to implement a GUI application. It rather means an interpreter/compiler that provides graphical interface. Windows users can use Visual Haskell... It's still in a

[Haskell-cafe] Why so slow?

2006-12-10 Thread Lyle Kopnicky
The code below is using way more RAM than it should. It seems to only take so long when I build the 'programs' list - the actual reading/parsing is fast. For a 5MB input file, it's using 50MB of RAM! Any idea how to combat this? Thanks, Lyle {-# OPTIONS_GHC -fglasgow-exts #-} -- linear_impor

[Haskell-cafe] Multiple stages in Template Haskell

2006-10-10 Thread Lyle Kopnicky
Hi folks, I noticed that in Template Haskell, you can only have one level of splicing or quasi-quoting. E.g., you can't write: $(zipN ($(sel 2 3) ("zip level",3,( ['a'..'Z'] [1..] (words "now is the time") Because you can't have a splice inside a splice. But wouldn't it be handy to

Re: [Haskell-cafe] Error building Edison 1.2.0.1

2006-10-06 Thread Lyle Kopnicky
Robert Dockins wrote: On Thursday 05 October 2006 16:51, Lyle Kopnicky wrote: Robert Dockins wrote: mtl is the Monad Transformer Library. It's a part of the standard libraries in 6.4.x. There's been a good deal of chatter recently about reducing the set of

Re: [Haskell-cafe] Error building Edison 1.2.0.1

2006-10-05 Thread Lyle Kopnicky
Robert Dockins wrote: On Wednesday 04 October 2006 16:16, Lyle Kopnicky wrote: Robert Dockins wrote: Whats the output of ghc-pkg -l ? [EMAIL PROTECTED]:~$ ghc-pkg -l /usr/local/lib/ghc-6.5.20060924/package.conf: Cabal-1.1.4, base-2.0, (ghc

Re: [Haskell-cafe] Error building Edison 1.2.0.1

2006-10-04 Thread Lyle Kopnicky
Robert Dockins wrote: On Tuesday 03 October 2006 22:58, Lyle Kopnicky wrote: Robert Dockins wrote: On Tuesday 03 October 2006 22:00, Lyle Kopnicky wrote: Hi folks, I tried to build edison-1.2.0.1-sources with the command 'make system

Re: [Haskell-cafe] Error building Edison 1.2.0.1

2006-10-03 Thread Lyle Kopnicky
Robert Dockins wrote: On Tuesday 03 October 2006 22:00, Lyle Kopnicky wrote: Hi folks, I tried to build edison-1.2.0.1-sources with the command 'make system' but got: *** Exception: Line 10: Unknown field 'hs-source-dirs' I am using GHC 6.4.1. Any

[Haskell-cafe] Error building Edison 1.2.0.1

2006-10-03 Thread Lyle Kopnicky
Hi folks, I tried to build edison-1.2.0.1-sources with the command 'make system' but got: *** Exception: Line 10: Unknown field 'hs-source-dirs' I am using GHC 6.4.1. Any idea how to fix this? Thanks, Lyle ___ Haskell-Cafe mailing list Haskell-Cafe

Re: [Haskell-cafe] Re: Getting the latest

2006-09-27 Thread Lyle Kopnicky
Max Vasin wrote: Lyle> I have no idea how it decides where to go. Right now ghc Lyle> 6.4.1 is in /usr/local/bin/ghc. After I 'make install', will it Lyle> be ghc 6.5? I don't want to screw up the installed package so it Lyle> can't be updated later. It should be :-) It should be screwed up?

Re: [Haskell-cafe] Optimizing a title matcher

2006-09-27 Thread Lyle Kopnicky
Ketil Malde wrote: Do you really need that to search for movie titles? At any rate, an exact-match finite-map implementation is a good start - to get good performance, you probably will need to use some kind of index to reduce the amount of data to search exhaustively (all-against-all). For tex

Re: [Haskell-cafe] Optimizing a title matcher

2006-09-26 Thread Lyle Kopnicky
Hi folks, It turns out Haskell is vindicated. It's my algorithm that was slow. As Robert Dockins pointed out, the double nested loop is just going to take a long time. As evidence, it turns out my C++ version is just as slow as the Haskell version. So, I'm going to go back to Haskell, but

Re: [Haskell-cafe] Optimizing a title matcher

2006-09-26 Thread Lyle Kopnicky
Bertram Felgenhauer wrote: Lyle Kopnicky wrote: [snip] listRecords :: AbsString s => TextTable s -> IO [TextRecord s] listRecords (TextTable fields _ records) = do keyRecs <- HT.toList records return $ map (fromList . zip fields . elems . snd) keyRecs

Re: [Haskell-cafe] Optimizing a title matcher

2006-09-26 Thread Lyle Kopnicky
Robert Dockins wrote: Humm... well, double nested loops seems like the wrong approach. It may be. I had hoped it would be fast enough that way. Also, if you are using GHC, it's hashtable implementation has farily well-known performance problems. If all you care about is exact matching, then

Re: [Haskell-cafe] Optimizing a title matcher

2006-09-26 Thread Lyle Kopnicky
Lemmih wrote: Do you have some test input online? I've attached some (very short) input files. Sorry I can't provide more - they're proprietary databases. I know that means you can't actually test the performance, but can only give me advice. At least you can run the program on them, and ther

[Haskell-cafe] Getting the latest

2006-09-26 Thread Lyle Kopnicky
Hi folks, I am running GHC 6.4.1 on my Linux box at work, which is the latest packaged version for Ubuntu Dapper Drake. (They have a 6.4.2 package for Edgy, but I don't know how to install that. The Synaptic Package Manager seems to only want to install packages specifically labeled for Dapper

[Haskell-cafe] Optimizing a title matcher

2006-09-26 Thread Lyle Kopnicky
Hi folks, I'm competing in a contest at work, and we're allowed to use whatever language we want. I decided this was my chance to prove to people that Haskell was up to the challenge. Unfortunately, I ran into performance problems. Since the contest ends this Friday, I've decided to switch to

Re: [Haskell-cafe] Unable to profile program using Data.ByteString.Lazy

2006-09-26 Thread Lyle Kopnicky
Donald Bruce Stewart wrote: You're cabal version is too old then. Try updating either Cabal or GHC. -- Don It's the latest version (6.4.1) packaged for Ubuntu. I'll have to download and install a newer version manually. Unfortunately, the download site seems to be down again :( -

Re: [Haskell-cafe] Unable to profile program using Data.ByteString.Lazy

2006-09-24 Thread Lyle Kopnicky
Donald Bruce Stewart wrote: Probably you didn't build fps with profiling as well? You can rebuild fps with: runhaskell Setup.hs configure -p as the first step. -- Don Thanks, I'll try it. Does that mean when I want to optimize my program, I'll need to rebuild fps without profiling?

[Haskell-cafe] Unable to profile program using Data.ByteString.Lazy

2006-09-23 Thread Lyle Kopnicky
Hi folks, I wrote a program that uses some of the Data.ByteString libraries. I'm using GHC 6.4.1 and FPS 0.7. The program compiles and works just fine. But when I try to profile it, by compiling with -prof, I get: Failed to load interface for `Data.ByteString.Lazy': Could not find

[Haskell-cafe] System threads?

2006-09-19 Thread Lyle Kopnicky
Hi folks, I'm working on a project for which the solution is highly parallelizable. I've been writing it so far for GHC as a single-threaded app. I'd like to be able to split the job into multiple pieces, and spawn different system threads for each piece, so they will run on separate CPUs. Ei

[Haskell-cafe] SMTP, HTTP, Telnet

2006-06-16 Thread Lyle Kopnicky
Hi all, Anybody know of some good Haskell libraries providing: an SMTP client, an HTTP client, or a Telnet client? There's a significant amount to these protocols, over and above the socket layer. Thanks, Lyle Kopnicky ___ Haskell

[Haskell-cafe] Bug in WinHugs?

2006-06-13 Thread Lyle Kopnicky
Hi folks, I just installed the May 2006 release of Hugs. When I use the command-line version, the '$$' symbol to reference the last expression works fine. It does not work in WinHugs, but yields 'ERROR - Syntax error in expression (unexpected symbol "$$")'. I typed ':set' to verify the '-r$$'

[Haskell-cafe] Re: [Haskell] Haskell recruitment?

2004-09-06 Thread Lyle Kopnicky
I think there are so few such opportunities that it would not overwhelm the list. I should also point out that you can post such openings at http://www.haskell.org/jobs.html by sending an e-mail to [EMAIL PROTECTED] and [EMAIL PROTECTED] Regards, Lyle Jochen L. Leidner wrote: Finally, would it

Re: [Haskell-cafe] Partially-applied type synonyms?

2004-09-02 Thread Lyle Kopnicky
T $ ContT $ \c' -> c x >>= c')) return reset m = FlipContT $ ContT $ \c -> runFlipContT m return >>= c - Lyle Chung-chieh Shan wrote: On 2004-08-31T09:55:10-0700, Lyle Kopnicky wrote: Sorry, I don't think I made myself clear. I&#x

Re: [Haskell-cafe] Higher-order unification

2004-08-31 Thread Lyle Kopnicky
f . selfapp) (X (f . selfapp)) fact0 f n = if n==0 then 1 else n * f (n-1) fact = y fact0 -- Lyle Kopnicky Carl Witty wrote: On Tue, 2004-08-31 at 10:00, Chung-chieh Shan wrote: The rationale for disallowing matching partially-applied type synonyms is that higher-order unification is undecidable.

Re: [Haskell-cafe] Partially-applied type synonyms?

2004-08-31 Thread Lyle Kopnicky
m)', or 'ContT _ m', where the '_' is a hole. Does this make sense now? Regards, Lyle Kopnicky Chung-chieh Shan wrote: On 2004-08-30T17:09:39-0700, Lyle Kopnicky wrote: Unfortunately, I need 'PI r -> ContT r m', along with a and r, to be a member of the

[Haskell-cafe] Partially-applied type synonyms?

2004-08-30 Thread Lyle Kopnicky
nstance of the MonadTrans class. Unfortunately, I need 'PI r -> ContT r m', along with a and r, to be a member of the MonadPCont class (PI is the type binding operator). So I thought I'd define ContT' to take the arguments the other way around. Unfortunately, it can&#x

Re: [Haskell-cafe] Hiding functions

2004-08-13 Thread Lyle Kopnicky
Simon, It also appears that if I don't call 'catch' from my module, I can import both and not have a conflict. - Lyle Simon Peyton-Jones wrote: It's an explicit Haskell 98 design choice http://haskell.org/onlinereport/modules.html "5.6.2 Shadowing Prelude Names The rules about the Prelud

Re: [Haskell-cafe] Hiding functions

2004-08-13 Thread Lyle Kopnicky
Alistair, I'm throwing my own exceptions in my own monad, not the IO one. But thanks for pointing me to the stuff about dynamic types. I'm going to be creative and pick some new names. - Lyle Bayley, Alistair wrote: What is wrong with creating your own catch and throw with different names? e.g

Re: [Haskell-cafe] Hiding functions

2004-08-13 Thread Lyle Kopnicky
t declaration that makes this nonstandard usage explicit." It's a decision one could debate, but it was an explicit choice. Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lyle | Kopnicky | Sent: 12 August 2004 20:23 | To: Haskell Cafe | Su

Re: [Haskell-cafe] Closed Classes

2004-08-12 Thread Lyle Kopnicky
Notwithstanding module Y, I don't think you should infer in module X that g::Int (or, rather, Int->Int). Since f is defined in a type class, it should be polymorphic, and so should g. When you apply g to a type, it will check to see what instances are available, and match only if Int is the t

[Haskell-cafe] Hiding functions

2004-08-12 Thread Lyle Kopnicky
Hi all, I'm working on a program that uses my own brand of exceptions, and I created two functions called 'throw' and 'catch'. In order for this to work, I hide the Prelude 'catch' in my module, called 'Cont.hs'. Thus: module Cont where import Prelude hiding (catch) ... throw = ... catch = ...

Re: [Haskell-cafe] Combination-lock problem

2004-08-12 Thread Lyle Kopnicky
Even shorter: c=mapM(\k->[0..k]) - Lyle Fritz Ruehr wrote: Well, as far as that goes, we can shave off a little bit (around 7%) this way: combs = mapM (\k->[0..k]) (As a bonus, it's even a bit more cryptic/symbolic, in the fine tradition of APL one-liner character-shavings.) But who's countin

Re: [Haskell-cafe] Combination-lock problem

2004-08-11 Thread Lyle Kopnicky
Henning Thielemann wrote: On Wed, 11 Aug 2004, Lyle Kopnicky wrote: Here's my version: combs [] = [] combs [n] = [[i] | i <- [0..n]] combs (n:r) = let combsr = combs r in [i:cr | i <- [0..n], cr <- combsr] Since there is one zero combination, it should be combs [] = [[]

Re: [Haskell-cafe] Combination-lock problem

2004-08-11 Thread Lyle Kopnicky
Here's my version: combs [] = [] combs [n] = [[i] | i <- [0..n]] combs (n:r) = let combsr = combs r in [i:cr | i <- [0..n], cr <- combsr] - Lyle Florian Boehl wrote: Hi, I'ld like to generate a list (of lists) that contains all combinations of natural numbers stored in another list. It should work

Re: [Haskell-cafe] Library sizes (was: Toy application advice wanted)

2004-05-06 Thread Lyle Kopnicky
piling the library code with the application takes longer, but need only be done once the program is ready for distribution. If anyone knows of existing solutions in either of these areas, please inform us. - Lyle Kopnicky Duncan Coutts wrote: On Wed, 2004-05-05 at 16:24, Andrei de A. Formiga w

Re: [Haskell-cafe] Toy application advice wanted

2004-05-05 Thread Lyle Kopnicky
wc -l would be something like a two-liner... A one-liner: main = interact (show . length . lines) - Lyle Kopnicky ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe