On Mon, Jun 28, 2010 at 12:33 AM, Daniel Fischer
wrote:
> On Sunday 27 June 2010 21:52:18, Victor Nazarov wrote:
>> I've allways found code like
>>
>> > -- maxBound (undefined :: Int)
>>
>> a bit strange
>
> Well, that would indeed be a bit strange since
>
> maxBound :: (Bounded a) => a
>
> and fu
On 28 June 2010 05:52, Victor Nazarov wrote:
> Having this in my mind I've decided that this code should be
> rewritten without undefined being mentioned. But I need some
> type signature and it should mention Int type. So I've got an
> idea about what I've called "fantom type functions".
> So wee
On Sun, Jun 27, 2010 at 6:45 PM, Max Bolingbroke wrote:
> On 27 June 2010 22:20, Edward Kmett wrote:
> > I've pointed out the Codensity Set monad on the Haskell channel.
>
> I spend no time on #haskell but clearly I should :)
>
> > It is an
> > interesting novelty, but it unfortunately has somew
Max Bolingbroke wrote:
I don't actually know what the right name for this data type is, I
just invented it and it seems to work:
-- (>>>) :: forall a b. t a b -> (forall c. t b c -> t a c)
newtype Wotsit t a b = Wotsit { runWotsit :: forall c. t b c -> t a c }
There is of course no reason to
On 27 June 2010 22:20, Edward Kmett wrote:
> I've pointed out the Codensity Set monad on the Haskell channel.
I spend no time on #haskell but clearly I should :)
> It is an
> interesting novelty, but it unfortunately has somewhat funny semantics in
> that the intermediate sets that you obtain ar
Andrew Bromage wrote:
> > But honestly, it's just not that hard to do in linear time, assuming
> > the symbols are sorted by frequency:
>
> Or maybe not so easy.
But not much harder.
data Tree a = Branch (Tree a) (Tree a)
| Leaf a
deriving Show
huffmanTree :: (Ord a, Num a) =>
On Mon, Jun 28, 2010 at 12:00 AM, Alexander Solla wrote:
>
> On Jun 27, 2010, at 12:29 PM, Alexey Khudyakov wrote:
>
>> This is of course faster but what I really want is vectors with length
>> parametrized by type. This way I can write generic code. Uniform
>> representation is requirement for th
On Sun, Jun 27, 2010 at 7:43 AM, Sjoerd Visscher wrote:
> Hi Max,
>
> This is really interesting!
>
> > 1. There exist total functions:
> >
> >> lift :: X d => d a -> D a
> >> lower :: X d => D a -> d a
> >
> > 2. And you can write a valid instance:
> >
> >> instance X D
> >
> > With *no superclas
On Sun, Jun 27, 2010 at 6:25 AM, Max Bolingbroke wrote:
> By the way, you can use this stuff to solve the restricted monad
> problem (e.g. make Set an instance of Monad). This is not that useful
> until we find out what the mother of all MonadPlus is, though, because
> we really need a MonadPlus
On Sunday 27 June 2010 21:52:18, Victor Nazarov wrote:
> I've allways found code like
>
> > -- maxBound (undefined :: Int)
>
> a bit strange
Well, that would indeed be a bit strange since
maxBound :: (Bounded a) => a
and function types aren't instances of Bounded, so it'd be
maxBound :: Int
max
On 27 June 2010 19:14, Max Bolingbroke wrote:
> I'm going to try for normalisation of Lindleys idiom calculus now.
Made me sweat, but I got it to work. From "Thingy" you get a free
one-pass normaliser for idioms. Is this a novel result? It's certainly
very cool!
Term language:
\begin{code}
type
On Jun 27, 2010, at 12:29 PM, Alexey Khudyakov wrote:
This is of course faster but what I really want is vectors with length
parametrized by type. This way I can write generic code. Uniform
representation is requirement for that.
You're going to need dependent types, or a similar construction
I've allways found code like
> -- maxBound (undefined :: Int)
a bit strange as any usage of undefined is.
Being Ruby on Rails developer
I've personally found that one of the main
Rails motos is being as readable as possible.
Code must be as close to english as possible.
Embeded DSLs like rspec ar
On Sun, 27 Jun 2010 19:55:21 +1000
Roman Leshchinskiy wrote:
> On 25/06/2010, at 06:41, Alexey Khudyakov wrote:
>
> > Then constructor like one below arise naturally. And I don't know how to
> > write
> > them properly. It's possible to use fromList but then list could be
> > allocated
> > whi
Hello,
I just discovered this little jewel on Dan Piponi's blog.
http://blog.sigfpe.com/2010/03/partial-ordering-of-some-category.html
I'm just posting the link so that it doesn't get overlooked, would be a
real shame.
Günther
___
Haskell-Cafe mai
On 27 June 2010 18:28, Max Bolingbroke wrote:
> I'm going to try automatically deriving a NBE algorithm for Moggi's
> monadic metalanguage from the Codensity monad - with luck it will
> correspond to the one-pass algorithm of Danvy.
Well, that works. On second thoughts, it's more akin to A-normal
On Sun, Jun 27, 2010 at 1:26 PM, Sebastian Fischer
wrote:
> Hi Max,
>
> very interesting observations!
>
>> By the way, you can use this stuff to solve the restricted monad
>> problem (e.g. make Set an instance of Monad). This is not that useful
>> until we find out what the mother of all MonadPlu
On 27 June 2010 13:16, Sjoerd Visscher wrote:
> Allowing Functor i also makes defining Thingy directly (without going though
> Monoidal) easy:
>
> newtype Thingy i a = Thingy { runThingy :: forall b. i (a -> b) -> i b }
Great stuff! I particularly like your <*> definition, because it
mirrors the
Hi Max,
very interesting observations!
By the way, you can use this stuff to solve the restricted monad
problem (e.g. make Set an instance of Monad). This is not that useful
until we find out what the mother of all MonadPlus is, though, because
we really need a MonadPlus Set instance.
I'm not
On Sun, 27 Jun 2010, Bertram Felgenhauer wrote:
If the compiler had produced
Main.lvl3 =
case Main.ds of wild_Xw { (prefix_aCf, suffix_aCh) ->
suffix_aCh
}
Main.lvl4 = Main.go1 Main.lvl3
instead, then there would not be a leak. This whole record selector
thunk business is very fra
On 27 June 2010 16:07, Felipe Lessa wrote:
> On Sun, Jun 27, 2010 at 10:54:08AM +0100, Max Bolingbroke wrote:
>> Example 2: Codensity is the mother of all Monads
>
> I thought the continuation monad was the mother of all monads. :)
I actually already referenced Dan's article, and stole the vocabu
On 27 June 2010 14:30, Roman Leshchinskiy wrote:
> In that case, isn't D just the dictionary for (X d) and a value of type (d
> a)? I.e., couldn't we always define it as:
>
> data D d a where { D :: X d => d a -> D d a }
I wondered about this, but how would you write e.g. the "return"
method for
On Sun, Jun 27, 2010 at 10:54:08AM +0100, Max Bolingbroke wrote:
> Example 2: Codensity is the mother of all Monads
I thought the continuation monad was the mother of all monads. :)
For example, see [1].
Cheers!
[1] http://blog.sigfpe.com/2008/12/mother-of-all-monads.html
--
Felipe.
___
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 6/27/10 03:11 , Roman Beslik wrote:
> No! The target encoding is the current locale. It is a no-brainer to find
> it. Use your Unix.
> $ man setlocale
> $ locale
So you want to use someone else's file, and their locale isn't the same as
yours. Wha
On 27/06/2010, at 19:54, Max Bolingbroke wrote:
> Q: What is the "mother of all X", where X is some type class?
> A: It is a data type D such that:
>
> 1. There exist total functions:
>
>> lift :: X d => d a -> D a
>> lower :: X d => D a -> d a
Are those universally quantified over d? If so, th
Allowing Functor i also makes defining Thingy directly (without going though
Monoidal) easy:
newtype Thingy i a = Thingy { runThingy :: forall b. i (a -> b) -> i b }
instance Functor i => Functor (Thingy i) where
fmap f m = Thingy $ runThingy m . fmap (. f)
instance Functor i => Applicative (
Hi Max,
This is really interesting!
> 1. There exist total functions:
>
>> lift :: X d => d a -> D a
>> lower :: X d => D a -> d a
>
> 2. And you can write a valid instance:
>
>> instance X D
>
> With *no superclass constraints*.
All your examples have a more specific form:
> lift :: X d =>
Henning Thielemann wrote:
> Attached is a program with a space leak that I do not understand. I
> have coded a simple 'map' function, once using unsafePerformIO and
> once without. UnsafePerformIO has a space leak in some circumstances.
> In the main program I demonstrate cases with and without spa
By the way, you can use this stuff to solve the restricted monad
problem (e.g. make Set an instance of Monad). This is not that useful
until we find out what the mother of all MonadPlus is, though, because
we really need a MonadPlus Set instance.
Code below.
Cheers,
Max
\begin{code}
{-# LANGUAGE
On Sun, 27 Jun 2010 10:28:49 +0300
Roman Beslik wrote:
> On 27.06.10 10:17, Bulat Ziganshin wrote:
> > Sunday, June 27, 2010, 11:07:47 AM, you wrote:
> >>> Currently, FilePath is an alias for String. Changing FilePath to a real
> >>> type
> >> Just do not change FilePath, what may be simpler?
Hello Roman,
Sunday, June 27, 2010, 11:37:24 AM, you wrote:
>>> No! The target encoding is the current locale. It is a no-brainer to
>> not necessarily. current locale, encoding of current terminal and
>> encoding of every filesystem mounted are all different things
> And we should stick to the c
Hello Roman,
Sunday, June 27, 2010, 11:28:49 AM, you wrote:
>>> Just do not change FilePath, what may be simpler?
>> if FilePath will become abstract type, it will break all programs
>> that use it since they use it as String
> Hello, do you read me? I said: "do not change FilePath".
what you mea
Hello Roman,
Sunday, June 27, 2010, 11:24:16 AM, you wrote:
> O'kay, but IMHO few people want to have a headache with recoding. You
> knew that the implementation was incorrect, why you relied on it?
what is alternative? :) on windows i've used low-level open()-styly
APIs, on Linux i got the sa
On 25/06/2010, at 06:41, Alexey Khudyakov wrote:
> Then constructor like one below arise naturally. And I don't know how to write
> them properly. It's possible to use fromList but then list could be allocated
> which is obviously wasteful.
>
>> vector2 :: Double -> Double -> Vec2D
>> vector2 x y
I'm wondering if someone can cast some light on a pattern I've come
across, which I'm calling the "mother of all X" pattern after Dan
Piponi's blog post
(http://blog.sigfpe.com/2008/12/mother-of-all-monads.html). Edward
Kmett has also explored these ideas here:
http://www.mail-archive.com/haskell-c
On Fri, 25 Jun 2010 18:30:06 -0300
Felipe Lessa wrote:
> On Fri, Jun 25, 2010 at 12:41:48AM +0400, Alexey Khudyakov wrote:
> > Then constructor like one below arise naturally. And I don't know how to
> > write
> > them properly. It's possible to use fromList but then list could be
> > allocated
On 27.06.10 10:18, Bulat Ziganshin wrote:
Hello Roman,
Sunday, June 27, 2010, 11:11:59 AM, you wrote:
No! The target encoding is the current locale. It is a no-brainer to
not necessarily. current locale, encoding of current terminal and
encoding of every filesystem mounted are all different
On 27.06.10 10:17, Bulat Ziganshin wrote:
Sunday, June 27, 2010, 11:07:47 AM, you wrote:
Currently, FilePath is an alias for String. Changing FilePath to a real
type
Just do not change FilePath, what may be simpler?
if FilePath will become abstract type, it will break all programs
that use i
On 27.06.10 09:38, Bulat Ziganshin wrote:
Sunday, June 27, 2010, 3:52:54 AM, you wrote:
I fail to see how it will brake programs. Current programs do not use
Unicode because it is implemented incorrectly.
i use it. current Linux implementation treats String as sequence of
bytes, and with manua
Hello Roman,
Sunday, June 27, 2010, 11:11:59 AM, you wrote:
> No! The target encoding is the current locale. It is a no-brainer to
not necessarily. current locale, encoding of current terminal and
encoding of every filesystem mounted are all different things
--
Best regards,
Bulat
Hello Roman,
Sunday, June 27, 2010, 11:07:47 AM, you wrote:
>> Currently, FilePath is an alias for String. Changing FilePath to a real
>> type
> Just do not change FilePath, what may be simpler?
if FilePath will become abstract type, it will break all programs
that use it since they use it as S
On 27.06.10 03:58, Felipe Lessa wrote:
On Sun, Jun 27, 2010 at 02:55:33AM +0300, Roman Beslik wrote:
On 26.06.10 15:44, Felipe Lessa wrote:
However, suppose your program needs to create a file with a name
based on a database information. Your database is UTF-8. How do
you translate that UT
On 27.06.10 04:07, Brandon S Allbery KF8NH wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 6/26/10 19:52 , Roman Beslik wrote:
I fail to see how it will brake programs. Current programs do not use
Unicode because it is implemented incorrectly.
Currently, FilePath is an alias for Strin
43 matches
Mail list logo