Re: [Haskell-cafe] type constructor section for (- Bool), _not_ ((-) Bool)

2013-09-04 Thread AntC
, 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

Re: [Haskell-cafe] type constructor section for (- Bool), _not_ ((-) Bool)

2013-09-03 Thread Brent Yorgey
. 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

[Haskell-cafe] Not in scope: type constructor or class `Map'

2010-12-30 Thread michael rice
] 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

Re: [Haskell-cafe] Not in scope: type constructor or class `Map'

2010-12-30 Thread Eric Stansifer
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

Re: [Haskell-cafe] Not in scope: type constructor or class `Map'

2010-12-30 Thread Pedro Vasconcelos
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

Re: [Haskell-cafe] Not in scope: type constructor or class `Map'

2010-12-30 Thread michael rice
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

Re: [Haskell-cafe] Re: Monad instance for partially applied type constructor?

2010-09-30 Thread Ryan Ingram
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

[Haskell-cafe] Monad instance for partially applied type constructor?

2010-09-29 Thread DavidA
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

Re: [Haskell-cafe] Monad instance for partially applied type constructor?

2010-09-29 Thread Christopher Done
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

Re: [Haskell-cafe] Monad instance for partially applied type constructor?

2010-09-29 Thread Ryan Ingram
= ... -- 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

Re: [Haskell-cafe] Monad instance for partially applied type constructor?

2010-09-29 Thread Christopher Done
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

Re: [Haskell-cafe] Monad instance for partially applied type constructor?

2010-09-29 Thread Dan Doel
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

[Haskell-cafe] Re: Monad instance for partially applied type constructor?

2010-09-29 Thread DavidA
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

Re: [Haskell-cafe] Re: Monad instance for partially applied type constructor?

2010-09-29 Thread Daniel Fischer
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

Re: [Haskell-cafe] Re: Monad instance for partially applied type constructor?

2010-09-29 Thread Ryan Ingram
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

Re: [Haskell-cafe] Re: Monad instance for partially applied type constructor?

2010-09-29 Thread Gábor Lehel
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

Re: [Haskell-cafe] Re: Monad instance for partially applied type constructor?

2010-09-29 Thread Alexander Solla
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

Re: [Haskell-cafe] Re: Monad instance for partially applied type constructor?

2010-09-29 Thread Alexander Solla
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

Re: [Haskell-cafe] Re: Monad instance for partially applied type constructor?

2010-09-29 Thread Stefan Holdermans
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

Re: [Haskell-cafe] Re: Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-07 Thread wren ng thornton
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

[Haskell-cafe] Re: Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-04 Thread Gabriel Riba
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

[Haskell-cafe] Re: Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-04 Thread Gabriel Riba
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

[Haskell-cafe] Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-03 Thread Gabriel Riba
* 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

Re: [Haskell-cafe] Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-03 Thread Thomas Davie
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

Re: [Haskell-cafe] Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-03 Thread Ozgur Akgun
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 {})

Re: [Haskell-cafe] Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-03 Thread Jake McArthur
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)

Re: [Haskell-cafe] Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-03 Thread wren ng thornton
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 -

Re: [Haskell-cafe] Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-03 Thread Ivan Miljenovic
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

Re: [Haskell-cafe] Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-03 Thread Jason Dagit
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

Re: [Haskell-cafe] type constructor confusion

2008-06-19 Thread Stephen Howard
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

Re: [Haskell-cafe] type constructor confusion

2008-06-19 Thread Dan Weston
: 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

Re: [Haskell-cafe] type constructor confusion

2008-06-19 Thread Brandon S. Allbery KF8NH
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

Re: [Haskell-cafe] type constructor confusion

2008-06-18 Thread Brandon S. Allbery KF8NH
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

Re: [Haskell-cafe] type constructor confusion

2008-06-18 Thread Stephen Howard
. 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

Re: [Haskell-cafe] type constructor confusion

2008-06-18 Thread Ryan Ingram
: 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

[Haskell-cafe] Re: Not in scope: type constructor or class

2006-07-01 Thread Joel Reymont
: 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

Re: Using field selectors in a type constructor

2003-10-15 Thread Graham Klyne
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: [[

Re: Using field selectors in a type constructor

2003-10-14 Thread Brandon Michael Moore
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

Using field selectors in a type constructor

2003-10-14 Thread Tom Pledger
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 |

Re: if - is a type constructor

2002-02-24 Thread Fergus Henderson
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

if - is a type constructor

2002-02-21 Thread Cagdas Ozgenc
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.