Hi Taral, Eugene,
[Taral]
>> Perhaps I don't understand Agda very well, but I don't see
>> parametricity here. For one, there's no attempt to prove that:
>>
>> forall (P Q : forall a, a -> a), P = Q.
[Eugene]
> Under parametricity, I mean the Reynolds Abstraction Theorem, from
> which free theore
On Thu, Mar 26, 2009 at 2:40 AM, Duncan Coutts
wrote:
> I was not being precise when I said "tests for _|_". As you point out,
> the semantics of imprecise exceptions distinguishes exceptions from
> bottom, however pure code cannot make that distinction and so that's why
> I was lumping them toget
Hi Duncan and all,
On Wed, Mar 25, 2009 at 3:52 AM, Duncan Coutts
wrote:
> On Mon, 2009-03-23 at 08:11 -0400, Xiao-Yong Jin wrote:
>> > tryArith :: a -> Either ArithException a
>> > tryArith = unsafePerformIO . try . evaluate
>
> You must not do this. It breaks the semantics of the language.
>
>
2009/3/24 Peter Verswyvelen :
>> This strategy is doomed to failure, unfortunately.
>
> So it is the good strategy, because Haskell's slogan is "avoid success at
> all cost" :-)
IN THE YEAR 1987, WAR WAS BEGINNING
BIG, IMPERATIVE SOFTWARE BEHEMOTHS CLASHED IN A STATE OF IMPURITY
UNDER THE SHADO
On Thu, Feb 12, 2009 at 8:46 AM, Kim-Ee Yeoh wrote:
>
> On the same note, does anyone have ideas for the following snippet? Tried the
> pointfree package but the output was useless.
>
> pointwise op (x0,y0) (x1,y1) = (x0 `op` x1, y0 `op` y1)
import Control.Monad.Reader -- for the (Monad (a ->))
Hi all,
On Tue, Feb 10, 2009 at 3:26 PM, Malcolm Wallace
wrote:
> If you have ideas for student projects that you think would benefit the
> Haskell community, now is the time to start discussing them on mailing
> lists of your choice. We especially encourage students to communicate
> with the wi
Hi Lennart,
On Sat, Jan 24, 2009 at 10:47 PM, Lennart Augustsson
wrote:
> You can dream up any semantics you like about bottom, like it has to
> be () for the unit type.
> But it's simply not true. I suggest you do some cursory study of
> denotational semantics and domain theory.
Umh. It's cert
On Sun, Jan 18, 2009 at 5:48 PM, wrote:
> I noticed the Bool datatype isn't well documented. Since Bool is not a
> common English word, I figured it could use some haddock to help clarify it
> for newcomers.
>
> -- |The Bool datatype is named after George Boole (1815-1864).
> -- The Bool type is
On Tue, Dec 23, 2008 at 8:05 PM, Benja Fallenstein
wrote:
> Umh, there is a MonadPlus instance in the package?
Ah: ...in the version Cale uploaded two days ago, not in the previous
version. Sorrynevermindisee :)
- Benja
___
Haskell-Cafe mailing l
On Tue, Dec 23, 2008 at 2:52 AM, Antoine Latter wrote:
> Although I still had to use my own because I wanted a MonadPlus
> instance. I would offer a patch, but since there's more than one
> useful MonadPlus instance for MaybeT it probably still wouldn't be
> right for everyone.
Umh, there is a M
Hi all,
On Wed, Nov 12, 2008 at 2:09 PM, Lennart Augustsson
<[EMAIL PROTECTED]>wrote:
> You can't write a straightforward dynamic semantics (in, say,
> denotational style) for Haskell.
> The problem is that with type classes you need to know the types
> compute the values.
...
> It's possible t
Hi Maurício,
I've got one thing to add to the replies so far:
On Wed, Aug 27, 2008 at 8:23 PM, Maurício <[EMAIL PROTECTED]> wrote:
> What does '~' mean in Haskell? I
> read in haskell.org/haskellwiki/Keywords
> that "(...) Matching the pattern ~pat
> against a value always suceeds, and
> matchi
Hi,
On Sun, Aug 10, 2008 at 8:57 PM, Michael Feathers
<[EMAIL PROTECTED]> wrote:
> If I have, say, a function f :: a -> a -> a -> a -> b it would be nice to be
> able to just:
>
> unlistN 4 f [1..4]
It indeed doesn't work like this; there's more than one way to do
something *like* this, if you re
Hi Pieter,
2008/8/5 Pieter Laeremans <[EMAIL PROTECTED]>:
> But the sphinx indexer complains that the xml isn't valid. When I look at
> the errors this seems due to some documents containing not well formed
> html.
If you need to cope with non-well-formed HTML, try HTML Tidy:
http://tidy.sourc
Hi Edsko,
On Jan 22, 2008 7:34 PM, Edsko de Vries <[EMAIL PROTECTED]> wrote:
> Is there a nice way to pretty-print such an expression with the minimal
> number of brackets? I can come up with something, but I'm sure somebody
> thought hard about this problem before and came up with a really nice
>
Hi Christian,
On Jan 21, 2008 10:57 AM, Christian Maeder <[EMAIL PROTECTED]> wrote:
> Thanks for pointing out this proposal. The actual problem is mkGraph
> that needs all the many edges created beforehand (that's what I wanted
> to avoid).
Well, uh, at the risk of being obvious, if you can avoid
Hi,
On Jan 19, 2008 6:05 PM, Thomas Hartman <[EMAIL PROTECTED]> wrote:
> Do you just assume that every two nodes have an edge between them [...]?
Since that's what "complete graph" means, I assume so =-)
- Benja
___
Haskell-Cafe mailing list
Haskell-Ca
Hi Christian,
On Jan 18, 2008 1:55 PM, Christian Maeder <[EMAIL PROTECTED]> wrote:
> data CGraph a b = CGraph [a] (a -> a -> b)
>
> Can I define an instance for the fgl Graph class?
>
> I had no idea how to define empty (except using undefined).
Well, presumably the function does not need to be d
On Jan 10, 2008 11:54 PM, Luke Palmer <[EMAIL PROTECTED]> wrote:
> Can someone explain what the heck is going on here?
Evaluating (const EXPR) creates a closure object with a pointer to
'const' and a pointer to the EXPR thunk. Call this closure object C.
Evaluating (C undefined) calls 'const' with
Hi Mitar,
On Jan 10, 2008 9:22 AM, Mitar <[EMAIL PROTECTED]> wrote:
> I understand that proper mathematical behavior would be that as 0/0 is
> mathematically undefined that 0/0 cannot be even compared to 1.
My understanding is that common mathematical practice is that
comparing an undefined value
Hi Yitz,
On Jan 2, 2008 10:34 AM, Yitzchak Gale <[EMAIL PROTECTED]> wrote:
> No, only countably many. By the type expression Integer -> Integer
> we mean all Haskell functions mapping Integers to Integers.
> There are only countably many of those.
...
> But that was not the context in this thread.
On Dec 31, 2007 7:17 AM, <[EMAIL PROTECTED]> wrote:
> This declaration states that there's a bijection between the elements of
> Foo and the elements of 2^Foo, which by Cantor's diagonal theorem cannot
> be true for any set. That's because we only allow computable functions,
Nit the nit: Or (mor
Hi Cristian,
On Dec 30, 2007 6:10 PM, Cristian Baboi <[EMAIL PROTECTED]> wrote:
> What I don't get it :
>
> (s a1 a2 ... at) must be the value of A in the semantic domain. Let call
> that value a.
> Then how can one know if a was built with (s a1 a2 ... at) and not with
> (egg b1 b2) ?
Because th
On Dec 28, 2007 4:24 PM, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> Right; I misspoke. What I meant was that you would want a split such that
>
> intercalate a (split a xs) = a
>
> for finite, total (a,xs) (and, since it's achievable, even for
> infinite xs).
On Dec 28, 2007 3:55 PM, David Roundy <[EMAIL PROTECTED]> wrote:
> On Dec 28, 2007 9:51 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> > If you use intercalate to join, I would presume that you would want to
> > use an inverse of it to split. I'd write it like
Hi all,
On Dec 28, 2007 12:38 PM, Andrew Coppin <[EMAIL PROTECTED]> wrote:
> For joining you probably want some combination of intersperse and
> concat, e.g.
>
> unlines = concat . intersperse "\n"
And that's what we have :-)
Data.List.intercalate :: [a] -> [[a]] -> [a]
Data.List.intercalate x
Hi Neil,
On Dec 26, 2007 7:16 PM, Neil Mitchell <[EMAIL PROTECTED]> wrote:
> Given the code:
>
> fred = 2 + 2
>
> bob = fred + fred
>
> In a Haskell implementation fred would be evaluated once to 4, then
> used twice. The 2+2 would only happen once (ignore defaulting and
> overloaded numerics for
On Dec 26, 2007 12:42 PM, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> parseHeader :: BS.ByteString -> Maybe (Int,Int)
> parseHeader = evalStateT $ liftM2 (,) parseInt parseInt where
> parseInt = StateT $ BS.readInt . BS.dropWhile (not . isDigit)
(oh, I missed Conal
On Dec 23, 2007 1:44 PM, Isaac Dupree <[EMAIL PROTECTED]> wrote:
> parseHeader3 :: BS.ByteString -> Maybe (Int, Int)
> parseHeader3 bs = do
>(x, rest) <- BS.readInt $ BS.dropWhile (not . isDigit) bs
>(y, _) <- BS.readInt $ BS.dropWhile (not . isDigit) rest
>return (x, y)
But that versi
Hi Paul,
On Dec 19, 2007 6:54 AM, Paul Hudak <[EMAIL PROTECTED]> wrote:
> Your version of the answer is in fact correct, but is just an elaboration
> of the original one.
> So, I don't see what your point is...
Ok, sorry, I'll try again... I'm trying to say that in my opinion,
it's important to
Hi all,
Below is a program that implements Show for functions whose type is
composed of only (->) and type variables (or, more precisely, of (->)
and (State Int Term), but any type composed of (->) and type variables
can obviously be specialized to that).
(-fglasgow-exts is needed only for the co
On Dec 18, 2007 6:01 PM, Paul Hudak <[EMAIL PROTECTED]> wrote:
> Well, my caveat was that the Haskell designers wanted it this way. So
> you are essentially rejecting my caveat, rather than creating a new one.
> :-)
I mean, I reject the answer "They wanted it this way" because I think
the answer
Hi Paul,
On Dec 18, 2007 5:18 PM, Paul Hudak <[EMAIL PROTECTED]> wrote:
> If the semantics of a language says that a function f is equivalent to a
> function g, but there is a function h such that h(f) is not equivalent to
> h(g), then h cannot be a function.
Sure.
> Therefore that language can
Hi Henning,
On Dec 18, 2007 5:17 PM, Henning Thielemann
<[EMAIL PROTECTED]> wrote:
> The mathematical definition of "function" I know of, says that functions
> are special relations, and relations are sets of pairs. Their is nothing
> about intension.
That's the standard definition in set theory,
On Dec 18, 2007 4:50 PM, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> Further, even with extensionality, we can (with compiler support) in
> principle have Show instances other than enumerating the graph.
Now that I said it, I'm starting to doubt we even need compiler
suppo
Hi Henning,
On Dec 18, 2007 3:53 PM, Henning Thielemann
<[EMAIL PROTECTED]> wrote:
> Since this was discussed already here, I summed it up in:
> http://www.haskell.org/haskellwiki/Show_instance_for_functions
I find the discussion under "theoretical answer" unsatisfying. The
property that a Show
Hi Cristian,
On Dec 18, 2007 10:53 AM, Cristian Baboi <[EMAIL PROTECTED]> wrote:
> >> - the lambda expressions can be written (input) but cannot be printed
> >> (output)
>
> > Yes, since two different lambda expressions can denote the same function.
> I just want the sistem to be able to print one
Hi Dominic,
On Dec 15, 2007 10:38 AM, Dominic Steinitz
<[EMAIL PROTECTED]> wrote:
> > Supply.hs:33:13:
> > Couldn't match expected type `g' against inferred type `MyGen'
> > `g' is a rigid type variable bound by
> > the type signature for `randomR' at
> > Expected type:
On Dec 14, 2007 9:29 AM, Henning Thielemann
<[EMAIL PROTECTED]> wrote:
> I remember there was a discussion about how to implement full 'wc' in an
> elegant but maximally lazy form, that is counting bytes, words and lines
> in one go. Did someone have a nice idea of how to compose the three
> counte
On Dec 14, 2007 10:38 AM, Bulat Ziganshin <[EMAIL PROTECTED]> wrote:
> > hUnsafeGetContentsDontUseThisUnlessYouHaveSpentThreeMonthsLearningGHCsExecutionSemanticsOrYouWillRegretIt
>
> i have more advanced proposal - we should include in its name whole
> paper on its semantics so anyone using it will
On Dec 15, 2007 3:44 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> Hmmm. Something about that ticks off my "don't play fast and loose
> with bottom" detector.
I should add that I do think you're correct if you ignore the
existence of bottom, and I'm p
On Dec 15, 2007 3:15 AM, Ryan Ingram <[EMAIL PROTECTED]> wrote:
>
> On 12/14/07, David Menendez <[EMAIL PROTECTED]> wrote:
> > And yes, I'm pretty sure that's the only possible implementation for that
> type which satisfies the functor laws.
>
> Lets just prove it, then; I'm pretty sure it comes pr
Hi Corey,
On Dec 14, 2007 8:44 PM, Corey O'Connor <[EMAIL PROTECTED]> wrote:
> The reason I find all this odd is because I'm not sure how the type
> class Functor relates to the category theory concept of a functor. How
> does declaring a type constructor to be an instance of the Functor
> class r
On Dec 13, 2007 2:28 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> Although on reflection, I think I might like the following compromise
> with Tillmann's version best:
>
> main = interact $ perLine $ detab 0 where
> detab tab ('\t':cs
On Dec 13, 2007 2:20 AM, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> Another version of detab:
>
> main = interact $ perLine $ concat . snd. mapAccumL f 0 where
> f tab '\t' = (0, replicate (4-tab) ' ')
> f tab char = ((tab+1) `mod` 4, [char])
Another version of detab:
main = interact $ perLine $ concat . snd. mapAccumL f 0 where
f tab '\t' = (0, replicate (4-tab) ' ')
f tab char = ((tab+1) `mod` 4, [char])
- Benja
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.hask
On Dec 12, 2007 9:58 PM, Don Stewart <[EMAIL PROTECTED]> wrote:
> And no need to even use custom ones, just use the library strict pairs,
>
>
> http://hackage.haskell.org/packages/archive/strict/0.2/doc/html/Data-Strict-Tuple.html
Oh, good! :)
'nother Haskell lesson learned. Thanks,
- Benja
Hi Thomas,
On Dec 12, 2007 5:31 PM, Thomas Hartman <[EMAIL PROTECTED]> wrote:
> (solution involves building an accum list of (average,listLength) tuples.
> again you can't do a naive fold due to stack overflow, but in this case even
> strict foldl' from data.list isn't "strict enough", I had to
Hi Conal,
On Dec 9, 2007 6:09 PM, Conal Elliott <[EMAIL PROTECTED]> wrote:
> > readIVar' :: IVar a -> a
> > readIVar' = unsafePerformIO . readIVar
>
> > so, we do not need readIVar'. it could be a nice addition to the
> libraries, maybe as "unsafeReadIVar" or "unsafeReadMVar".
>
> The same argumen
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
On Dec 5, 2007 5:40 PM, Paulo J. Matos <[EMAIL PROTECTED]> wrote:
> Oh, but lfpaths is not nothing so that means that isNothing rtpaths
> shouldn't be evaluated, right?
You're right, and I was stupid not to think about that case. Since
Luke already gave an in-depth analysis I'll be quiet now :-)
Hi Paolo,
On Dec 5, 2007 2:09 PM, Paulo J. Matos <[EMAIL PROTECTED]> wrote:
> I'm glad that my initial post generated such an interesting discussion
> but I'm still not understanding why the first version of findAllPath
> seems to be computing the whole list even when I just request the
> head, wh
On 11/18/07, Benja Fallenstein <[EMAIL PROTECTED]> wrote:
> Hi Radosław,
>
> You should be able to write this with MaybeT as follows:
Correction, sorry. The code in my original mail doesn't take care of
converting the 'Maybe's returned by the functions you
Hi Radosław,
You should be able to write this with MaybeT as follows:
getStrip :: IO ( Maybe String )
getStrip = runMaybeT $ do
pageContent <- liftIO $ downloadFile mainPageAddress
let x = patternForStrip pageContent
print x
z <- x
liftIO $ downloadFile $ mainPageAddress ++ z
2007/7/20, Bulat Ziganshin <[EMAIL PROTECTED]>:
> allEqual [] = True
> allEqual (x:xs) = all (== x) xs
> with the same caveat about allEqual [] as in your case.
allEqual xs = all (== head xs) xs
Rght. Not evaluated in the edge case, because xs is empty. Didn't
think of that, nice :-)
-
2007/7/19, Jason Dagit <[EMAIL PROTECTED]>:
> I prefer,
>
> allEqual [] = True
> allEqual xs = foldl1 (==) xs
>
> But, unfortunately, it's not a one liner like yours (unless you allow
> allEqual [] = undefined).
Oh and silly me, that only works for [Bool].
My natural instinct is,
allEqual []
2007/7/12, peterv <[EMAIL PROTECTED]>:
Amazing, so simple it is, Yoda would say ;)
I did not realize one could perform "partial application" on types when
declaring instances (I mean not specifying the type of Vector2 in ).
You ought to meditate on the type class 'Monad,' then, which was the
m
Hi Peter,
2007/7/12, peterv <[EMAIL PROTECTED]>:
Q1) Is it possible to treat a tuple of N elements in a generic way? So
instead of writing functions like lift1 e1, lift2 (e1,e2), lift3 (e1,e2,e3)
just one function liftN that works on tuples of any length?
Q2) (Maybe related to Q1) Can I convert
Hi Adrian,
2007/7/8, Adrian Hey <[EMAIL PROTECTED]>:
So it seems ghc doesn't like kinds (* -> *) either :-(
Actually, AFAICT the problem seems to be with Data.Typeable
itself rather than ghc. There is no proper TypeRep for
(ListGT map k a) because map is not a type.
Have you tried using (Type
Hi,
2007/7/1, Bulat Ziganshin <[EMAIL PROTECTED]>:
aa <- unsafeRead a5 0
return $! aa
bb <- unsafeRead a5 1
return $! bb
If this is a useful pattern, would it make sense to have a function to
encapsulate it?
mseq :: Monad m => m a -> m a
mseq m = m >>= (return $!)
- Benja
___
Hi Ken,
2007/7/1, Ken Takusagawa <[EMAIL PROTECTED]>:
I'd like to have a state monad with the feature that I can somehow
annotate using the type system that some functions are only going to
read the state and not modify it.
I would suggest declaring a MonadReader instance for State, and
writin
2007/6/25, Michael T. Richter <[EMAIL PROTECTED]>:
OK, just to prevent this getting side-tracked: I'm absolutely
uninterested in the results of performActionA before determining if
performActionB is permitted/possible/whatever. Think more in terms of
security permissions or resource availabili
Hi Peter,
2007/6/25, peterv <[EMAIL PROTECTED]>:
I'm baffled. So using the Arrow abstraction (which I don't know yet) would
solve this problem? How can (perfectActionB x) be checked with without ever
executing performActionA which evaluates to x? This can only be done when x
is a constant expres
Hi all,
The "scrap your boilerplate with class" sytstem [1] has two big
advantages over the plain SYB system from Data.Generics, IMHO: One, it
lets you declare an 'open' generic function as a type class, to which
new cases can be added by adding new instances (emphasized in the
paper); and two, i
Hi Hugh,
2007/6/25, Donald Bruce Stewart <[EMAIL PROTECTED]>:
hughperkins:
>
>Just noticed that all my responses have been going only to
>Neil, not to the group.
>Anyway, the jist of our conversation was that it's not
>possible to create arbitrary datatypes/constructors from
>
Hi,
I can't figure out why the following program compiles with this
instance declaration
instance Size (Maybe [a]) => Size [a] where size x = size (foo x)
but has GHC loop forever with this one:
instance (Foo a b, Size b) => Size a where size x = size (foo x)
Anybody here know?
Thanks,
-
Hi Tony,
2007/6/16, Tony Morris <[EMAIL PROTECTED]>:
I was told on #haskell (IRC) the other day that it is possible to write
a general memoisation table using IORef and unsafePerformIO. I can't
think of how this can be achieved without writing to a file, since a
function cannot hold state betwee
2007/6/14, Stefan O'Rear <[EMAIL PROTECTED]>:
On Wed, Jun 13, 2007 at 05:12:25PM +0300, Benja Fallenstein wrote:
> However, this is still kind of boring. Is there a better way? If not,
> would it be a good idea to have compiler support for building this
> kind of type table
Hi Bulat,
2007/6/13, Bulat Ziganshin <[EMAIL PROTECTED]>:
> We've had a discussion on #haskell about how we can make a function
> that reads in serialized values of an open data type, such as
look at Data.Generics.Text which may be implements exactly what you
need
Unfortunately not. Data.Gene
Hi Isaac,
2007/6/13, Isaac Dupree <[EMAIL PROTECTED]>:
Since Show instances can overlap (e.g. (show (1::Int)) == (show
(1::Integer))), we need to tag with the type.
Indeed. But that's the easy part :-)
Reminds me of Typeable.
Since GHC lets us derive Typeable with a guarantee of different ty
Hi all,
We've had a discussion on #haskell about how we can make a function
that reads in serialized values of an open data type, such as
class (Show a, Read a) => MyClass a where
typeTag :: a -> String
... operations on the open data type...
data Obj = forall a. MyClass a => Obj { unObj
2007/5/23, Ian Lynagh <[EMAIL PROTECTED]>:
On Wed, May 23, 2007 at 06:27:32PM +0100, Neil Mitchell wrote:
>
> foo = do (1 :: Int)
While intuitively this should be disallowed, it seems a pity that
desugaring couldn't be totally separated from typechecking. Hmm.
You *could* desugar it to
foo =
2007/5/13, Benja Fallenstein <[EMAIL PROTECTED]>:
Modulo the constructor and destructor invocation, this is just the
familiar non-terminating ((\x -> x x) (\x -> x x)), of course.
The same technique also gives us
data Y a = Y (Y a -> a)
y :: (a -> a) -> a
y f = (\(Y x
2007/5/12, Derek Elkins <[EMAIL PROTECTED]>:
In Haskell codata and data coincide, but if you want consistency, that cannot be
the case.
For fun and to see what you have to avoid, here's the proof of Curry's
paradox, using weird infinite data types. We'll construct an
expression that inhabits an
Adding some thoughts to what David said (although I don't understand
the issues deeply enough to be sure that these ideas don't lead to
ugly things like paradoxes)--
2007/5/10, Gaal Yahas <[EMAIL PROTECTED]>:
Since the empty list inhabits the type [b], this theorem is trivially
a tautology, so l
Hi all,
Is there a way to achieve the effect of soft references in GHC? Or if
not, is there any hope that they will be implemented in the future?
(Soft references are like weak references, except that they are only
reclaimed by the garbage collector if memory is short.)
I'm building a memoizatio
Hi,
(new here)
2007/3/25, Jacques Carette <[EMAIL PROTECTED]>:
Some classes would become even more important: monoid, groupoid,
semi-group, loop (semi-group with identity), etc. But all of those are,
to the average programmer (and many a mathematician), just as scary as
Monad.
Of course, whe
77 matches
Mail list logo