Greetings Cafe,
What would you recommend as a Haskell-based means of interactively
reading and writing mathematical formulae?
As a toy example, what might I use to write a program which presents
the user with
Please simplify the expression: \pi x^2 + 3\pi x^2
(Where the TeX-style
On 2011 Jun 9, at 16:59, Chris Smith wrote:
Ae you looking to do this in a web application, or client-side?
Since one of your requirements is to display a typeset equation,
that makes a bit of difference. In a web-based setting, the best
way to do that is probably MathML, whereas a GUI
[ TLDR: How do you do Lisp symbols in Haskell? ]
What is the Haskell approach to efficient comparison and lookup of
objects by their identity?
Maybe a toy example would help to explain what I mean.
Imagine that I want to use Haskell to maximize happiness in a
situation where a bunch of
On 2011 May 26, at 11:12, Brandon Allbery wrote:
On Thu, May 26, 2011 at 04:45, Jacek Generowicz jacek.generow...@cern.ch
wrote:
What is the Haskell approach to efficient comparison and lookup of
objects by their identity?
ghc uses Data.Unique to generate unique internal identifiers
On 2011 May 26, at 11:16, Christopher Done wrote:
On 26 May 2011 10:45, Jacek Generowicz jacek.generow...@cern.ch
wrote:
What is the Haskell approach to efficient comparison and lookup of
objects
by their identity?
Often you just provide your own and implement Eq.
I should be able
On 2011 May 26, at 11:59, Brandon Allbery wrote:
On Thu, May 26, 2011 at 05:41, Jacek Generowicz jacek.generow...@cern.ch
wrote:
On 2011 May 26, at 11:12, Brandon Allbery wrote:
(Think gensym. Hm, except last time I did anything serious with
Lisp, it was Maclisp... does gensym even still
On 2011 May 26, at 11:59, Jacek Generowicz wrote:
(I imagine that a Sufficiently Smart Compiler could reduce (==) ::
Person Person to just integer comparison.)
Sorry, I meant
(==) :: Person - Person - Bool
in the above.
___
Haskell-Cafe
On 2011 May 25, at 05:53, Mark Wright wrote:
On Wed, 25 May 2011 02:20:39 +0200, Jacek Generowicz jacek.generow...@cern.ch
wrote:
I have recenly installed lambdabot. Its response to *each* *and*
*every* hoogle command is *always*
A Hoogle error occurred.
I'm hoping that someone on Cafe
Hi Mark,
Thanks for your wonderfully lucid, concise and complete explanation of
the problem and its solution (included below).
When I apply your patch and reinstall lambabot, I now get the
following problem:
lambdabot check True
Could not find module `ShowIO`:
It is a member of the
On 2011 May 25, at 13:10, Mark Wright wrote:
I assume your test on OS X was with the latest hoogle version so that
old issues would no longer be relevant:
I would be surprised if it weren't the latest, as I started installing
everything from scratch a couple of days ago.
Anyway, my
On 2011 May 25, at 16:41, Gwern Branwen wrote:
On Wed, May 25, 2011 at 6:22 AM, Jacek Generowicz
jacek.generow...@cern.ch wrote:
I had assumed that it connected to a server.
It did at one point, but Hoogle had downtime and the local hoogle
command was just as good and worked offline
On 2011 May 25, at 21:04, Neil Mitchell wrote:
Hi Jacek,
Hi Neil,
Any pointers to the least painful way of getting 'hoogle data' to
work on OS
X?
Set up a shell alias so wget just calls curl?
Their interfaces are different. (Though maybe there's some option
which makes curl
On 2011 May 25, at 17:42, Gwern Branwen wrote:
On Wed, May 25, 2011 at 11:08 AM, Jacek Generowicz
jacek.generow...@cern.ch wrote:
I've already stumbled across mueval and hoogle as things that need
to be
installed separately before the full advertized features of
lambdabot work
On 2011 May 25, at 16:09, Mark Wright wrote:
Hi Jacek,
Hi Mark,
Thanks once again for your excellent answer.
The show module names were changed in the upgrade from show 0.3.4 to
show 0.4.1.1.
OK, I see that in show.cabal, ShowIO disappears from the exposed-
modules section. This is
On 2011 May 25, at 23:20, Brandon Moore wrote:
From: Jacek Generowicz Sent: May 25, 2011 2:45 PM
I feel a bit guilty about spamming the list with all my stupid
problems: I would
prefer to find my own way around, but if I had to dive in and
rummage around the
source for every problem
On 2011 May 23, at 16:02, Johannes Waldmann wrote:
I just did this (in a pristine virtual machine):
* install ubuntu-11.04-desktop-amd64.iso
* sudo apt-get install libgmp3-dev zlib1g-dev libglut3-dev
* install from binary ghc-7.0.3-x86_64-unknown-linux.tar.bz2
* install from source
Hi,
Could anyone shed light on the meaning of this error message?
cabal: cannot configure xmonad-0.9.1 It requires base ==3.*
For the dependency on base ==3.* there are these packages:
base-3.0.3.1 and
base-3.0.3.2. However none of them are available.
base-3.0.3.1 was excluded because of the
On 2011 May 24, at 09:28, Andres Loeh wrote:
Hi.
Could anyone shed light on the meaning of this error message?
cabal: cannot configure xmonad-0.9.1 It requires base ==3.*
For the dependency on base ==3.* there are these packages:
base-3.0.3.1 and
base-3.0.3.2. However none of them are
On 2011 May 24, at 09:28, Ivan Lazar Miljenovic wrote:
On 24 May 2011 16:57, Jacek Generowicz jacek.generow...@cern.ch
wrote:
Hi,
Could anyone shed light on the meaning of this error message?
cabal: cannot configure xmonad-0.9.1 It requires base ==3.*
For the dependency on base ==3
On 2011 May 24, at 09:37, Juan Daugherty wrote:
Every computing culture is different.
Being in the habit of asking questions you should be able to answer
yourself
is not a good idea. Why did you ask a question which you yourself
characterize
as ignorant?
I would guess it is because he
GOA is broken with recent lambdabots, according to
http://hackage.haskell.org/package/goa-3.0.2
It certainly fails to compile for me (like this http://hpaste.org/46994/goa_build_failure
)
From the fact that it is known to be broken, should I infer that it
is a difficult problem that
On 2011 May 24, at 10:13, Christopher Done wrote:
On 24 May 2011 10:05, Jacek Generowicz jacek.generow...@cern.ch
wrote:
GOA is broken with recent lambdabots, according to
http://hackage.haskell.org/package/goa-3.0.2
It certainly fails to compile for me (like this
http://hpaste.org
I hope you will pardon another *ignorant* question.
'cabal install lambdabot' fails on Ubuntu Natty.
According to the following exchange and bug report
http://comments.gmane.org/gmane.comp.lang.haskell.cafe/88735
http://hackage.haskell.org/trac/ghc/ticket/5050
the workaround is not
On 2011 May 24, at 11:12, Jacek Generowicz wrote:
I have found an {-# OPTION -fvia-C #-} deep inside the lambdabot
code in Plugin/Pl/Common.hs. How can I tell cabal install to ignore
this? Is there some command line option for doing so, or do I have
to edit the source code and somehow
On 2011 May 24, at 11:49, Henning Thielemann wrote:
You cannot only run
$ cabal install lambdabot
but you can also switch to lambdabot source directory and call
lambdabot$ cabal install
Ah. That's useful. I tried manually going through the Cabal song and
dance in that directory, but it
I've installed lambdabot, but check within it seems to be broken: the
only answer it ever gives is Terminated. For example:
lambdabot check True
Terminated
lambdabot
quickCheck works just fine in a GHCi session:
Prelude :m + Test.QuickCheck
[...]
Prelude quickCheck True
[...]
+++ OK,
On 2011 May 24, at 22:30, Gwern Branwen wrote:
@check these days goes through mueval. Are you sure mueval is
installed working?
Au contraire: I am sure that mueval was *not* installed. (Am I
justified to be a just a little bit annoyed that it was not installed
as a dependency by cabal
I have recenly installed lambdabot. Its response to *each* *and*
*every* hoogle command is *always*
A Hoogle error occurred.
I'm hoping that someone on Cafe might be able to offer a more helpful
diagnosis than this ... erm ... terse ... error message.
[TL;DR: there's a concrete question at the bottom.]
Once again I find myself in the pleasant situation where the slings
and arrows of life in general are slightly less intense, and I manage
to find a few spare minutes and some free brain cycles to dedicate to
Haskell.
Why not try GHC
On 2011 May 23, at 13:45, Anthony Cowley wrote:
On Mon, May 23, 2011 at 5:17 AM, Jacek Generowicz
jacek.generow...@cern.ch wrote:
a) Am I right in concluding that GHC 7.0.3 will not run on OS X 10.5
(without unreasonable effort)?
This is a frustrating situation. Note that there is a binary
On 2011 May 23, at 14:29, Anthony Cowley wrote:
On Mon, May 23, 2011 at 8:16 AM, Jacek Generowicz
jacek.generow...@cern.ch wrote:
On 2011 May 23, at 13:45, Anthony Cowley wrote:
As for the platform, if it is giving you trouble, don't shy away
from
just using GHC and cabal as normal! After
On 2011 May 23, at 14:16, Jacek Generowicz wrote:
On 2011 May 23, at 13:45, Anthony Cowley wrote:
On Mon, May 23, 2011 at 5:17 AM, Jacek Generowicz
jacek.generow...@cern.ch wrote:
I think your strategy of nuking everything Haskell through your
package manager (if available
On 2011 May 23, at 14:42, Daniel Fischer wrote:
On Monday 23 May 2011 14:16:43, Jacek Generowicz wrote:
If by cabal install you mean use the command cabal ... yeah, that
would be great, if only I could install cabal-install, which fails.
With what error?
Downloading and unpacking
On 2011 May 23, at 15:08, Jacek Generowicz wrote:
On 2011 May 23, at 14:42, Daniel Fischer wrote:
$ ./bootstrap.sh
in that directory should work.
Configuring Cabal-1.8.0.2...
Setup: At least the following dependencies are missing:
base =4 3 =1 5, filepath =1 1.2
How am I
On 2011 May 23, at 15:22, Daniel Fischer wrote:
On Monday 23 May 2011 15:08:41, Jacek Generowicz wrote:
Cabal-1.8.0.2 will be downloaded and installed.
That's a bad sign.
Have you downoaded the bundle from the cabal-install page?
Ermmm, ys [sudden pangs of guilt
Summarizing, by answering my own question on the basis of the help I
have received elsewhere in the thread.
On 2011 May 23, at 11:17, Jacek Generowicz wrote:
a) Am I right in concluding that GHC 7.0.3 will not run on OS X 10.5
(without unreasonable effort)?
It takes little effort
I'm trying to cabal install lambdabot. This depends on a squillion
other libraries, which cabal tries to install, among which is
readline, which fails to configure as follows.
Configuring readline-1.0.1.0...
checking for gcc... gcc
checking for C compiler default output file name... a.out
On 2011 May 23, at 19:31, Marc Weber wrote:
Excerpts from Jacek Generowicz's message of Mon May 23 19:15:53
+0200 2011:
Where should I be looking for the relevant config.log?
Maybe you're missing header files?
I checked whether the -dev packages were installed, and they were
present
Hi Cafe,
It seems that I don't understand what groupBy does.
I expect it to group together elements as long as adjacent ones
satisfy the predicate, so I would expect ALL four of the following to
give one group of 3 and a group of 1.
Prelude :m + Data.List
Prelude Data.List groupBy () abcb
it against the next elements you
get
1 2 ok, same group
1 3 dito
1 2 dito
Thus you get [[1,2,3,2]]
OK, that works, but it seems like a strange choice ...
On 2011 Mar 4, at 01:47, Daniel Fischer wrote:
On Friday 04 March 2011 01:18:07, Jacek Generowicz wrote:
What am I missing?
That groupBy
On 2011 Mar 4, at 02:14, Brandon S Allbery KF8NH wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 3/3/11 20:09 , Jacek Generowicz wrote:
1 2 ok, same group
1 3 dito
1 2 dito
Thus you get [[1,2,3,2]]
OK, that works, but it seems like a strange choice ...
Stability is often
On 2010 Dec 19, at 20:10, Brandon S Allbery KF8NH wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 12/13/10 09:15 , Jacek Generowicz wrote:
untilQuit' = (fmap (takeWhile (/= quit))) (sequence $ map (=
report)
(repeat getLine))
-- The latter version shows the report, but it doesn't
Hi,
What are some interesting, idiomatic ways of writing something similar
to the following, using
a) Only standard utilities
b) Non-standard utilities
getValidatedInteger = do
maybeInt - maybeGet
case maybeInt of
Just int - return int
Nothing - do putStrLn That doesn't seem
# Imagine an activity which may be performed either by a computer, or
# by a human (alternatively, either locally, or remotely across a
# network). From Haskell's type system's perspective, these two will
# look completely different (most obviously, the human (or the
# network) is wrapped in IO).
-- Is it possible to rewrite code written in this style
untilQuit = do
text - getLine
report text
if text == quit
then return ()
else untilQuit
-- in a style using higher order functions for abstract iteration? For
-- example, something along these lines:
untilQuit' = (fmap
In short: I can't cabal install xmonad-contrib.
Longer version:
It a appears that a program which does not exist on my computer seems
to insist on a package version which does not exist in my universe,
I'm starting to wonder whether I have lost my marbles. Could some kind
soul please
Problem solved: 2 solutions described below.
On 2010 Dec 6, at 14:15, Duncan Coutts wrote:
On 6 December 2010 11:02, Jacek Generowicz
jacek.generow...@cern.ch wrote:
It a appears that a program which does not exist on my computer
seems to
insist on a package version which does not exist
On 2010 Dec 6, at 15:05, Antoine Latter wrote:
On my Mac 'which -a pkg-config' returns:
/opt/local/bin/pkg-config
/opt/local/bin/pkg-config
I'm not sure why it prints twice.
Same happens with my hand-installed version when I use the -a flag: it
only shows it once when invoked without -a.
On 2010 Dec 6, at 15:39, Jacek Generowicz wrote:
On 2010 Dec 6, at 14:15, Duncan Coutts wrote:
In the development version of cabal we have changed that error
message
to try and make it clear that it is looking for a program called
pkg-config, not a Haskell package or a C lib.
cabal
On 2010 Dec 6, at 16:25, Duncan Coutts wrote:
Perhaps something like this would be better:
cabal: The program 'pkg-config' is required but it could not be found
on the system (version 0.9.0 or later of pkg-config is required).
That looks pretty good. I'm having trouble finding any holes in
I'm toying with generating random objects (for example tuples) and
started wondering what pearls of wisdom Cafe might have on the matter.
Two obvious points (relating to my toy code, shown below) are
1) The meaning of the limits required by randomR is not obvious for
types such as tuples
I'm trying to write a utility which is able to read Ratios from two
distinct formats
2 / 3 - 2 % 3
4 - 4 % 1
I'm sure that a skilled Haskell programmer could vastly improve on my
code (do I even need Parsec?), so I've come to solicit advice.
import Text.ParserCombinators.Parsec
Thanks Brandon!
I really like the addParam utility,
value val prompt = Question prompt (show val) (readCheck val)
addParam :: (Show a) = (funTy - String - qty) - (a - funTy) -
String - (a
- qty)
addParam qmakr fun string v = qmakr (fun v) (string++ ++show v)
prefix1 = addParam value
On 2010 Oct 15, at 11:53, Kevin Jardine wrote:
Jacek,
I haven't been following this thread in any detail, so I apologise if
I misunderstand your goal,
My goal (in this thread, at least) is to become a better Haskell
programmer, rather than to actually write any specific program. Yes,
Using Brandon's code as a starting point (as it's far neater than
mine), let's try asking some questions about fractions (I've included
the whole program at the end).
questions = [ addition 1 2, addition (1%2) (1%3) ]
This works, but the the fractions are shown as 1 % 2 and to make it
On 2010 Oct 15, at 13:32, Jacek Generowicz wrote:
questions = [ addition 1 2, addition (1%2) (1%3) ]
My problem is that I don't see where I could add a type signature,
but still keep
addition :: a - a - Question
polymorphic.
Well, OK, I could write
addition 1 (2 :: Int
On 2010 Oct 15, at 11:38, Jacek Generowicz wrote:
[...]
So I'm trying to get to grips with a simpler variation on the same
theme, and I'm still failing. I'm trying to write something along
the lines of
addArg :: nArgFn - a - nPlus1ArgFn
addArg fn a = (a+) fn where
-- Given a definition of view which is essentially a synonym for show:
class View a where
view :: a - String
instance View Int where
view = show
-- why does show 2 compile, while view 2 gives an
-- 'Ambiguous type variable' error
fine = view (2::Int)
noProblem
On 2010 Oct 16, at 00:51, Ivan Lazar Miljenovic wrote:
On 16 October 2010 09:47, Jacek Generowicz
jacek.generow...@cern.ch wrote:
-- Given a definition of view which is essentially a synonym for
show:
class View a where
view :: a - String
instance View Int where
view = show
-- why
On 2010 Oct 16, at 01:14, Jacek Generowicz wrote:
On 2010 Oct 16, at 00:51, Ivan Lazar Miljenovic wrote:
2 is a generic number. If you don't specify a type, it usually
defaults to Integer. All Num instances that come in the Prelude have
Show instances, so no matter which gets picked show 2
jacek.generow...@cern.ch wrote:
-- Given a definition of view which is essentially a synonym for
show:
class View a where
view :: a - String
instance View Int where
view = show
-- why does show 2 compile, while view 2 gives an
-- 'Ambiguous type variable' error
fine =
On 2010 Oct 16, at 01:39, Daniel Fischer wrote:
On Saturday 16 October 2010 01:18:55, Jacek Generowicz wrote:
On 2010 Oct 16, at 01:14, Jacek Generowicz wrote:
On 2010 Oct 16, at 00:51, Ivan Lazar Miljenovic wrote:
2 is a generic number. If you don't specify a type, it usually
defaults
On 2010 Oct 14, at 05:27, Brandon Moore wrote:
If you just want instances of questions you can keep it simple. How
about something isomorphic to
data Instance = Instance { question : String, answer : String,
check : String - Bool }
At first blush, I hated all those Strings hiding the
On 2010 Oct 14, at 05:39, Brandon Moore wrote:
On Oct 13, 2010, at 7:44 PM, Jacek Generowicz jacek.generow...@cern.ch
wrote:
On 2010 Oct 14, at 01:32, Evan Laforge wrote:
I think I'm starting too see what my problem is. I think it boils
down to
hankering for Duck Typing and variadic
On 2010 Oct 14, at 09:19, Evan Laforge wrote:
How
are you expecting to call the functions in that container? for f
in
c: try: return f(*misc_args) except: pass?
to_do = [(call, (AuntMabel,)),
(buy, ([(12*kg, sugar), (6*bushel, wheat)])),
(introduce, (Romeo, Juliet))]
[Gregory: Sorry about duplicate, accidentally took it off-list.]
On 2010 Oct 14, at 09:46, Gregory Collins wrote:
Jacek Generowicz jacek.generow...@cern.ch writes:
Could you explain this a bit more? heterogeneousProcessor was
extremely boring:
its only interesting feature was the dot
On 2010 Oct 14, at 09:54, Joachim Breitner wrote:
Hi,
Am Donnerstag, den 14.10.2010, 09:34 +0200 schrieb Jacek Generowicz:
Another example:
Let's say I need an Int - String. Both
(fnA2 :: Banana - String) . (fnA1:: Int - Banana)
and
(fnB2 :: Onion - String) . (fnB1 :: Int - Onion
On 2010 Oct 14, at 09:56, Max Bolingbroke wrote:
On 14 October 2010 08:34, Jacek Generowicz
jacek.generow...@cern.ch wrote:
Those other data might be the functions' arguments, or they might
be other
functions with which they are to be combined, or both.
You can represent
On 2010 Oct 14, at 09:58, Ketil Malde wrote:
Jacek Generowicz jacek.generow...@cern.ch writes:
Let's say I need an Int - String. Both
(fnA2 :: Banana - String) . (fnA1:: Int - Banana)
and
(fnB2 :: Onion - String) . (fnB1 :: Int - Onion)
will do. So please allow me to store (fnA1
On 2010 Oct 14, at 15:24, Ketil Malde wrote:
Jacek Generowicz jacek.generow...@cern.ch writes:
def memoize(fn):
cache = {}
def memoized_fn(*args):
if args not in cache:
cache[args] = fn(*args)
return cache[args]
return memoized_fn
Here's a simplified memoizer
Thank you all for your contributions so far. Plenty of food for thought.
I though I'd try to put it into practice and have a go at the
motivating example I gave: essentially a EDSL for defining simple
maths tests.
I've included the beginnings of an attempt at the end. It started
On 2010 Oct 13, at 00:28, Alexander Solla wrote:
On Oct 12, 2010, at 4:24 AM, Jacek Generowicz wrote:
I can't see a Haskell solution which combines both of these
orthogonal
features without losing the benefits of the type system. (For
example,
I could create my own, weak, type system
On 2010 Oct 13, at 23:52, Evan Laforge wrote:
I admit I haven't read this whole thread in detail, but when I want
something with an implementation that can vary dynamically I just pass
a different function.
Of course.
Your original python example is equivalent to
just passing strings in
On 2010 Oct 12, at 15:44, John Lato wrote:
It's not plain Haskell, but I'm surprised nobody mentioned the
ExistentialQuantification extension, which unless I'm missing
something provides exactly what you want.
Yes, it does appear to be *exactly* what I want.
Thanks.
(Now, how about
On 2010 Oct 14, at 01:32, Evan Laforge wrote:
I think I'm starting too see what my problem is. I think it boils
down to
hankering for Duck Typing and variadic functions. I fully
appreciate that
passing functions is a wonderful and powerful technique for
catering for
variation, but
BTW Thanks: This discussion has helped me gain a better understanding
of some of the mechanisms at work, which I really appreciate.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Greetings,
I'm looking for dynamic dispatch on extensible sets of types.
Here is a more detailed explanation of what I mean:
# Consider the following Python code as representative of something
# you might see in
[Sorry Stephen, didn't mean to take this off-list, hence the resend.]
On 2010 Oct 12, at 14:31, Stephen Tetley wrote:
To do this I would use dynamic types (via Data.Dynamic).
Ah, yes, I've just stumbled upon these while trying to figure out what
APPLY or FUNCALL would mean in Haskell.
78 matches
Mail list logo