On Fri, 30 Jul 2010, Ben wrote:
dear traversable geniuses --
i am looking for better implementations of
unzipMap :: M.Map a (b, c) - (M.Map a b, M.Map a c)
unzipMap m = (M.map fst m, M.map snd m)
Maybe:
mapPair (M.fromAscList, M.fromAscList) $
unzip $ map (\(a,(b,c)) - ((a,b),
On Fri, 30 Jul 2010, John Meacham wrote:
Heh. I was just thinking I needed type level naturals last night at the
pub.
I thought about type level naturals yesterday when working with HList and
found that HList's dependency on TemplateHaskell is quite heavy.
I wanted to support gcc's
On 31 July 2010 06:45, wren ng thornton w...@freegeek.org wrote:
Ben wrote:
dear traversable geniuses --
i am looking for better implementations of
unzipMap :: M.Map a (b, c) - (M.Map a b, M.Map a c)
unzipMap m = (M.map fst m, M.map snd m)
I don't think you can give a more efficient
hi,
try it this way:
http://gist.github.com/501951
note the type annotations and the added req param include_docs=true for
getAllDocs.
the first error is created by ghci, since it dont know the specific type
Database.CouchDB :t runCouchDB' $ getDoc (db test) (doc xyz)
runCouchDB' $ getDoc
On Fri, 30 Jul 2010 15:20:55 -0700
John Meacham j...@repetae.net wrote:
type family Add n m :: *
type instance Add Zero Zero = Zero
type instance Add Zero (SuccessorTo n) = SuccessorTo n
type instance Add (SuccessorTo n) m= SuccessorTo (Add n m)
Standard package
On Fri, Jul 30, 2010 at 08:13:43PM -0700, Ben wrote:
dear traversable geniuses --
i am looking for better implementations of
unzipMap :: M.Map a (b, c) - (M.Map a b, M.Map a c)
unzipMap m = (M.map fst m, M.map snd m)
unliftMap :: (Ord a) = M.Map a (b - c) - M.Map a b - M.Map a c
Do most people who work with haskell use emacs/vi/eclipse or something
else??
Personal Note: I used gofer some 15 years ago. At that time I hacked
up a emacs mode (I did not know of any then) along with some changes
to gofer to have gofer inside emacs rather than vi inside gofer.
Things have
Jason Catena wrote:
On Jul 30, 11:17 am, Anton van Straaten wrote:
Prelude :m Control.Monad.State
Prelude Control.Monad.State let addToState :: Int - State Int ();
addToState x = do s - get; put (s+x)
Prelude Control.Monad.State let mAdd4 = addToState 4
Prelude Control.Monad.State :t mAdd4
m ::
Rustom Mody rustompm...@gmail.com writes:
Do most people who work with haskell use emacs/vi/eclipse or something
else??
Most people seem to use either Emacs, a vi-like editor or some other
specialised editor (TextMate, etc.). Some people do use the Haskell
editor yi (available on Hackage);
On Sat, Jul 31, 2010 at 12:07 PM, Rustom Mody rustompm...@gmail.com wrote:
Do most people who work with haskell use emacs/vi/eclipse or something
else??
I use Emacs and haskell-mode.
Johan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
leksah
2010/7/31 Johan Tibell johan.tib...@gmail.com
On Sat, Jul 31, 2010 at 12:07 PM, Rustom Mody rustompm...@gmail.comwrote:
Do most people who work with haskell use emacs/vi/eclipse or something
else??
I use Emacs and haskell-mode.
Johan
On Windows, I've used cedit for various projects for years and was
delighted to discover that it comes with a Haskell syntax colouring
file.
See:
http://cedit.sourceforge.net/
It supports collections of project files and compiling directly from
the editor.
I also use Eclipse for (sigh) PHP
Stephen Tetley wrote:
wren ng thornton wrote:
Ben wrote:
unzipMap :: M.Map a (b, c) - (M.Map a b, M.Map a c)
unzipMap m = (M.map fst m, M.map snd m)
I don't think you can give a more efficient implementation using the public
interface of Data.Map. You need to have a sort of mapping function
On 31/07/10 12:13, wren ng thornton wrote:
Stephen Tetley wrote:
wren ng thornton wrote:
Ben wrote:
unzipMap :: M.Map a (b, c) - (M.Map a b, M.Map a c)
unzipMap m = (M.map fst m, M.map snd m)
I don't think you can give a more efficient implementation using the
public
interface of Data.Map.
Brent Yorgey byor...@seas.upenn.edu wrote:
On Fri, Jul 30, 2010 at 03:46:09AM -0700, Kevin Jardine wrote:
When I plunged into Haskell earlier this year, I had no problem with
understanding static typing, higher level functions and even
separating pure functions from IO functions.
The
On 31 July 2010 12:13, wren ng thornton w...@freegeek.org wrote:
Well, that's one traversal of the original map, but you have to traverse the
new maps repeatedly with all those M.insert calls. And since Data.Map is a
balanced tree, that could lead to a whole lot of work rebalancing things.
Hello I have a question regarding monad transformers and how to design
an API with a transformer. I have a narrowed code example of the
question. Please see the questions in the comments below.
import Data.Monoid
import Control.Monad
-- Suppose some data type
newtype Inter a = Inter (Int - a)
On Sat, Jul 31, 2010 at 10:56:31PM +1000, Tony Morris wrote:
-- Suppose some data type
newtype Inter a = Inter (Int - a)
-- and a monad transformer for that data type.
newtype InterT m a = InterT (m (Inter a))
The monad transformer should be Inter (m a).
Dear Edward,
I hope that there is a more orc integrated solution. I think the
scenario I described here is quite common.
Günther
Am 31.07.10 00:16, schrieb Edward Z. Yang:
Excerpts from Günther Schmidt's message of Fri Jul 30 16:16:38 -0400 2010:
I'd like to download 1,000 web pages with
SPJ http://research.microsoft.com/en-us/people/simonpj/default.aspx and
probably many others are actually employed at Microsoft research centers. It
looks like Microsoft just hasn't been able to find a suitable spot to push
Haskell. Haskell influenced F# because they needed a functional language
gah you're right, @mtl had confuzzled me.
Well that changes things then, thanks.
Ross Paterson wrote:
On Sat, Jul 31, 2010 at 10:56:31PM +1000, Tony Morris wrote:
-- Suppose some data type
newtype Inter a = Inter (Int - a)
-- and a monad transformer for that data type.
newtype InterT m
From: Data.Complex
data (RealFloat a) = Complex a
= !a :+ !a
What's the purpose of the exclamation marks?
Michael
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On 31/07/10 13:49, Stephen Tetley wrote:
Although I haven't calculated the Big-O scores suspect that original
post will actually be the best, the solutions that metamorph into a
list and out again look like they're doing needless extra work.
They're both O(size m) time, and yes the original is
michael rice nowg...@yahoo.com writes:
From: Data.Complex
data (RealFloat a) = Complex a
= !a :+ !a
What's the purpose of the exclamation marks?
Forcing; it means that the values are evaluated (up to WHNF) before the
Complex value is constructed:
I guess that the house
OShttp://www.google.com/search?hl=ensafe=offq=+house+OS+haskellaq=faqi=g-sx7aql=oq=gs_rfai=has
no one of these problems that singularity tries to solve in the first
place.
The problem of general OSs is: we have unsafe code, so what we do to deal
with it?. The usual option
Thanks, Ivan.
I may be back later, after I read
http://en.wikibooks.org/wiki/Haskell/Laziness
Michael
--- On Sat, 7/31/10, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote:
From: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com
Subject: Re: [Haskell-cafe] Constructor question
To: michael
On Sat, Jul 31, 2010 at 2:32 PM, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
Forcing; it means that the values are evaluated (up to WHNF) before the
Complex value is constructed:
http://www.haskell.org/ghc/docs/6.12.1/html/users_guide/bang-patterns.html
Actually, this isn't a
On Saturday 31 July 2010 8:13:37 am Ertugrul Soeylemez wrote:
I agree to some extent, but only to some. Mostly the problem of people
is that they are trying to understand monads as opposed to specific
instances. It's better to learn the IO monad, state monads, the
list monad, the Maybe
Ben Millwood hask...@benmachine.co.uk writes:
On Sat, Jul 31, 2010 at 2:32 PM, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
Forcing; it means that the values are evaluated (up to WHNF) before the
Complex value is constructed:
Hi,
Am Samstag, den 31.07.2010, 15:37 +0530 schrieb Rustom Mody:
Do most people who work with haskell use emacs/vi/eclipse or something
else??
Personal Note: I used gofer some 15 years ago. At that time I hacked
up a emacs mode (I did not know of any then) along with some changes
to gofer
This Joni Mitchell lyric just popped into my head:
I've looked at clouds from both sides now
From up and down, and still somehow
It's cloud illusions I recall
I really don't know clouds at all
A LOT of cool stuff here, but the learning curve is murder.
Michael
--- On Sat, 7/31/10, Ivan Lazar
Ok, got ! and WHNF.
Thanks,
Michael
--- On Sat, 7/31/10, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote:
From: Ivan Lazar Miljenovic ivan.miljeno...@gmail.com
Subject: Re: [Haskell-cafe] Constructor question
To: michael rice nowg...@yahoo.com
Cc: haskell-cafe@haskell.org
Date: Saturday,
From: http://en.wikibooks.org/wiki/Haskell/Laziness
Given two functions of one parameter, f and g, we say f is stricter than g if f
x evaluates x to a deeper level than g x
Exercises
1. Which is the stricter function?
f x = length [head x]
g x = length (tail x)
Prelude let f x = length
michael rice schrieb:
So, g is stricter than f?
Wouldn't both functions need to evaluate x to the same level, *thunk* :
*thunk* to insure listhood?
No. :-)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Sat, Jul 31, 2010 at 4:56 PM, michael rice nowg...@yahoo.com wrote:
From: http://en.wikibooks.org/wiki/Haskell/Laziness
Given two functions of one parameter, f and g, we say f is stricter than g if
f x evaluates x to a deeper level than g x
Exercises
1. Which is the stricter
OK, in f, *length* already knows it's argument is a list.
In g, *length* doesn't know what's inside the parens, extra evaluation there.
So g is already ahead before we get to what's inside the [] and ().
But since both still have eval x to *thunk* : *thunk*, g evaluates to a
deeper level?
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 7/31/10 12:59 , michael rice wrote:
OK, in f, *length* already knows it's argument is a list.
In g, *length* doesn't know what's inside the parens, extra evaluation
there. So g is already ahead before we get to what's inside the [] and ().
Hello:
I am trying to load hxt into my Haskell Platform 2010.2.0.0 on OSX. I
get the following bizarre comment:
David-Places-Mac-Mini:dev2 davidplace$ cabal install hxt
Resolving dependencies...
cabal: dependencies conflict: ghc-6.12.3 requires directory ==1.0.1.1 however
directory-1.0.1.1
On Sat, Jul 31, 2010 at 5:59 PM, michael rice nowg...@yahoo.com wrote:
OK, in f, *length* already knows it's argument is a list.
In g, *length* doesn't know what's inside the parens, extra evaluation there.
So g is already ahead before we get to what's inside the [] and ().
According to the
On 10-07-31 01:30 PM, Brandon S Allbery KF8NH wrote:
On 7/31/10 12:59 , michael rice wrote:
But since both still have eval x to *thunk* : *thunk*, g evaluates to a
deeper level?
The whole point of laziness is that f *doesn't* have to eval x.
To elaborate, in computer-friendly syntax:
f x
Hello,
The Takusen team would like to announce the latest release of Takusen,
0.8.6. This is primarily a bug fix and test suite enhancement
release. The most notable new feature is limited support for string
encodings with ODBC. The full list of changes is included at the
at the end of this
From Hoogle:
Query: (:[])
Error:
unexpected :
expecting #, ,, forall, (, [, ! or )
Bad symbol
Prelude let h = length . (:[]) . head
Prelude h undefined
1
Prelude :t (:[])
(:[]) :: a - [a]
Prelude h []
1 this comes as a surprise
Prelude
Are you saying:
[ head x ] -
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 7/31/10 14:24 , michael rice wrote:
Are you saying:
[ head x ] - [ *thunk* ] and length [ *thunk* ] - 1, independent of
what *thunk* is, even head [], i.e., *thunk* never needs be evaluated?
Exactly. (I was being cagey because the
michael rice wrote:
f x = length [head x]
g x = length (tail x)
Wouldn't both functions need to evaluate x to the same level, *thunk* :
*thunk* to insure listhood?
There is no need to insure listhood at run time, since Haskell is
statically typed.
Tillmann
Subtle stuff.
Thanks, everyone, for your patience. You've been VERY helpful. Great list!
Michael
--- On Sat, 7/31/10, Brandon S Allbery KF8NH allb...@ece.cmu.edu wrote:
From: Brandon S Allbery KF8NH allb...@ece.cmu.edu
Subject: Re: [Haskell-cafe] Laziness question
To: haskell-cafe@haskell.org
Is it possible to delete an element from heterogenous list using type
families alone?
I can do it using multiparameter type classes:
class Del a list result
instance Del a (a,list) list
instance Del a list list' = Del a (a',list) list'
instance Del a () ()
I tried to express the same using type
Haskell's great and all but it does have a few warts when it comes to how
much real trust one should put into the type system.
Some compromises still exist like unsafePerformIO that you can't detect
simply by looking at the types of functions.
In order to live up to the hype and the marketing
Claude Heiland-Allen wrote:
On 31/07/10 12:13, wren ng thornton wrote:
Stephen Tetley wrote:
wren ng thornton wrote:
Ben wrote:
unzipMap :: M.Map a (b, c) - (M.Map a b, M.Map a c)
unzipMap m = (M.map fst m, M.map snd m)
I don't think you can give a more efficient implementation using the
wren ng thornton wrote:
That O(n)+O(n) is much better than the O(n)*2*O(log n)
foldrWithKey/insert version. But it's still about the same as the
original 2*O(n) map fst/map snd version. With the primitive I mentioned
we could reduce the constant factor by about half.
Oops, the
2010/7/31 David Leimbach leim...@gmail.com:
Haskell's great and all but it does have a few warts when it comes to how
much real trust one should put into the type system.
Some compromises still exist like unsafePerformIO that you can't detect
simply by looking at the types of functions.
Each monad implementation is different. In the case of the State monad your
'execState' call extracts a non-monadic value.
Of the basic monads I found the State monad the most confusing because of
the complicated way in which it threads state through the computation. In
the end, desugaring the
David Leimbach wrote:
Haskell's great and all but it does have a few warts when it comes to how
much real trust one should put into the type system.
Some compromises still exist like unsafePerformIO that you can't detect
simply by looking at the types of functions.
In order to live up to the
Brandon S Allbery KF8NH wrote:
michael rice wrote:
Are you saying:
[ head x ] - [ *thunk* ] and length [ *thunk* ] - 1, independent of
what *thunk* is, even head [], i.e., *thunk* never needs be evaluated?
Exactly. (I was being cagey because the first response was cagey, possibly
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 7/31/10 16:58 , wren ng thornton wrote:
Brandon S Allbery KF8NH wrote:
michael rice wrote:
Are you saying:
[ head x ] - [ *thunk* ] and length [ *thunk* ] - 1, independent of
what *thunk* is, even head [], i.e., *thunk* never needs be
On Sat, Jul 31, 2010 at 5:23 PM, David Leimbach leim...@gmail.com wrote:
Does Singularity also have such back doors?
The CLR doesn't load machine code, it loads bytecodes. So it is
possible to statically analyse the module and see hmmm, this module
uses unsafePerformIO, I'll reject it. If the
And note that we wouldn't need unsafePerformIO for the FFI if all
programs were made in Haskell ;).
Perhaps that's true, though entirely unrealistic, in the application
world. In the OS world you need access to machine registers and
special instructions (CR3 anyone? CP15?) which isn't built
dear applicative geniuses --
thanks for all the help. some comments :
1) the fromList / unzip versions are nice but as others have pointed
out, construction is more expensive than traversal (or traversal w/
copying, like Data.Map.map.) hopefully the maintainers of Data.Map et
al will consider
Thomas DuBuisson wrote:
And note that we wouldn't need unsafePerformIO for the FFI if all
programs were made in Haskell ;).
Perhaps that's true, though entirely unrealistic, in the application
world. In the OS world you need access to machine registers and
special instructions (CR3 anyone?
On Sat, Jul 31, 2010 at 8:27 PM, wren ng thornton w...@freegeek.org wrote:
Thomas DuBuisson wrote:
And note that we wouldn't need unsafePerformIO for the FFI if all
programs were made in Haskell ;).
Perhaps that's true, though entirely unrealistic, in the application
world. In the OS world
Ben wrote:
4) ross, i had to ask ghci to even believe your code type-checks! i
didn't realize currying worked that way -- i've never thought to pass
in functions of different arities. as an experiment, i tried
N.B. intersectionWith id == intersectionWith ($), which might cause it
to make a
On Jul 31, 7:21 pm, Joachim Breitner m...@joachim-breitner.de wrote:
Hi,
Am Samstag, den 31.07.2010, 15:37 +0530 schrieb Rustom Mody:
Do most people who work with haskell use emacs/vi/eclipse or something
else??
Personal Note: I used gofer some 15 years ago. At that time I hacked
up
61 matches
Mail list logo