[Haskell-cafe] About using "type" to do type alias.
magicloud.magiclouds at gmail.com
Mon Jun 25 09:46:11 CEST 2012
Here is the code, I joined two modules in one paste. Both of them
cannot pass compiling.
On Mon, Jun 25, 2012 at 2:16 PM, Ivan Lazar Miljenovic
<ivan.miljenovic at gmail.com> wrote:
> On 25 June 2012 12:50, Magicloud Magiclouds
> <magicloud.magiclouds at gmail.com> wrote:
>> There was another mail, but the subject might be confusing. So I
>> write this one. The code is here: http://hpaste.org/70414
>> If I understand correct, generally, I could use 'type' to do alias
>> to save the ugly-long code. Like section 1. This works when I 't [(0,
>> Just "x")]'.
>> But, if I wrote section 2. Then 'start (M.fromList $ zip ord_args)
>> worker' could not be compiled due to the second argument is type of
>> 'M.Map Arg Arg', not 'JobArgs Arg Arg'.
> This shouldn't make a difference. As an example, this works:
>> import qualified Data.Map as M
>> type Foo a b = M.Map a b
>> fooInsert :: (Ord a) => a -> b -> Foo a b -> Foo a b
>> fooInsert = M.insert
> Aliases are just for documentation; they shouldn't affect code working.
>> What did I miss to make this work?
>> And for G+, please use magiclouds#gmail.com.
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
And for G+, please use magiclouds#gmail.com.
More information about the Haskell-Cafe