Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Re: [Haskell-cafe] Defining a containing function on
      polymorphic list (frantisek kocun)
   2.  MULTICONF-09 call for papers (Ed)
   3.  Restricting integers in a type? (Colin Paul Adams)
   4.  Re: Restricting integers in a type? (Ertugrul Soeylemez)
   5. Re:  Re: Restricting integers in a type? (Colin Paul Adams)
   6. Re:  Restricting integers in a type? (Thomas Davie)
   7.  Re: Restricting integers in a type? (Ertugrul Soeylemez)
   8.  about Data.BinaryTree (Liu Jian)


----------------------------------------------------------------------

Message: 1
Date: Wed, 24 Dec 2008 16:36:20 +0100
From: "frantisek kocun" <[email protected]>
Subject: [Haskell-beginners] Re: [Haskell-cafe] Defining a containing
        function on polymorphic list
To: "Ryan Ingram" <[email protected]>
Cc: Raeck Zhao <[email protected]>, [email protected],
        [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Hi Raeck, as I see what types you defined, don't you doing School of
Expression? (In summer I made my way to FAL chapter, but I had no time more
(school), but  I will definitely finish that book:)

Fero
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20081224/5f271f7b/attachment-0001.htm

------------------------------

Message: 2
Date: Sat, 27 Dec 2008 12:59:23 -0800 (PST)
From: Ed <[email protected]>
Subject: [Haskell-beginners] MULTICONF-09 call for papers
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

MULTICONF-09 call for papers
 
The 2009 Multi Conference in Computer Science, Information Technology and 
Control systems and Computational Science and Computer Engineering 
(MULTICONF-09) (website: http://www.PromoteResearch.org) will be held during 
July 13-16 2009 in Orlando, FL, USA. We invite draft paper submissions. The 
event consists of the following conferences:
·         International Conference on Artificial Intelligence and Pattern 
Recognition (AIPR-09) 
·         International Conference on Automation, Robotics and Control Systems 
(ARCS-09)
·         International Conference on Bioinformatics, Computational Biology, 
Genomics and Chemoinformatics (BCBGC-09)
·         International Conference on Enterprise Information Systems and Web 
Technologies (EISWT-09)
·         International Conference on High Performance Computing, Networking 
and Communication Systems (HPCNCS-09) 
·         International Conference on Information Security and Privacy (ISP-09)
·         International Conference on Recent Advances in Information Technology 
and Applications (RAITA-09)
·         International Conference on Software Engineering Theory and Practice 
(SETP-09) 
·         International Conference on Theory and Applications of Computational 
Science (TACS-09)
·         International Conference on Theoretical and Mathematical Foundations 
of Computer Science (TMFCS-09)
 
The website http://www.PromoteResearch.org  contains more details.
 
Sincerely
John Edward
Publicity committee
 
 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20081227/43bde7f6/attachment-0001.htm

------------------------------

Message: 3
Date: Sun, 28 Dec 2008 09:07:08 +0000
From: Colin Paul Adams <[email protected]>
Subject: [Haskell-beginners] Restricting integers in a type?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

Hello,

I want to declare a type thus:

type Coordinate = (Int, Int)

But the two integers must be confined to the inclusive range 0-11. Can
i express that in the type system?
-- 
Colin Adams
Preston Lancashire


------------------------------

Message: 4
Date: Sun, 28 Dec 2008 16:26:10 +0100
From: Ertugrul Soeylemez <[email protected]>
Subject: [Haskell-beginners] Re: Restricting integers in a type?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII

Colin Paul Adams <[email protected]> wrote:

> I want to declare a type thus:
>
> type Coordinate = (Int, Int)
>
> But the two integers must be confined to the inclusive range 0-11. Can
> i express that in the type system?

Well, the type system allows you to create your own ranged integer type.
Here is a rather inflexible, but working method to do it:

  newtype Int12 = Int12 Int
    deriving (Eq, Read, Show)

  instance Num Int12 where
    Int12 x + Int12 y
      | x+y <= 11 = Int12 (x+y)
      | otherwise = error "Int12 addition out of range"
    ...


Greets,
Ertugrul.


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://blog.ertes.de/




------------------------------

Message: 5
Date: Sun, 28 Dec 2008 15:56:14 +0000
From: Colin Paul Adams <[email protected]>
Subject: Re: [Haskell-beginners] Re: Restricting integers in a type?
To: Ertugrul Soeylemez <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii

>>>>> "Ertugrul" == Ertugrul Soeylemez <[email protected]> writes:

    Ertugrul> Colin Paul Adams <[email protected]> wrote:
    >> I want to declare a type thus:
    >> 
    >> type Coordinate = (Int, Int)
    >> 
    >> But the two integers must be confined to the inclusive range
    >> 0-11. Can i express that in the type system?

    Ertugrul> Well, the type system allows you to create your own
    Ertugrul> ranged integer type.  Here is a rather inflexible, but
    Ertugrul> working method to do it:

    Ertugrul>   newtype Int12 = Int12 Int deriving (Eq, Read, Show)

    Ertugrul>   instance Num Int12 where Int12 x + Int12 y | x+y <= 11
    Ertugrul> = Int12 (x+y) | otherwise = error "Int12 addition out of
    Ertugrul> range" ...

That would seem to allow x = -3 and y = 13, for instance.
-- 
Colin Adams
Preston Lancashire


------------------------------

Message: 6
Date: Sun, 28 Dec 2008 17:08:21 +0100
From: Thomas Davie <[email protected]>
Subject: Re: [Haskell-beginners] Restricting integers in a type?
To: Colin Paul Adams <[email protected]>
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes


type Coordinate = (RInt,RInt)

data RInt = Zero | One | Two | Three | Four | Five | Six | Seven |  
Eight | Nine | Ten | Eleven

You might also want to add an instance of Num so that you can define  
them simply by typing the relevant number, but then you'll lose the  
type system checking the bounds.

Bob

On 28 Dec 2008, at 10:07, Colin Paul Adams wrote:

> Hello,
>
> I want to declare a type thus:
>
> type Coordinate = (Int, Int)
>
> But the two integers must be confined to the inclusive range 0-11. Can
> i express that in the type system?
> -- 
> Colin Adams
> Preston Lancashire
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners



------------------------------

Message: 7
Date: Sun, 28 Dec 2008 23:47:16 +0100
From: Ertugrul Soeylemez <[email protected]>
Subject: [Haskell-beginners] Re: Restricting integers in a type?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCII

Colin Paul Adams <[email protected]> wrote:

>     Ertugrul> Well, the type system allows you to create your own
>     Ertugrul> ranged integer type.  Here is a rather inflexible, but
>     Ertugrul> working method to do it:
>
>     Ertugrul>   newtype Int12 = Int12 Int deriving (Eq, Read, Show)
>
>     Ertugrul>   instance Num Int12 where Int12 x + Int12 y | x+y <= 11
>     Ertugrul> = Int12 (x+y) | otherwise = error "Int12 addition out of
>     Ertugrul> range" ...
>
> That would seem to allow x = -3 and y = 13, for instance.

Not if you disallow an x = -3 and y = 13 to happen in the first place.
Haskell's module and type system allows you to do that.


Greets,
Ertugrul.


-- 
Key-ID: E5DD8D11 "Ertugrul Soeylemez <[email protected]>"
FPrint: 0F12 0912 DFC8 2FC5 E2B8  A23E 6BAC 998E CE40 2012
Keysrv: hkp://subkeys.pgp.net/

-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://blog.ertes.de/




------------------------------

Message: 8
Date: Mon, 29 Dec 2008 11:22:04 +0800
From: "Liu Jian" <[email protected]>
Subject: [Haskell-beginners] about Data.BinaryTree
To: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

Hi All,

   Is there any implementation of binary tree in haskell library? for example,
"insert   lookup  empty  adjust   isEmpty  delete" including in it.

  cheers,
---
email to: [email protected]


------------------------------

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 6, Issue 9
***************************************

Reply via email to