On Dec 7, 2007 6:27 AM, Victor Nazarov [EMAIL PROTECTED] wrote:
Cool solution and not so complicated and ad-hoc. But I'd like to ask
isn't the following definition is more natural and simple?
nary 0 x [] = x
nary n f (x:xs) | n 0 = nary (n-1) (f $ read x) xs
Sometimes it helps to write type
On Fri, 7 Dec 2007, Simon Peyton-Jones wrote:
| And I think that the solution is not to make the language larger and larger
| everytime someone wants a feature but to give people the tools to provide
| features without language changes.
Of course that would be even better! (Provided of
Peter Padawitz wrote:
Functional dependencies don't work in my case. Actually, I don't see why
they should.
Ah well, it's cruel to say that without explaining to us why!
I'm not sure why a complete cyclic dep a - b - c - d - a isn't what
you want.
What seems to be needed here is a type
Functional dependencies don't work in my case. Actually, I don't see why
they should.
What seems to be needed here is a type class construct with a kind of
record parameter so that instance conflicts cannot occur.
Jules Bean wrote:
Ben Franksen wrote:
Ryan Ingram wrote:
On 12/5/07, Ben
| And I think that the solution is not to make the language larger and larger
| everytime someone wants a feature but to give people the tools to provide
| features without language changes.
Of course that would be even better! (Provided of course the resulting
programs were comprehensible.)
I have some type-level sets using fundeps working whereby equality and
membership etc are predicate functions. This seems to leads to an explosion
of ugly code, with `If' class constraints etc getting out of hand -- I want
to treat these as relations instead so providing the definition describes
Peter Padawitz wrote:
Jules Bean wrote:
Peter Padawitz wrote:
Functional dependencies don't work in my case. Actually, I don't see
why they should.
Ah well, it's cruel to say that without explaining to us why!
Cause I don't see why the instantiation conflicts pointed out by others
Philipp N. wrote:
i'm trying to wrap functions (a - b - ... - z) of any arity to functions
of type ([String] - y), where list of strings replaces the typed arguments.
the problem is, that you cannot distinguish type (x-y) from z, so these
instances are overlapping.
to which apfelmus replied
On Dec 7, 2007 4:46 PM, Luke Palmer [EMAIL PROTECTED] wrote:
On Dec 7, 2007 6:27 AM, Victor Nazarov [EMAIL PROTECTED] wrote:
nary 0 x [] = x
nary n f (x:xs) | n 0 = nary (n-1) (f $ read x) xs
Sometimes it helps to write type signatures for functions. As in this
case, where you'll find
On Dec 7, 2007 2:52 PM, [EMAIL PROTECTED] wrote:
In fact, that distinction is possible. The following article
How to write an instance for not-a-function
http://okmij.org/ftp/Haskell/typecast.html#is-function-type
specifically describes a method of writing an instance which
Hi,
I am working on a product to analyze posts made in Forums, Usenet and
discussion mailing lists like Haskell-Cafe. For this, I require the
messages to be accessible in this format:
forum (* example: Haskell-cafe *)
[ list of -
thread
[ list of -
post
/post
]
/thread
]
On Dec 7, 2007 6:57 PM, Peter Padawitz [EMAIL PROTECTED] wrote:
Jules Bean wrote:
Peter Padawitz wrote:
Cause I don't see why the instantiation conflicts pointed out by
others would vanish then.
They would.
If it's really true that there is only one possible choice of b,c,d
for
Bit Connor wrote:
Hi,
Monadius is awesome! I've made a video of me playing it and kicking
some serious ass:
http://www.youtube.com/watch?v=zqFgQiPKtOI
No way! Hax!!
You edited the source code, didn't you? ;-)
___
Haskell-Cafe mailing list
On Dec 7, 2007 6:21 PM, Dan Weston [EMAIL PROTECTED] wrote:
This is great! Two questions:
1) I want to make sure the function arity matches the list length (as a
runtime check). I think I can do this with an arity function using
Data.Typeable. I came up with:
arity f = a (typeOf f) where
Peter Padawitz wrote:
So the fundep would solve the problem.
But, actually, it doesn't :-(
But actually, it does!
Ben Franksen's answer from yesterday compiles fine for me if I add the
missing fundep, block - command.
Your original code compiles without error, given the fundep. Exact
On Dec 7, 2007 5:57 PM, Peter Padawitz [EMAIL PROTECTED] wrote:
type Block = [Command]
data Command = Skip | Assign String IntE | Cond BoolE Block Block | Loop
BoolE Block
data IntE= IntE Int | Var String | Sub IntE IntE | Sum [IntE] | Prod
[IntE]
data BoolE = BoolE Bool | Greater
Jules Bean wrote:
Peter Padawitz wrote:
Jules Bean wrote:
Peter Padawitz wrote:
Functional dependencies don't work in my case. Actually, I don't
see why they should.
Ah well, it's cruel to say that without explaining to us why!
Cause I don't see why the instantiation conflicts
Hello,
You should be able to use fundeps to do exactly what you describe below.
Can you make a relatively small self-contained example which exemplifies
the ugliness you see?
-Jeff
[EMAIL PROTECTED] wrote on 12/07/2007 11:24:35 AM:
I have some type-level sets using fundeps working
This is great! Two questions:
1) I want to make sure the function arity matches the list length (as a
runtime check). I think I can do this with an arity function using
Data.Typeable. I came up with:
arity f = a (typeOf f) where
a tr | typeRepTyCon tr /= mkTyCon - = 0
| otherwise =
Hi
I want literate Haskell, but where the literate bit forming a document
is actually HTML, not latex. Does anyone have any idea how to go about
this?
For a start, how do I persuade GHC to run the file:
C:\Documents\Uni\tagsouprunhaskell index.html
Warning: ignoring unrecognised input
Hi guys.
Here's a fairly basic question. I have several ideas for programs that
I'd like to write. They all involve placing units of some kind, and
then drawing connections between those units. How feasible is it to
program such a thing in Haskell? Where would you start? (Gtk2hs is the
only
On Dec 7, 2007 6:04 PM, Chris Eidhof [EMAIL PROTECTED] wrote:
On 7 dec 2007, at 23:51, Ryan Bloor wrote:
i am using hugs and the isDigit and anything 'is' doesn't work...
they must have forgot to add them in! Does GHC work with them.
Perhaps you need to import Data.Char?
-Brent
Andrew Coppin andrewcoppin at btinternet.com writes:
[snip]
You might like to look at OpenQuark: http://labs.businessobjects.com/cal/
-- its 'GemCutter' provides a visual environment for linking together functions
written in a Haskell-like language.
I'm not sure if it would be flexible enough
On 7 dec 2007, at 22:55, Ryan Bloor wrote:
hi
The thing is... it will be a simple parser really. The expressions
are already defined and we can't use parsec imports. Below is the
types I have.
I have a function that removes initial spaces from the start of a
string. A function that
oleg-7 wrote:
In fact, that distinction is possible. The following article
How to write an instance for not-a-function
http://okmij.org/ftp/Haskell/typecast.html#is-function-type
specifically describes a method of writing an instance which is
selected only when the type
On Fri, 2007-12-07 at 12:49 -0500, Jeff Polakow wrote:
Hello,
You should be able to use fundeps to do exactly what you describe
below.
Can you make a relatively small self-contained example which
exemplifies the ugliness you see?
Hi Jeff, as well as a minor code explosion if
On Fri, 7 Dec 2007, Andrew Coppin wrote:
Ian Lynagh wrote:
On Tue, Dec 04, 2007 at 03:07:01PM -0800, Ryan Ingram wrote:
Is there a reason why strictness is defined as
f _|_ = _|_
instead of, for example,
forall x :: Exception. f (throw x) = throw x
Errors and exceptions are
On Dec 7, 2007 8:39 PM, Dan Weston [EMAIL PROTECTED] wrote:
compose f g = f . g
compose' f g x = f (g x)
Are you saying that these two exactly equivalent functions should have
different arity? If not, then is the arity 2 or 3?
Prelude :t let compose f g = f . g in compose
let
Ian Lynagh wrote:
On Tue, Dec 04, 2007 at 03:07:01PM -0800, Ryan Ingram wrote:
Is there a reason why strictness is defined as
f _|_ = _|_
instead of, for example,
forall x :: Exception. f (throw x) = throw x
There's discussion along these lines in
Denis Bueno wrote:
On Dec 7, 2007 1:50 PM, Andrew Coppin [EMAIL PROTECTED] wrote:
Hi guys.
Here's a fairly basic question. I have several ideas for programs that
I'd like to write. They all involve placing units of some kind, and
then drawing connections between those units. How feasible is it
On Fri, 7 Dec 2007, Neil Mitchell wrote:
Hi
I want literate Haskell, but where the literate bit forming a document
is actually HTML, not latex. Does anyone have any idea how to go about
this?
The numeric-quest library was the first and only one that I have seen in
this style. I could only
On Dec 7, 2007, at 14:07 , Neil Mitchell wrote:
I want literate Haskell, but where the literate bit forming a document
is actually HTML, not latex. Does anyone have any idea how to go about
this?
You could replace the unlit executable in the GHC library directory
with one which knows how
Jules Bean wrote:
Peter Padawitz wrote:
Functional dependencies don't work in my case. Actually, I don't see
why they should.
Ah well, it's cruel to say that without explaining to us why!
Cause I don't see why the instantiation conflicts pointed out by others
would vanish then.
I'm
On Fri, 2007-12-07 at 19:14 +, Neil Mitchell wrote:
Hi Brandon,
You could replace the unlit executable in the GHC library directory
with one which knows how to extract Haskell code from HTML.
I want a solution so that I can write the tagsoup manual in an way
that can actually be
Hello,
Does the following code work for you?
-Jeff
---
{-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances
-fallow-overlapping-instances #-}
data Nil = Nil
data x ::: xs = x ::: xs
infixr 5 :::
data HTrue = HTrue deriving Show
data HFalse = HFalse deriving
Luke Palmer wrote:
You can project the compile time numbers into runtime ones:
Yes, that works well if I know a priori what the arity of the function
is. But I want to be able to have the compiler deduce the arity of the
function (e.g. by applying undefined until it is no longer a function),
On 7 dec 2007, at 23:51, Ryan Bloor wrote:
i am using hugs and the isDigit and anything 'is' doesn't work...
they must have forgot to add them in! Does GHC work with them.
Yes, it's in base. Alternatively, you could write the functions
yourself, they're not that hard.
p.s... that book looks
On Dec 7, 2007 7:57 PM, Luke Palmer [EMAIL PROTECTED] wrote:
On Dec 7, 2007 7:41 PM, Dan Weston [EMAIL PROTECTED] wrote:
Luke Palmer wrote:
You can project the compile time numbers into runtime ones:
Yes, that works well if I know a priori what the arity of the function
is. But I want
On Dec 7, 2007 7:41 PM, Dan Weston [EMAIL PROTECTED] wrote:
Luke Palmer wrote:
You can project the compile time numbers into runtime ones:
Yes, that works well if I know a priori what the arity of the function
is. But I want to be able to have the compiler deduce the arity of the
function
On 6 dec 2007, at 18:06, Ryan Bloor wrote:
Can anyone advise me on how to check whether a string contains ints,
chars, bools, etc
2345 + 6767 shoudl give IntAdd (2345) (6767)
2345 should give IntT 2345
You need to write a parser. There are a lot of libraries that will
help you write a
40 matches
Mail list logo