Re: [Haskell-cafe] Type synonyms vs standard types

2009-09-30 Thread Olex P
True. But anyway newtype creates a new type which is not what I'm looking for. In this case instead of passing a string myAttrName user should pass constructor as well. And the next step of such simplification will be a smart constructor attrName? :) And that's all just to show user of that

[Haskell-cafe] Type synonyms vs standard types

2009-09-29 Thread Olex P
Hi everyone, Dumb question about declaring a function and type synonyms. There are to different declarations of the same function: attrNames :: String - AttrDict - [String] attrNames :: AttrClass - AttrDict - AttrNames First gives you the idea about exact types it expects (except AttrDict for

Re: [Haskell-cafe] Type synonyms vs standard types

2009-09-29 Thread Michael Snoyman
On Tue, Sep 29, 2009 at 7:40 PM, Olex P hoknam...@gmail.com wrote: Hi everyone, Dumb question about declaring a function and type synonyms. There are to different declarations of the same function: attrNames :: String - AttrDict - [String] attrNames :: AttrClass - AttrDict - AttrNames

Re: [Haskell-cafe] Type synonyms vs standard types

2009-09-29 Thread Luke Palmer
On Tue, Sep 29, 2009 at 11:40 AM, Olex P hoknam...@gmail.com wrote: Hi everyone, Dumb question about declaring a function and type synonyms. There are to different declarations of the same function: attrNames :: String - AttrDict - [String] attrNames :: AttrClass - AttrDict - AttrNames

Re: [Haskell-cafe] Type synonyms vs standard types

2009-09-29 Thread Olex P
This idea with new level of abstraction is good but in some cases it can make things overcomplicated / less efficient. Does that mean leave simple built-in types as is? But probably that's all is the matter of habit and style. Thanks guys On Tue, Sep 29, 2009 at 8:58 PM, Luke Palmer

Re: [Haskell-cafe] Type synonyms vs standard types

2009-09-29 Thread Luke Palmer
On Tue, Sep 29, 2009 at 2:21 PM, Olex P hoknam...@gmail.com wrote: This idea with new level of abstraction is good but in some cases it can make things overcomplicated / less efficient. Does that mean leave simple built-in types as is? But probably that's all is the matter of habit and style.

Re: [Haskell-cafe] Type synonyms vs standard types

2009-09-29 Thread wren ng thornton
Olex P wrote: This idea with new level of abstraction is good but in some cases it can make things overcomplicated / less efficient. Does that mean leave simple built-in types as is? That's what newtypes are for. A newtype is like a type alias, except that it is type checked. All newtype

[Haskell-cafe] Type synonyms

2008-03-26 Thread Hugo Pacheco
Hi guys, There is something I think not to fully understand: what are the differences between these two type synonyms? type FInt x = Either One x type FInt = Either One Their kind is the same, so do they differ or are exactly the same type? Thanks, hugo

Re: [Haskell-cafe] Type synonyms

2008-03-26 Thread Dan Doel
On Wednesday 26 March 2008, Hugo Pacheco wrote: Hi guys, There is something I think not to fully understand: what are the differences between these two type synonyms? type FInt x = Either One x type FInt = Either One Their kind is the same, so do they differ or are exactly the same type?

Re: [Haskell-cafe] Type Synonyms

2007-10-11 Thread ok
On 11 Oct 2007, at 4:06 pm, Tom Davies basically asked for something equivalent to Ada's type T is new Old_T; which introduces a *distinct* type T that has all the operations and literals of Old_T. In functional terms, suppose there is a function f :: ... Old_T ... Old_T ...

Re: [Haskell-cafe] Type Synonyms

2007-10-11 Thread Jonathan Cast
On Fri, 2007-10-12 at 11:00 +1300, ok wrote: On 11 Oct 2007, at 4:06 pm, Tom Davies basically asked for something equivalent to Ada's type T is new Old_T; which introduces a *distinct* type T that has all the operations and literals of Old_T. In functional terms, suppose there is a

[Haskell-cafe] Type Synonyms

2007-10-10 Thread Tom Davies
Newbie question: I was wondering the other day if type synonyms might be more useful if they were more restricted, that is, with the definitions: type Foo = String type Bar = String foo :: Foo foo = a foo bar :: Bar bar = a bar x :: Foo - ... x f b = ...only valid for Foo Strings... both 'x

Re: [Haskell-cafe] Type Synonyms

2007-10-10 Thread Andrew Wagner
If you change your type declarations to 'newtype' declarations, I believe you would get the effect that you want, depending on what you mean by 'equivalent'. In that case, Foo and Bar would essentially be strings, but you could not use either of them in a place where the other is expected, nor