, this is not
just an issue of syntax: it is impossible to partially apply a type
constructor to anything other than its first argument, because there
is no type-level lambda.
Thank you Brent, so I'm not being entirely dumb ;-).
data FlipFun b -- abstract
instance (f
. Moreover, this is not
just an issue of syntax: it is impossible to partially apply a type
constructor to anything other than its first argument, because there
is no type-level lambda.
This is valid, but wrong: ((-) Bool) b -- gives (Bool - b).
I could do:
data FlipFun b
] Compiling Main ( monad5.hs, interpreted )
monad5.hs:5:16: Not in scope: type constructor or class `Map'
Failed, modules loaded: none.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo
Because Data.Map is imported qualified, any symbols in it (including
Map) needs to be qualified:
type Bindings = Map.Map String Int
A standard idiom is to do import like so:
import qualified Data.Map as Map
import Map (Map)
so that the Map symbol itself does not need qualification.
Eric
On Thu, 30 Dec 2010 08:01:01 -0800 (PST)
michael rice nowg...@yahoo.com wrote:
Not sure what's going on here. Doesn't like line 5, the type
statement. And what's with the semicolons in that line and in
function main?
import Control.Monad.Reader
import qualified Data.Map as Map
import
Thanks, all.
Just tried
type Bindings = Map.Map String Int
and it also seems to work.
Michael
--- On Thu, 12/30/10, Pedro Vasconcelos p...@dcc.fc.up.pt wrote:
From: Pedro Vasconcelos p...@dcc.fc.up.pt
Subject: Re: [Haskell-cafe] Not in scope: type constructor or class `Map'
To: haskell-cafe
On Wed, Sep 29, 2010 at 9:13 PM, Alexander Solla a...@2piix.com wrote:
On 09/29/2010 02:15 PM, DavidA wrote:
instance Monad (\v - Vect k (Monomial v))
Yes, that is exactly what I am trying to say. And since I'm not allowed to
say
it like that, I was trying to say it using a type synonym
is for one parameter type constructors (eg [], IO)
2. Poly is a two-parameter type constructor
3. So Poly k is a one-parameter type constructor
4. What I'm trying to express, that polynomials over field k are a monad,
is true.
However, GHC 6.12.2 complains:
Type synonym `Poly' should have 2
constructor
3. So Poly k is a one-parameter type constructor
4. What I'm trying to express, that polynomials over field k are a monad,
is true.
However, GHC 6.12.2 complains:
Type synonym `Poly' should have 2 arguments, but has been given 1
In the instance declaration for `Monad (Poly k
= ... -- variable substitution
So my thinking is:
1. The Monad type class is for one parameter type constructors (eg [], IO)
2. Poly is a two-parameter type constructor
3. So Poly k is a one-parameter type constructor
4. What I'm trying to express, that polynomials over field k are a monad
On 29 September 2010 20:48, Ryan Ingram ryani.s...@gmail.com wrote:
But it doesn't let you partially apply the type synonym.
On the other hand, if you did this:
newtype Compose f g a = O { unO :: f (g a) }
type Poly k = Compose (Vect k) Monomial
instance Monad (Poly k) where ...
would
On Wednesday 29 September 2010 2:52:21 pm Christopher Done wrote:
LiberalTypeSynonyms lets you partially apply type synonyms.
Not in general. LiberalTypeSynonyms only allows synonyms to be partially
applied when expansions of other type synonyms will eventually cause them to
become fully
Ryan Ingram ryani.spam at gmail.com writes:
Haskell doesn't have true type functions; what you are really saying is
instance Monad (\v - Vect k (Monomial v))
Yes, that is exactly what I am trying to say. And since I'm not allowed to say
it like that, I was trying to say it using a type
On Wednesday 29 September 2010 23:15:14, DavidA wrote:
Ryan Ingram ryani.spam at gmail.com writes:
Haskell doesn't have true type functions; what you are really saying
is
instance Monad (\v - Vect k (Monomial v))
Yes, that is exactly what I am trying to say. And since I'm not allowed
It's hard. Here's a simple example:
type Foo f = f Int
class C (f :: (* - *) - *) where
thingy :: f [] - f IO
-- Should this ever typecheck? I would say no; there's no way to
unify f [] with [Int].
callThingy :: [Int] - IO Int
callThingy = thingy
-- but what if you say this?
instance C
On Wed, Sep 29, 2010 at 11:15 PM, DavidA polyom...@f2s.com wrote:
Ryan Ingram ryani.spam at gmail.com writes:
Haskell doesn't have true type functions; what you are really saying is
instance Monad (\v - Vect k (Monomial v))
Yes, that is exactly what I am trying to say. And since I'm not
On 09/29/2010 02:15 PM, DavidA wrote:
instance Monad (\v - Vect k (Monomial v))
Yes, that is exactly what I am trying to say. And since I'm not allowed to say
it like that, I was trying to say it using a type synonym parameterised over v
instead.
Why not:
instance Monad ((-) Vect k
On 09/29/2010 09:13 PM, Alexander Solla wrote:
On 09/29/2010 02:15 PM, DavidA wrote:
instance Monad (\v - Vect k (Monomial v))
Yes, that is exactly what I am trying to say. And since I'm not
allowed to say
it like that, I was trying to say it using a type synonym
parameterised over v
David,
Ryan Ingram wrote:
Haskell doesn't have true type functions; what you are really saying
is
instance Monad (\v - Vect k (Monomial v))
Daniel Fischer wrote:
I think there was a theoretical reason why that isn't allowed (making type
inference undecidable? I don't remember, I don't
Gabriel Riba wrote:
New proposal draft:
Proposal: Type supplement for constructor specific uses of sum types
Purpose: Avoid error clauses (runtime errors), exception control or Maybe
types in partially defined (constructor specific) functions on sum types.
As an example, with
data List a
Jason Dagit dagit at codersbase.com writes:
How will this proposal scale with data types that have multiple
alternatives that make sense? No natural examples come to mind
so how about a contrived example:
data List2 a = Nil | Cons a (List2 a) | Cons2 a a (List2 a)
Now I want to
Edward Kmett suggests the use of @ instead of !
Edward Kmett wrote:
This is just a form of refinement type. Googling the term should turn up a
couple dozen papers on the topic.
You can emulate them (and more) with phantom types in the existing
type system, though admittedly the encoding is
* Actual system, with runtime errors (as in GHC Data.List head) or
exception throwing
hd :: List a - a
hd (Cons x _) - x
hd Nil - error error: hd: empty list -- error or exception throwing
* Proposed system extending types with constructors as Type!Constructor:
User must do pattern
with constructors as Type!Constructor:
User must do pattern matching before applying the constructor-specific
type function.
In ''var @ (Constructor _ _)'' the compiler should append the constructor
to the type as a pair (Type, Constructor) as an extended type for ''var''
No need
On 3 June 2010 16:14, Gabriel Riba griba2...@gmail.com wrote:
Maybe we could take out importance on the number of _ wildcards
(constructor
arity) with a syntax like.
li @ (Cons ...)
li @ (Nil ...)
can't you already use {} to get rid of the underscores?
li@(Cons {})
On 06/03/2010 10:14 AM, Gabriel Riba wrote:
No need for runtime errors or exception control
hd :: List!Cons a - a
hd (Cons x _) = x
This is already doable using GADTs:
data Z
data S n
data List a n where
Nil :: List a Z
Cons :: a - List a n - List a (S n)
Jake McArthur wrote:
On 06/03/2010 10:14 AM, Gabriel Riba wrote:
No need for runtime errors or exception control
hd :: List!Cons a - a
hd (Cons x _) = x
This is already doable using GADTs:
data Z
data S n
data List a n where
Nil :: List a Z
Cons :: a -
On 4 June 2010 03:18, Ozgur Akgun ozgurak...@gmail.com wrote:
On 3 June 2010 16:14, Gabriel Riba griba2...@gmail.com wrote:
Maybe we could take out importance on the number of _ wildcards
(constructor
arity) with a syntax like.
li @ (Cons ...)
li @ (Nil ...)
can't you
extending types with constructors as Type!Constructor:
User must do pattern matching before applying the constructor-specific
type function.
In ''var @ (Constructor _ _)'' the compiler should append the constructor
to the type as a pair (Type, Constructor) as an extended type for ''var''
No need
Brandon S. Allbery KF8NH wrote:
On Jun 18, 2008, at 15:31 , Stephen Howard wrote:
HttpMessage.hs:36:20: Not in scope: type constructor or class
`HttpRequest'
The troublesome line is the definition of the cookie function at the end
of the code. I've made
:
HttpMessage.hs:36:20: Not in scope: type constructor or class
`HttpRequest'
The troublesome line is the definition of the cookie function at the end
of the code. I've made
Right. HttpRequest is a data constructor associated with the type
constructor HttpMessage.
(Data constructors
On 2008 Jun 19, at 12:28, Stephen Howard wrote:
Cool, Either looks like what I'm looking for. I'll have to look
into that. What do I do about the fact that both HttpRequest and
HttpResponse have some of the same named fields (headers and body,
for example). Seems a pain to drop them
On Jun 18, 2008, at 15:31 , Stephen Howard wrote:
HttpMessage.hs:36:20: Not in scope: type constructor or class
`HttpRequest'
The troublesome line is the definition of the cookie function at
the end of the code. I've made
Right. HttpRequest is a data constructor associated
. Allbery KF8NH wrote:
On Jun 18, 2008, at 15:31 , Stephen Howard wrote:
HttpMessage.hs:36:20: Not in scope: type constructor or class
`HttpRequest'
The troublesome line is the definition of the cookie function at the
end of the code. I've made
Right. HttpRequest is a data constructor
:
On Jun 18, 2008, at 15:31 , Stephen Howard wrote:
HttpMessage.hs:36:20: Not in scope: type constructor or class
`HttpRequest'
The troublesome line is the definition of the cookie function at the end
of the code. I've made
Right. HttpRequest is a data constructor associated
:
Not in scope: type constructor or class
`HOC.Arguments:ObjCArgument'
But if you look through the output below you will see that
HOC.Arguments is being loaded by ghc. I assume that's what the
skipping of HOC.Arguments means.
--
http://wagerlabs.com
At 18:38 14/10/03 -0700, Brandon Michael Moore wrote:
On Mon, 13 Oct 2003, Graham Klyne wrote:
Results in a fairly obvious type error: I'd need to have a way to say that
vbMap is applied to the value under construction. Experience with Java
would
suggest maybe something like this:
[[
On Mon, 13 Oct 2003, Graham Klyne wrote:
I've run across a minor coding niggle on a couple opf accosions when using
a type constructor with field selectors. The full code of my test case is
below. The value 'test2' evaluates to True.
The function that niggles me
Graham Klyne writes:
:
| What I'd really like to do is assign it to field vbMap, and reference that
| from the definition of vbEnum, but I can't figure out if there's a way
| to do so. Writing this:
| [[
| joinVarBindings vb1 vb2
| | vbNull vb1 = vb2
| | vbNull vb2 = vb1
|
On 22-Feb-2002, Cagdas Ozgenc [EMAIL PROTECTED] wrote:
If (-) is a type constructor, what does its definition look like, what data
constructors does it have? How does it differ from other type constructors,
or maybe it doesn't?
It is an abstract data type.
The representation is implementation
Greetings folks.
If (-) is a type constructor, what does its
definition look like, what data constructors does it have? How does it differ
from other type constructors, or maybe it doesn't?
Could someone give an explanation...
Thanks for taking time.
41 matches
Mail list logo