Look also at safe package http://hackage.haskell.org/package/safe
2012/3/13 Chris Wong chrisyco+haskell-c...@gmail.com
On Tue, Mar 13, 2012 at 12:24 PM, Chris Smith cdsm...@gmail.com wrote:
On Mon, Mar 12, 2012 at 3:14 PM, Kevin Clees k.cl...@web.de wrote:
Now my function looks like this:
I'm running a project where i want to generate a map of a rather large
data collection. The map is if the form: Data.Map.Map String a
I'd like to be able to do inexact lookups on the map. Firstly, ignore
the difference between upper lower case, that's easy. But secondly, have
a function:
Kevin Clees k.cl...@web.de writes:
Now my function looks like this:
tmp:: [(Int, Int)] - Int - (Int, Int)
tmp [] y = (0,0)
^
tmp xs y = xs !! (y-1)
If the function returns (0,0) it will blocked by another function.
Personally, I think using special values like this is
Am 13.03.2012 um 09:15 schrieb Morten Olsen Lysgaard:
I'm running a project where i want to generate a map of a rather large data
collection. The map is if the form: Data.Map.Map String a
I'd like to be able to do inexact lookups on the map. Firstly, ignore the
difference between upper
My dear Haskell folks,
I work in a software company where I develop components that go into a
really complex system that's built of several components developed by
different teams that are geographically distributed. The components
themselves run in a distributed manner across client and several
You can still join us at the DHD = UHac, but the time is running out.
http://www.haskell.org/haskellwiki/DHD_UHac
Deadline: April 1 (no fooling!)
We've also have a few updates:
* We put the DHD program up, at least as much of it as we have.
Hi all,
I've recently started to move my tests to use the new cabal test-suite
framework.
Old setup:
The cabal file compiles one library + a few executables. The library
contains almost all of the code and exposes the necessary modules for use
by the executables. The executables mainly consist
On Tue, Mar 13, 2012 at 11:16 AM, Ozgur Akgun ozgurak...@gmail.com wrote:
While waiting for a build to finish [ :) ], I just wanted to write an email
and check if this is intentional or only an oversight. Or maybe a technical
limitation for the time being?
If your library code and test code
On 13 March 2012 16:22, Antoine Latter aslat...@gmail.com wrote:
If your library code and test code are in separate sub-directories and
you reference your library as a package dependency for your test then
Cabal won't re-build your library.
Yay! That was it. Thanks.
Somehow I altered the
On Tue, Mar 13, 2012 at 6:14 AM, Holger Siegel holgersiege...@yahoo.de wrote:
Am 13.03.2012 um 09:15 schrieb Morten Olsen Lysgaard:
I'd like to be able to do inexact lookups on the map. Firstly, ignore the
difference between upper lower case, that's easy. But secondly, have a
function:
Dear Haskellers,
I'm trying to define a polymorphic add function which takes a variable
number of arguments (instance of Num) and returns their sum. I don't want
to specify the types of the arguments while calling the function, I just
want to , at most, specify the return type (*it should infer
Can someone tell me why this is not working
that someone is actually ghci:
Prelude instance (Num a, Add a b) = Add (a - b) where add x y = add (x + y)
interactive:8:30:
Expecting one more argument to `Add (a - b)'
In the instance declaration for `Add (a - b)'
I'm sorry this was a typo. Here's the correct one:
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}
class Add a b where
add :: a - b
instance Num a = Add a a where
add = id
instance (Num a, Add a b) = Add a (a - b) where
add x y = add (x + y)
I'm trying to use the printf
The problem seems to be that numeric literals are polymorphic.
With your code, this works:
*Main let x = 8 :: Int
*Main add x x x :: Int
24
*Main add x x :: Int
16
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Hi all,
The derived Show instance is useful, but I sometimes wish for
something that's easier to read for big data types. Does anyone have
an implementation of show that draws things in a hierarchical manner?
Example:
Given
data Tree a = Leaf | Bin Int a (Tree a) (Tree a)
and
value =
It's not exactly hierarchical, but Groom most certainly should help
with getting much prettier output:
http://hackage.haskell.org/package/groom
On Tue, Mar 13, 2012 at 5:33 PM, Johan Tibell johan.tib...@gmail.com wrote:
Hi all,
The derived Show instance is useful, but I sometimes wish for
On 03/13/2012 10:33 PM, Johan Tibell wrote:
value = Bin 1 (Bin 2 Leaf Leaf) (Bin 3 Leaf Leaf)
I'm usually using the following snippet which is a tweak of the gshow function
from syb.
However everything need to be a member of Data/Typeable, and also list are not
particularly well handled with
I prefer pretty-show rather than groom as it's output is hierarchical.
http://hackage.haskell.org/package/pretty-show
Ozgur
On 13 March 2012 22:37, Austin Seipp mad@gmail.com wrote:
It's not exactly hierarchical, but Groom most certainly should help
with getting much prettier output:
Maybe an Emacs script to expand the nodes nicely:
http://www.youtube.com/watch?v=6ofEZQ7XoEA I don't find mere pretty
printing that useful compared to the “expanding” paradigm I'm used to in
Chrome and Firebug.
To try it just M-x eval-buffer on these two files,
Hi,
Just thinking aloud :
A way to start is to define concrete workflows for concrete events. What
It is necessary to do if. This may make things more explicit and to
clarify the problems. .Later, .maybe. these concrete workflows can be
abstracted away from procedural/imperative to declarative
data Common = ...
data A = ...
data B = ...
data C = ...
data Super =
SubA { commonFields :: Common, getA :: A }
| SubB { commonFields :: Common, getB :: B }
| SubC { commonFields :: Common, getC :: C }
foldWithSubtype :: (A - r) - (B - r) - (C - r) - Super - r
foldWithSubtype k _ _
Why not
data Super
= SuperA {
commonFields :: ()
aFields :: ()
}
| SuperB {
commonFields :: ()
bFields :: ()
}
| SuperC {
commonFields :: ()
On Sun, Mar 11, 2012 at 8:38 PM, E R pc88m...@gmail.com wrote:
A pure function can allocate and modify memory as long as a) it never
returns a reference to the memory or b) it never again modifies the
memory once it returns (i.e. it returns an immutable object).
That's a reasonable first
23 matches
Mail list logo