Forgot to reply all, as usual.
Пересылаемое сообщение
21.06.2013, 12:52, "Miguel Mitrofanov" :
Actually, this is not the real error you should care about. Try removing
FromJSON instance completely, and you'll get a lot more. And these are
fundamental: you have
:t runMemLog (runTransitionT $ demo 1)
runMemLog (runTransitionT $ demo 1)
:: MonadLog (MemLog a) () => Log a -> ((), [Command ()])
That means, that "foo", if you manage to compile it, would have type MonadLog
(MemLog a) () => ((), [Command ()]). That means that in each call for foo it
would b
12.03.2013, 02:53, "Richard A. O'Keefe" :
> On 12/03/2013, at 10:00 AM, MigMit wrote:
>
>> On Mar 12, 2013, at 12:44 AM, "Richard A. O'Keefe"
>> wrote:
>>> Prelude> :type (+)
>>> (+) :: Num a => a -> a -> a
>>>
>>> The predefined (+) in Haskell requires its arguments and its result
>>> to
My current project at work has a web interface. Therefore I needed an HTML
templating library. I've tried several and found them all unsatisfactory. Most
of them generate Haskell code from templates (with Template Haskell or a
separate utility), and I don't like metaprogramming; and recompiling
Hi Jan!
foldl always traverses the list to the end; in particular, if there is no end,
it would hang forever (unless the compiler is smart enough to detect an
infinite loop, in which case it can throw an error). On the other hand, if the
first argument is lazy enough, foldr would stop before pr
Hi cafe!
I'm a bit confused by the DefaultSignatures extension. It's unclear whether to
consider the following an example of clever use of this extension, or an
example of abuse of it:
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANG
Hi cafe!
The ConstraintKinds extension makes it possible to create classes of classes,
like this:
class F c where cfmap :: c f => (a -> b) -> f a -> f b
instance F Functor where cfmap = fmap
instance F Monad where cfmap = liftM
So, basically we are saying that "c" is a class that has some speci
El 15/03/12 19:53, Anthony Cowley escribió:
On Thursday, March 15, 2012 at 2:27 PM, Juan Miguel Vilar wrote:
Hello, café:
I am trying to use more than one array with runSTUArray but I don't seem
to be able to understand how it works. My first try is this:
test1 n = runSTUArray $
El 15/03/12 20:07, Daniel Fischer escribió:
On Thursday 15 March 2012, 19:53:56, Daniel Fischer wrote:
On Thursday 15 March 2012, 19:27:18, Juan Miguel Vilar wrote:
Hello, café:
However, when I write
test2 n = runSTUArray $ do
let createArray v n = newArray (1, n) (v::Int
planation for this
behaviour? Furthermore, what I am after is to use two arrays with
different types (Int and Bool), is it possible?
Thanks in advance,
Juan Miguel
--
Juan Miguel Vilar Torres
Profesor titular de universidad
Vicedirector de la ESTCE para ITIG e ITIS
Departamento de Lenguajes y
22.02.2012, 11:20, "wren ng thornton" :
> On 2/22/12 1:45 AM, Miguel Mitrofanov wrote:
>
>>> However, there is no free ordering on:
>>>
>>> { (a0,b) | b<- B } \cup { (a,b0) | a<- A }
>> What? By definition, since, a0<= a and b0&
22.02.2012, 09:30, "wren ng thornton" :
> On 2/21/12 11:27 AM, MigMit wrote:
>
>> Ehm... why exactly don't domain products form domains?
>
> One important property of domains[1] is that they have a unique bottom
> element. Given domains A and B, let us denote the domain product as:
>
> (A,B
27.12.2011, 07:30, "Alexander Solla" :And why exactly should we limit ourselves to some theory you happen to like?Because the question was about MY IDEAL. You're right. I'm confusing two different threads. My apologies.But (_|_) IS a concrete value.Um, perhaps in denotational semantics. But even
> Now, what we can do with kl1? We can feed it an integer, say 1, and
> obtain function f of the type s -> (s,Bool) for an _unknown_ type s.
> Informally, that type is different from any concrete type. We can
> never find the Bool result produced by that function since we can
> never have any concr
Try
:t (foo 2, moo 2)
On 3 Aug 2011, at 23:31, Patrick Browne wrote:
> Below are examples of using the sub-class context at class level and at
> instance level.
> In this simple case they seem to give the same results
> In general, are there certain situations in which one or the other is
> p
"HTML emails considered harmful".
On 1 Jul 2011, at 23:17, Jack Henahan wrote:
> "'Courier New, 18pt' considered harmful"?
>
> On Jul 1, 2011, at 3:08 PM, Christopher Done wrote:
>
>> On 1 July 2011 20:51, Yves P wrote:
>>> There is something that bothers me with that text, I can't get to
and (ToWires a, Num a) context
> doesn't. At least in 6.12.1.
>
> This still looks to me like a bug.
>
> 2011/6/19 Miguel Mitrofanov :
>> Seems like let-generalization is at work here.
>>
>> Types of all values in the "where" section are inferred b
Seems like let-generalization is at work here.
Types of all values in the "where" section are inferred basically as if they
are declared at the top level. Therefore, inheritance fails without
NoMonomorphismRestriction.
There is a proposal (from Big Simon) to remove let-generalization:
http://r
Well, Maybe IS a monad, so I just use "m" prefix.
Отправлено с iPhone
Apr 22, 2011, в 21:14, Evan Laforge написал(а):
> Here's a simple issue that's been with me for a while. As do many
> people, I use plural variable names for lists, so if a Block as called
> 'block' then [Block] is 'blocks'.
As for Cont, it can be proved easily, either by hand, or by observation that
Cont is an obvious composition of two adjoint functors.
As for IO, it has to be taken for granted, since IO internals are hidden from
the programmer.
Отправлено с iPhone
Apr 12, 2011, в 14:39, Burak Ekici написал(а):
I fail to see how does it limit the scope.
16.03.2011 15:05, Andrew Coppin пишет:
You could define a function:
withContainer ∷ (∀ s. Container s → α) → α
which creates a container, parameterizes it with an 's' that is only
scoped over the continuation and applies the continuation to the
creat
Well, this code in C++ would probably work too:
Klass *k = new Klass(4,5);
delete k;
std::cout << k->getY() << std::endl;
though smart compiler would probably issue a warning. See, when you delete
something, C++ doesn't automagically mark your pointer as "invalid"; in fact,
it preserves all the
length [c | x <- [1..100], let c = chain x, length c > 15]
16.02.2011 12:19, Tako Schotanus пишет:
Hello,
I was going through some of the tuturials and trying out different (syntactic)
alternatives to the given solutions and I I got to this line:
*length [chain x | x <- [1..100] , length (ch
Sorry, but last time I've checked, C did have loops, is that correct? And even
if you don't want loops, there is a preprocessor.
17.01.2011 10:45, Blake Rain пишет:
Dear Haskellers,
I thought I'd take some time to share something of my weekend with
you all. Not because of anything new,
On 17 Dec 2010, at 20:04, michael rice wrote:
> I don't understand this error message. Haskell appears not to understand that
> 1 is a Num.
As it clearly states in the error message, it doesn't understand that [Int] is
a Num - and it's not.
"No instance for Num something" usually indicates th
Not sure if that's what you need:
data NodeF f = Node {name :: String, refs :: [f (NodeF f)]}
newtype Const a b = Const a
newtype Id a = Id a
type NodeS = NodeF (Const String)
type Node = NodeF Id
Отправлено с iPhone
Dec 12, 2010, в 20:54, Florian Weimer написал(а):
> Suppose I've got some n
Missed.
On 30 Nov 2010, at 23:47, Ian Lynagh wrote:
>
> A1
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe maili
findIndexM = (liftM (findIndex id) .) . mapM
On 26 Nov 2010, at 22:46, José Romildo Malaquias wrote:
> Hello.
>
> I need a function findIndexM, similar to findIndex from the standard
> module Data.List, but which works with a monadic predicate to test list
> elements.
>
> findIndex :: (a -> Boo
Generally speaking, all Haskell functions are pure unless they use unsafe-
functions or FFI inside.
Отправлено с iPhone
Nov 24, 2010, в 23:46, Gregory Propf написал(а):
> I have a pretty basic question. I've been wondering about whether monadic
> functions that do NOT us IO can be pure or no
y what i hoped.
And I would like to know (for fun) if it's possible to do it without type
family extension.
I've tried ... without success.
Thx.
On 11/22/2010 10:46 PM, Miguel Mitrofanov wrote:
Sure, it's possible with TypeFamilies. The following compiles OK:
{-# LANGUAGE TypeFami
Sure, it's possible with TypeFamilies. The following compiles OK:
{-# LANGUAGE TypeFamilies #-}
module TypeCalc where
data Rec a r = Rec a r
data RecNil = RecNil
data Wrapper a = Wrapper a
class TypeList t where
type Wrapped t
i :: t -> Wrapped t
instance TypeList RecNil where
type Wrappe
Sure, you can define your own type class like that:
import Prelude hiding ((+), (-)) -- usual (+) and (-) shouldn't be here...
import qualified Prelude as P -- but they still are accessible with a prefix
class Group a where
(+) :: a -> a -> a
(-) :: a -> a -> a
instance Group Integer where
A continuation.
You can't know, what type your "fromInt n" should be, but you're not going to just leave it anyway, you're gonna do some calculations with it, resulting in something of type r. So, your calculation is
gonna be of type (forall n. Nat n => n -> r). So, if you imagine for a moment
11.11.2010 16:53, Stephen Tetley пишет:
On 11 November 2010 13:10, Lauri Alanko wrote:
{-# LANGUAGE EmptyDataDecls, MultiParamTypeClasses, FunctionalDependencies #-}
data PetOwner
data FurnitureOwner
data Cat = Cat { catOwner :: PetOwner }
data Chair = Chair { chairOwner :: FurnitureOwner
Black letters over dark blue background hurt my eyes.
On 6 Nov 2010, at 18:10, Alistair Ward wrote:
> I've just written a few packages which I think may be useful, and have made
> them available as free opensource on a personal website
> http://functionalley.eu.
> I opted to host them there rat
Ehm... Forth? TCL?
Отправлено с iPhone
Nov 2, 2010, в 9:04, Permjacov Evgeniy написал(а):
> Let us think, that we need some scripting language for our pure haskell
> project and configure-compile-run is not a way. In such a case a
> reasonably simple, yet standartized and wide known language sh
On 17 Oct 2010, at 05:21, Ben Franksen wrote:
> I want to prove that
>
> f r == do
>s1 <- readIORef r
>r' <- newIORef s1
>x <- f r'
>s3 <- readIORef r'
>writeIORef r s3
>return x
That is not true. Consider the following function:
g r1 r2 = writeIORef r1 0 >> writeIORef
to make infinite lists fail to typecheck...
That's what I'm wondering about.
2010/10/13 Miguel Mitrofanov:
hdList :: List a n -> Maybe a
hdList Nil = Nothing
hdList (Cons a _) = Just a
hd :: FiniteList a -> Maybe a
hd (FL as) = hdList as
*Finite> hd ones
this hangs, so, my gu
hdList :: List a n -> Maybe a
hdList Nil = Nothing
hdList (Cons a _) = Just a
hd :: FiniteList a -> Maybe a
hd (FL as) = hdList as
*Finite> hd ones
this hangs, so, my guess is that ones = _|_
13.10.2010 12:13, Eugene Kirpichov пишет:
{-# LANGUAGE ExistentialQuantification, GADTs, EmptyDataD
Отправлено с iPhone
Oct 7, 2010, в 21:03, Peter Wortmann написал(а):
>
> On Tue, 2010-10-05 at 17:10 -0700, Evan Laforge wrote:
>> +1 for something to solve the "dummy <- m; case dummy of" problem.
>> Here are the possibilities I can think of:
>
> Might be off-topic here, but I have wondered
(g . f) x y = (\z -> g (f z)) x y = g (f x) y, and you need g (f x y), which
is definitely not the same thing.
24.09.2010 13:35, Axel Benz пишет:
Hello,
this is maybe a simple question:
cbinary :: a -> b -> (a -> b -> b) -> (b -> c) -> c
-- Version 1 works:
cbinary x y f g = g (f x y)
--
Sorry, got stupid today. Won't help.
14.09.2010 12:29, Miguel Mitrofanov пишет:
class (A x, B x, C x, D x) => U x
?
14.09.2010 12:24, Kevin Jardine пишет:
I have a set of wrapper newtypes that are always of the same format:
newtype MyType = MyType Obj deriving (A,B,C,D)
where O
class (A x, B x, C x, D x) => U x
?
14.09.2010 12:24, Kevin Jardine пишет:
I have a set of wrapper newtypes that are always of the same format:
newtype MyType = MyType Obj deriving (A,B,C,D)
where Obj, A, B, C, and D are always the same. Only MyType varies.
A, B, C, and D are automagically
On 8 Sep 2010, at 20:01, Gábor Lehel wrote:
> I'm bad at expositions so I'll just lead with the code:
>
> {-# LANGUAGE EmptyDataDecls, TypeFamilies #-}
>
> data True :: *
> data False :: *
>
> class TypeValue a where
>type ValueTypeOf a :: *
>value :: ValueTypeOf a
>
> instance TypeV
02.09.2010 16:49, Eoin C. Bairéad пишет:
Example 2
Prelude> let fac n = if n == 0 then 1 else n * fac (n-1)
How does it know to stop ?
To stop what? It's not "doing" anything, it's just an equation. So "fac" is the "least" function which satisfies this equation - meaning that it's value wo
Ivan Lazar Miljenovic wrote:
I'm trying to update container-classes to duplicate the pre-existing
classes defined in the Prelude (Functor, etc.) and am trying to get my
approach on how to have functions/classes that work on types of kind *
(e.g. Bytestring) as well as kind * -> * (e.g. lists),
Ivan Lazar Miljenovic wrote:
Tom Harper writes:
2010/8/17 Bulat Ziganshin :
Hello Tom,
i don't understand what you mean. are you support all 2^20 codepoints
in Data.Text package?
Bulat,
Yes, its internal representation is UTF-16, which is capable of
encoding *any* valid Unicode codepo
On 8 Aug 2010, at 17:36, michael rice wrote:
What is <- ? Couldn't find anything on Hoogle.
1) main = do
x <- getLine -- get the value from the IO monad
putStrLn $ "You typed: " ++ x
2) pythags = do
z <- [1..] --get the value from the List monad?
x <- [1..z]
would it still
works with Y.
- would the installation of Y replace X, or would I have both versions.
This issue seems to be open [0]; some advice about what should be
expected would be very nice.
Best,
Miguel.
[0] http://trac.haskell.org/haskell-platform/ticket/46
Well, Linux fanboys are known for spending too much time with their
computers compiling OS kernel or building world, no surprise their
eyes aren't in place.
On 18 Jul 2010, at 02:54, wrote:
On Sat, 17 Jul 2010 18:02:05 -0400
Brandon S Allbery KF8NH wrote:
-BEGIN PGP SIGNED MESSAGE--
is
covered in some of the haskell textbooks, and if anyone knows of a good
in-depth treatment of this, I would be grateful for a pointer.
Thanks again to everyone who responded,
Simon
On Mon, Jul 5, 2010 at 2:28 PM, Miguel Mitrofanov <mailto:miguelim...@yandex.ru>> wrote:
My guess
My guess is that it's
class B : public A
and
class C : public A
In this case it seems perfect to use type classes:
class A t where do_x :: t -> Integer -> Integer -> Integer
data B = ...
instance A B where do_x b x y = ...
data C = ...
instance A C where do_x c x y = ...
If you want some genera
People still use Hugs? :p
Is there another option for quick prototyping on iPhone?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
GADTs?
data CompletePathEv p where CompletePathEv :: CompletePath p =>
CompletePathEv p
class Path p => IncompletePath p where
type CompletedPath p :: *
completedPathEv :: CompletePathEv (CompletedPath p)
Later you can pattern-match on completedPathEv and get your
CompletePath inst
The class Num has subclasses containing various numeric types and the
literal 1 is a value for one or more of those types.
Well, the problem is not with subclasses, but with types.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haske
listFs = [f1, f2, f3]
map ($ x) listFs -- same as [f1 x, f2 x, f3 x]
f x y z = ...
map (\x -> f x u v) xs
On 17 Jun 2010, at 23:02, Martin Drautzburg wrote:
Hello all
The standard map function applies a single function to a list of
arguments.
But what if I want to apply a list of functions
From Prelude.hs:
class (Eq a) => Ord a where
compare :: a -> a -> Ordering
(<), (<=), (>), (>=) :: a -> a -> Bool
max, min :: a -> a -> a
compare x y = if x == y then EQ
-- NB: must be '<=' not '<' to validate the
--
That won't be a great idea; if I just want my monad to be declared as one, I
would have to write
instance Functor MyMonad where fmap = ...
instance Pointed MyMonad where pure = ...
instance Applicative MyMonad where (<*>) = ...
instance Monad MyMonad where join = ...
Compare this with
instance
On 19 May 2010, at 08:35, Ivan Miljenovic wrote:
This looks suspiciously like homework...
2010/5/19 R J :
What are some simple functions that would naturally have the
following type
signatures:
f :: (Integer -> Integer) -> Integer
I can only think of one solution to this but it doesn't gu
(>>= f) is equivalent to (flip (>>=) f), not to ((>>=) f). You can try this
with your own function this way:
(&$^) :: (Monad m) => m a -> (a -> m b) -> m b
(&$^) = undefined
:t (&$^ f)
Milind Patil wrote:
For a function
f :: a -> m b
f = undefined
I am having trouble understanding how the
ErrorT :: IO (Either Error String) -> ErrorT Error IO String
I can think that can be written as
ErrorT :: IO (Either Error String) -> ErrorT Error (IO String)
Am I correct?
No, you're not. Similar to function application, type application is
also left-associative, so it can (but shouldn't)
It's called "monad transformers"
func1' :: Int -> EitherT Error IO String
func1' n = EitherT $ func1 n
func2' :: Int -> EitherT Error IO String
func2' s = EitherT $ func2 n
runCalc' :: Int -> EitherT Error IO [String]
runCalc' param = func1' param >>= func2'
runCalc :: Int -> IO (Either Error [St
Forgot about this one:
Bjorn Buckwalter wrote:
What got me thinking about this was the apparently incorrect intuition
that 'and xs' would imply 'or xs'.
No. See, "and" is very close to "for all", and "or" is similarly close to "exists". For example, the statement "all crows are black" means j
Well, what's the sum of an empty list? Seems naturally that it's 0, but why?
Let's say that sum [] = x.
If we take two lists, say, l1 = [1,2,3] and l2 = [4,5], then
sum l1 + sum l2 = 6 + 9 = 15 = sum [1,2,3,4,5] = sum (l1 ++ l2)
We expect it to be the case even if one of the lists is empty, so
Doesn't seem right. IMHO, the necessity of making windows NOT fullscreen is an
indication of bad design.
Thomas Davie wrote:
On 7 Apr 2010, at 02:53, Ben Millwood wrote:
On Wed, Apr 7, 2010 at 2:22 AM, Thomas Schilling
wrote:
I have
set a maximum width on purpose so that it doesn't degrade
Out of curiosity: is there something wrong with my nickname "migmit"?
I'm not gonna change it anyway.
On 6 Apr 2010, at 09:52, Edward Z. Yang wrote:
This is a pretty terrible reason, but I'm going to throw it out there:
I like real names because they're much more aesthetically pleasing.
In
1) Haven't look closely, but your second ArrowLoop instance seems righter. The
question really is the same as with MonadFix instances; you can always define
an instance like this
data M = ... -- whatever
instance Monad M where ...
instance MonadFix M where mfix f = mfix f >>= f
...but this gen
, University of Geneva, 1996.
best regards
Miguel Vilaça
A 2010/03/24, às 23:30, Dupont Corentin escreveu:
> Hello,
> Very interresting.
> Visual Haskell seems to be very close to the thing i imagined.
> Mihai what do you think?
> Unfortunatly i cannot find it on the web!
> There is s
Maybe it's just me, but I think composition chain is MUCH easier to read.
When readning, I'd probably transform the last version to the previous one by
hand, just to make it more comprehensible.
Sebastian Fischer wrote:
On Mar 10, 2010, at 8:47 AM, Ketil Malde wrote:
I think it is better st
MigMit:~ MigMit$ cabal --help
This program is the command line interface to the Haskell Cabal
infrastructure.
See http://www.haskell.org/cabal/ for more information.
^
|
+
On 8 Mar 2010, at 19:51, Andrew Coppin wrote:
OK, so apparent
Which "a" should it use for "methods"?
On 4 Mar 2010, at 09:07, muneson wrote:
When writing a command-line interface I ran into type class conflicts
I don't understand. Could anyone explain why ghc 6.10.4 compiles this
methods :: (Eq a) => [(String, a)]
methods =
[ ("method1", undefined )
Sorry, no luck with that.
But you can, probably, define some "customized comma":
data DrawPair a b = DrawPair a b
(<,>) :: a -> b -> DrawPair a b
(<,>) = DrawPair
instance (Drawable a, Drawable b) => Drawable (DrawPair a b) where ...
drawMany :: Drawable a => Window -> a -> IO ()
...
drawMany wi
s/subclasses/classes/
Sorry for the confusion.
Miguel Mitrofanov wrote:
I'd say we don't really need subclasses. I mean, what's the difference:
class Eq a where (==) :: a -> a -> Bool
instance Eq a => Eq (Maybe a) where
Nothing == Nothing = True
Just x == Just y =
I'd say we don't really need subclasses. I mean, what's the difference:
class Eq a where (==) :: a -> a -> Bool
instance Eq a => Eq (Maybe a) where
Nothing == Nothing = True
Just x == Just y = x == y
_ == _ = False
sort :: Eq a => [a] -> [a]
or
data Eq a = Eq {eq :: a -> a -> Bool}
eqMayb
-- {-# LANGUAGE FunctionalDependencies#-}
-- {-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-}
module Register where
-- class Register a r | a -> r
class Register a where
type R a
-- instance Register Int Int
instance Register Int where
type R Int = Int
-- instance Regis
The problem is, "fromSql x" doesn't know that type it should return. It's sure that it
has to be of class "Convertible SqlValue", but nothing more. Could be String, or Int32,
or something else.
What if you just omit the "show" function? fromSql seems to be able to convert
almost anything to St
For the reference: foldM is defined as
foldM :: Monad m => (a -> b -> m a) -> a -> [b] -> ma
foldM _ a [] = return a
foldM f a (x:xs) = f a x >>= \fax -> foldM f fax xs
Let's define
foldM' f x xs = lazy'foldl f (Just x) xs
We can check that foldM' satisfies the same equations as foldM:
foldM'
With cabal-install, usually.
Limestraël wrote:
Cabal/cabal-install are good tools for distribution and installation,
but I was wondering -- as I was starting to learn how to use Cabal --
how do usually Haskell developpers build their softwares (and especially
medium or big libraries) while the
Error message suggests that you've used "Conf" improperly.
testFunc :: (forall a. Conf a, MonadIO m => m a) -> TestType
is illegal, as I recall, you should use another pair of brackets:
testFunc :: (forall a. (Conf a, MonadIO m) => m a) -> TestType
Alexander Treptow wrote:
Hi,
i got a little
Hom(A, B) is just a set of morphisms from A to B.
Mark Spezzano wrote:
I should probably add that I am trying various proofs that involve injective
and surjective properties of Hom Sets and Hom functions.
Does anyone know what Hom stands for?
I need a text for a newbie.
Mark
On 02/02/2010,
|multSM d m = [[(b*a)| b<-[d], a<-(head m)]]
Well, let's see what do we have here.
We have []'s around something. "Something" is [(b*a)| b<-[d], a<-(head m)], which is just a legal Haskell value, so our "mutlSM d m" has to be a one-element list, with the only element being equal to
what we pu
However, i donot know how to write pure function using C style.
func1 a = {
-- ...;
a * 2;
-- ...;
}
What do you mean by "a * 2"? If you don't use this value, don't
calculate it.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.
iconv?
Günther Schmidt wrote:
Hi,
is there a library which converts from utf-16 to utf-8?
Günther
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Wrap it in a newtype. That's the only way I know.
Andrew U. Frank wrote:
i encounter often a problem when i have a class with some operations (say
class X with push) applied to a type A b. I then wrap A in a type A_sup, with
some more type parameters and i cannot write a instance of class A_su
On 17 Jan 2010, at 23:22, Will Ness wrote:
What are such types called?
Dependent ones.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Works fine here (Mac OS X 10.5):
MigMit:ngram MigMit$ ghc --make Main.hs srilm.o
[1 of 2] Compiling LM ( LM.hs, LM.o )
LM.hs:9:0: Warning: possible missing & in foreign import of FunPtr
[2 of 2] Compiling Main ( Main.hs, Main.o )
Linking Main ...
MigMit:ngram MigMit$ ls
On 13 Jan 2010, at 22:25, Andrew Coppin wrote:
Colin Paul Adams wrote:
Andrew> It's weird that us Haskell people complain about there
Andrew> being only 26 letters in the alphabet
Which alphabet?
You have plenty of choice in Unicode.
Er... I was under the impression that Haskell sour
rably less time consuming. Especially as if you call it
frequently you'll be dealing with a mostly cleared nursery anyways.
-Edward Kmett
On Thu, Jan 7, 2010 at 4:39 PM, Miguel Mitrofanov > wrote:
I liked it too. Seems like I have to show some real code, and my
apologies for a long e-mail.
very interesting:
> isUsed usedNumbers index Nothing _ | not (index `elem`
usedNumbers) = Nothing
> isUsed _ _ _ answer = answer
And it works:
*Ask> client True $ smartServer nonsense
Debug: []
?
--> a
Debug: [Just "a"]
a
--> b
Debug: [Nothing,Just "b&
Damn. Seems like I really need (True, False, True) as a result of
"test".
On 7 Jan 2010, at 08:52, Miguel Mitrofanov wrote:
Seems very nice. Thanks.
On 7 Jan 2010, at 08:01, Edward Kmett wrote:
Here is a slightly nicer version using the Codensity monad of STM.
Thanks go to Andr
-- but it won't be known until runtime.
w <- refIgnore b
v <- refFst c
return (x, y, z)
-- This will disagree with your desired answer, returning:
*Oracle> runOracle test
Loading package syb ... linking ... done.
Loading package array-0.2.0.0 ... linkin
kell.org/Hugs/pages/libraries/base/System-Mem-Weak.html
-Edward Kmett
On Wed, Jan 6, 2010 at 9:39 AM, Miguel Mitrofanov > wrote:
I'll take a look at them.
I want something like this:
refMaybe b dflt ref = if b then readRef ref else return dflt
refIgnore ref = return "blablabla"
-- but it won't be known until runtime.
w <- refIgnore b
v <- refFst c
return (x, y, z)
so that "run test" returns (True, False, True).
Dan Doel wrote:
On Wednesday 06 January 2010 8:52:10 am Miguel Mitrofanov wrote:
Is there any kind of "ST&
Is there any kind of "ST" monad that allows to know if some STRef is no longer
needed?
The problem is, I want to send some data to an external storage over a network
and get it back later, but I don't want to send unnecessary data.
I've managed to do something like that with weak pointers, Sys
1)
Obviously I get two different types
Wrong. You get exactly the same type, it's just that GHCi detected that you
have a fancy name for this type, so it gives you that name. It's not type
system, it's just GHCi.
Are you saying there is just one type? (not two isomorphic types because
there i
pbrowne wrote:
Hi,
I am studying the underlying semantics behind Haskell and to what degree
those semantics are actually implemented. I need to clarify what a *type
synonym* actual means in relation to Haskell's logic (or formal
semantics). I used the following type synonym:
type Name = String
Your code is equivalent to this:
adjustToBox (ObjectWrapper object) box = adjustToBox object box
but what you've probably intended to write was
adjustToBox (ObjectWrapper object) box = ObjectWrapper (adjustToBox
object box)
It has nothing to do with existentials - it's a simple type mismatc
On 26 Dec 2009, at 11:58, hask...@kudling.de wrote:
class BarLike a where
doSomething :: a -> Double
data Bar = forall a. BarLike a => Bar a
unwrapBar :: Bar -> a
unwrapBar (Bar x) = x
How can i deconstruct the enclosed value of type a?
You can't write a function with a type that menti
On 18 Dec 2009, at 06:39, Richard O'Keefe wrote:
My experience has been that in order to make sense of someone else's
code you *HAVE* to break identifiers into their component words.
With names like (real example) ScatterColorPresetEditor, the eye
*can't* take it in at once, and telling the dif
= EqD
eq :: MyClass k => k -> AssociatedType k -> AssociatedType k -> Bool
-- eq k k1 k2 = k1 == k2 -- doesn't work
eq k k1 k2 = case evidence k of EqD -> k1 == k2 -- works fine
On 17 Dec 2009, at 17:10, Miguel Mitrofanov wrote:
{-# LANGUAGE GADTs, TypeFamilies #-}
module As
1 - 100 of 449 matches
Mail list logo