I am a newbie. Consider this code:
square x = x * x
add3 x y z = x + y + z
leledumbo wrote:
what about (square . add3) 1 2?
It doesn't work since add3, when curried (arguments of square blended
with add3's) with 1 argument becomes:
add3 :: Num a = a - a - a
which is a
On 1 Dec 2009, at 05:44, Tom Hawkins wrote:
I never considered running Atom generated functions in an asynchronous
loop until you posted your Atomic Fibonacci Server example
(http://leepike.wordpress.com/2009/05/05/an-atomic-fibonacci-server-exploring-the-atom-haskell-dsl/
).
I'm
I dont understand why the above functions are legal, and what arguments
they need. Could you please
give an example of how to invoke it?
Huh? None of them are legal, at least in my WinHugs they're not. What tools
are you using?
Some good reading I found:
leledumbo wrote:
None of them are legal, at least in my WinHugs they're not. What tools are
you using?
1) I am using GHCi. I put the following into a file named composition.hs and
typed :l composition.hs in GHCi. I also did a :browse Main
2) Next, I installed WinHugs, and loaded the same
Duncan Coutts wrote:
On Mon, 2009-11-30 at 06:08 +, Malcolm Wallace wrote:
However, if you really want to terminate the stream at
the first error, and to reflect this in the type, then I guess you can
define your own list type:
data ListThenError e a = Cons a (ListThenError e a)
Luke Palmer wrote:
Hector Guilarte hector...@gmail.com wrote:
f:: [int] - (a,[Int])
f randomList =
let (usedRandomNumber,newRandomList) = g randomList
in (usedRandomNumber,newRandomList)
This pattern can be encapsulated in a monad:
newtype RandM a = RandM { unRandM :: [Int] -
On Mon, 2009-11-30 at 20:10 -0800, John Millikin wrote:
On Mon, Nov 30, 2009 at 03:02, Duncan Coutts
duncan.cou...@googlemail.com wrote:
data ListThenError e a = Cons a (ListThenError e a)
| Error e
Of course this has the disadvantage that then your consumer must
Excerpts from Heinrich Apfelmus's message of Tue Dec 01 11:29:24 +0100 2009:
Duncan Coutts wrote:
On Mon, 2009-11-30 at 06:08 +, Malcolm Wallace wrote:
However, if you really want to terminate the stream at
the first error, and to reflect this in the type, then I guess you can
On Dec 1, 2009, at 2:29 AM, Heinrich Apfelmus wrote:
data Train a b = Wagon a (Train a b)
| Loco b
Surely that should be:
data Train a b = Wagon a (Train a b)
| Caboose b
?
- MtnViewMark
Mark Lentczner
http://www.ozonehouse.com/mark/
Am Dienstag 01 Dezember 2009 10:32:24 schrieb newbie2009:
leledumbo wrote:
None of them are legal, at least in my WinHugs they're not. What tools
are you using?
1) I am using GHCi. I put the following into a file named composition.hs
and typed :l composition.hs in GHCi. I also did a
I'd suggest the Prelude and Data.List
The code is very clear and thoroughly documented.
Knowing what is there will pay off again and again.
- Jason
On Nov 30, 2009, at 5:22 AM, Michael Lesniak wrote:
Hello,
In terms of
to become a great programmer, you need to read great programs[1]
Hello,
thanks for all the advices; will have enough to read for the next
weeks and months! :-)
- Michael
--
Dipl.-Inf. Michael C. Lesniak
University of Kassel
Programming Languages / Methodologies Research Group
Department of Computer Science and Electrical Engineering
Wilhelmshöher Allee 73
On Tue, Dec 1, 2009 at 5:29 AM, Heinrich Apfelmus
apfel...@quantentunnel.de wrote:
Duncan Coutts wrote:
On Mon, 2009-11-30 at 06:08 +, Malcolm Wallace wrote:
However, if you really want to terminate the stream at
the first error, and to reflect this in the type, then I guess you can
Hi,
I am playing around with KiCS and I have a strange problem, when I
evaluate a goal the variable bindings are not displayed, I see only
the value of the expression.
The same expression evaluated in pakcs (another curry interpreter)
displays the bindings correctly.
Is this a known bug?
I
[Tom -- resending my reply---I forgot to post to the list.]
Neil, could you provide a reference (more on the practical side than
the theory side) for the Stochastic Process Algebras you mention? And
is there an embedding in Haskell? :)
Lee
Begin forwarded message:
From: Lee Pike
Dear all, I wrote the following types:
class Transformation t where (+) :: t - SPLModel - InstanceModel - InstanceModel
data Configuration = forall t . Transformation t = Configuration (FeatureExpression, [t]) type ConfigurationKnowledge = [Configuration]
I tried to write a function that
Hi,
I work with Trevor on the other Clutter binding. We did exchange a
few messages with Matt, but we were not sure how to combine the two
libraries because our approaches to writing the binding were a bit
different. In general, I don't think that having two similar
libraries is a huge problem.
On Tue, Dec 1, 2009 at 1:00 PM, rodrigo.bonifacio
rodrigo.bonifa...@uol.com.br wrote:
Dear all, I wrote the following types:
class Transformation t where
(+) :: t - SPLModel - InstanceModel - InstanceModel
data Configuration = forall t . Transformation t = Configuration
On Tue, 1 Dec 2009 10:06:14 -0800
Iavor == Iavor Diatchki iavor.diatc...@gmail.com wrote:
Iavor I work with Trevor on the other Clutter binding. We did
Iavor exchange a few messages with Matt, but we were not sure how to
Iavor combine the two libraries because our approaches to writing the
This is only peripherally related, but I also have a lot of list
functions that can possibly be an error, but usually processing can
continue. So they tend to return [Either Error Result]. I have
another function thus:
-- A foldr version is not lazy enough and overflows the stack.
Am Dienstag 01 Dezember 2009 20:21:27 schrieb Evan Laforge:
This is only peripherally related, but I also have a lot of list
functions that can possibly be an error, but usually processing can
continue. So they tend to return [Either Error Result]. I have
another function thus:
-- A foldr
Hello Haskell Cafe,
I was wondering whether there are any universities that teach about
Haskell type families or GADTs?
Thanks,
Tom
--
Tom Schrijvers
Department of Computer Science
K.U. Leuven
Celestijnenlaan 200A
B-3001 Heverlee
Belgium
tel: +32 16 327544
e-mail:
On Tue, Dec 1, 2009 at 11:21 AM, David Menendez d...@zednenem.com wrote:
On Tue, Dec 1, 2009 at 1:00 PM, rodrigo.bonifacio
rodrigo.bonifa...@uol.com.br wrote:
Dear all, I wrote the following types:
class Transformation t where
(+) :: t - SPLModel - InstanceModel - InstanceModel
data
Say I have the following module:
module A
( T(T)
, t
, val
)
where
data T = T { t :: Int }
val :: T
val = T 7
When I use A with the following imports, I don't expect this to work,
but it does:
import
On Tue, Dec 1, 2009 at 3:11 PM, Sean McLaughlin sean...@gmail.com wrote:
Say I have the following module:
module A
( T(T)
, t
, val
)
where
data T = T { t :: Int }
val :: T
val = T 7
When I use
It looks like it is specified and the intended behavior:
From the report, section 5.2:
An algebraic datatype T declared by a data or newtype declaration may
be named in one of three ways:
The form T names the type but not the constructors or field names. The
ability to export a type without
On Fri, 20 Nov 2009 15:30:49 -0600 Ted Zlatanov t...@lifelogs.com wrote:
TZ A nice property of inversion lists is that inverting them simply
TZ requires removing or adding the minimum possible value at the beginning
TZ of the list. A membership test requires traversal but since the list is
TZ
On Tue, Dec 01, 2009 at 05:11:42PM -0500, Sean McLaughlin wrote:
The problem is that I explicitly didn't export 't' as an element of T
(by not writing T(..)).
Am I just misunderstanding how exports work? I couldn't figure out
what the correct behavior should be by looking at the 98 report.
I'm playing around with some types to represent a game board (like Go,
Chess, Scrabble, etc).
I'm using a type class to represent the basic Board interface, so I can
change the implementation freely:
class Board b pos piece where
-- Update board with piece played at pos
play :: b pos
On Fri, 27 Nov 2009, Henning Thielemann wrote:
On Fri, 27 Nov 2009, Roman Leshchinskiy wrote:
You can get more information (including the ugly tables) from my blog
http://unlines.wordpress.com/2009/11/27/noslow
Btw. storablevector supports 'zip' using
Am Dienstag 01 Dezember 2009 23:34:46 schrieb Jeremy Fitzhardinge:
I'm playing around with some types to represent a game board (like Go,
Chess, Scrabble, etc).
I'm using a type class to represent the basic Board interface, so I can
change the implementation freely:
class Board b pos piece
Hi Ted,
Some tips:
invlist_negate [] = [0]
invlist_negate (0:xs) = xs
invlist_negate xs = 0:xs
You are doing this for generic Num instances, so 0 probably isn't the lower
bound. Haskell has another type class for this: Bounded. Then you can use
minBound instead of 0. Also the first line is
Thanks Luke.
In fact I, will have different implementations of the Transformation type. Something like:
data SelectScenarios = SelectScenarios {
scIds :: [Id]
}
And then I should be able to make SelectScenarios a kind of Transformation. So I think that I really need a class. What do you think
You probably don't want that minBound in the pattern, but rather as a
comparison in a guard.
Dan
On Tue, Dec 1, 2009 at 6:14 PM, Sjoerd Visscher sjo...@w3future.com wrote:
Hi Ted,
Some tips:
invlist_negate [] = [0]
invlist_negate (0:xs) = xs
invlist_negate xs = 0:xs
You are doing this
Am Dienstag 01 Dezember 2009 23:31:10 schrieb Ted Zlatanov:
On Fri, 20 Nov 2009 15:30:49 -0600 Ted Zlatanov t...@lifelogs.com wrote:
TZ A nice property of inversion lists is that inverting them simply
TZ requires removing or adding the minimum possible value at the beginning
TZ of the list.
Hi
On Tue, Dec 1, 2009 at 11:02 AM, Gour g...@gour-nitai.com wrote:
Iavor In general, I don't think that having two similar libraries is a
Iavor huge problem. I tend to do this kind of hacking for fun, and I
Iavor really do not enjoy the competition that is being encouraged
Iavor when we try
On 12/01/09 15:12, Daniel Fischer wrote:
Am Dienstag 01 Dezember 2009 23:34:46 schrieb Jeremy Fitzhardinge:
I'm playing around with some types to represent a game board (like Go,
Chess, Scrabble, etc).
I'm using a type class to represent the basic Board interface, so I can
change the
newtype Transformation = Transformation {
(+) :: SPLModel - InstanceModel - InstanceModel
}
data SelectScenarios = SelectScenarios { scIds :: [Id] }
scenarioTransform scenario = Transformation $ \spl inst - something
testScenario = SelectScenarios []
test = scenarioTransform testScenario
On Tue, Dec 1, 2009 at 4:21 PM, rodrigo.bonifacio
rodrigo.bonifa...@uol.com.br wrote:
Thanks Luke.
In fact I, will have different implementations of the Transformation type.
Something like:
data SelectScenarios = SelectScenarios {
scIds :: [Id]
}
What is this different type buying you?
Perhaps someone could either (1) help me do what I'm trying to do, or (2) show
me a better way.
I have a problem that is very state-ful and I keep thinking of it as OO, which
is driving me crazy. Haskell is several times harder to use than Python in this
instance, probably because I'm doing
I think these topics have been covered in
http://www.cas.mcmaster.ca/~kahl/FP/2009/
Christopher
On Tue, 1 Dec 2009 22:38:14 +0100 (CET)
Tom Schrijvers tom.schrijv...@cs.kuleuven.be wrote:
Hello Haskell Cafe,
I was wondering whether there are any universities that teach about
Haskell type
Please check out Paul Hudak's page.
http://cs-www.cs.yale.edu/homes/hudak-paul/
On Tue, 01 Dec 2009 17:01:29 -0800, you wrote:
Perhaps someone could either (1) help me do what I'm trying to do, or (2) show
me a better way.
I have a problem that is very state-ful and I keep thinking of it as
Am Mittwoch 02 Dezember 2009 01:43:04 schrieb Jeremy Fitzhardinge:
On 12/01/09 15:12, Daniel Fischer wrote:
Am Dienstag 01 Dezember 2009 23:34:46 schrieb Jeremy Fitzhardinge:
I'm playing around with some types to represent a game board (like Go,
Chess, Scrabble, etc).
I'm using a type
Thanks for the reply. Was there something specific you were referring to,
or just the idea that he wrote Haskore? Haskore is not very closely related
to what I'm trying to do. I believe he has a CSound back end for Haskore,
but it is in a rough state and not closely related to what I'm trying
On Tue, Dec 1, 2009 at 8:01 PM, Michael P Mossey m...@alumni.caltech.eduwrote:
Perhaps someone could either (1) help me do what I'm trying to do, or (2)
show me a better way.
I have a problem that is very state-ful and I keep thinking of it as OO,
which is driving me crazy. Haskell is
On Tue, Dec 1, 2009 at 9:01 PM, Robert Greayer robgrea...@gmail.com wrote:
On Tue, Dec 1, 2009 at 8:01 PM, Michael P Mossey
m...@alumni.caltech.eduwrote:
Perhaps someone could either (1) help me do what I'm trying to do, or (2)
show me a better way.
I have a problem that is very
Am Mittwoch 02 Dezember 2009 02:01:29 schrieb Michael P Mossey:
Perhaps someone could either (1) help me do what I'm trying to do, or (2)
show me a better way.
I have a problem that is very state-ful and I keep thinking of it as OO,
which is driving me crazy. Haskell is several times harder
Daniel Fischer wrote:
getNumber :: String - AssignedNumbers - (Int,AssignedNumbers)
Yeah, that screams State Monad.
Hi, thanks for all the advice.
I was hoping my AssignedNumbers class would be useful with many data
structures. In other words I would have
data State1 = State1 { a ::
Am Mittwoch 02 Dezember 2009 03:28:04 schrieb Michael Mossey:
Daniel Fischer wrote:
getNumber :: String - AssignedNumbers - (Int,AssignedNumbers)
Yeah, that screams State Monad.
Hi, thanks for all the advice.
I was hoping my AssignedNumbers class would be useful with many data
Tom Schrijvers wrote,
I was wondering whether there are any universities that teach about Haskell
type families or GADTs?
I do in my course Language-based Software Safety (both TFs and GADTs). It's
an advanced, research-oriented course for 4th year undergraduate and for
postgraduate
On 12/01/09 17:38, Daniel Fischer wrote:
Am Mittwoch 02 Dezember 2009 01:43:04 schrieb Jeremy Fitzhardinge:
On 12/01/09 15:12, Daniel Fischer wrote:
Am Dienstag 01 Dezember 2009 23:34:46 schrieb Jeremy Fitzhardinge:
I'm playing around with some types to represent a game board
Tom,
I was wondering whether there are any universities that teach about
Haskell type families or GADTs?
I'm quite sure at least GADTs are covered in INFOMAFP, the graduate
course on Advanced Functional Programming at UU:
http://www.cs.uu.nl/docs/vakken/afp
Cheers,
Stefan
I was wondering why Parsec's buildExpressionParser doesn't allow
prefix expressions to be handled recursively, e.g. given a prefix !
operation, it seems that !!a could parse without requiring
parentheses (!(!a)). Is there an easy way to extend it? (I have a
rich expression grammar I'd like
53 matches
Mail list logo