Веб Зображення Новини Групи Блоги Перекладач Gmail Ще »
Групи, які ви переглядали нещодавно | Довідка | Увійти
Головна сторінка Груп Google
Допис з розмови reads

Переглянути розібране Показувати лише текст повідомлення

Path: g2news1.google.com!news2.google.com!news.glorb.com!feeder.erje.net!newsfeed.straub-nv.de!newsfeed-fusi2.netcologne.de!195.14.215.230.MISMATCH!news.netcologne.de!newsfeed-hp2.netcologne.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail
From: Dirk Thierbach <dthierb...@usenet.arcornews.de>
Subject: Re: reads
Newsgroups: comp.lang.haskell
References: <79ci0lF1pj6nuU1@mid.dfncis.de> <87ski6c0bg.fsf@ixod.org>
User-Agent: tin/1.9.3-20080506 ("Dalintober") (UNIX) (Linux/2.6.26-rc4 (i686))
Date: Thu, 11 Jun 2009 19:05:51 +0200
Message-ID: <20090611170551.274F.1.NOFFLE@dthierbach.news.arcor.de>
Reply-To: Dirk Thierbach <dthierb...@usenet.arcornews.de>
Lines: 30
Organization: Arcor
NNTP-Posting-Date: 11 Jun 2009 19:25:22 CEST
NNTP-Posting-Host: a60d5774.newsspool1.arcor-online.net
X-Trace: DXC=dhHN8fKbT;[<<0iRN7DLEQic==]BZ:af^4Fo<]lROoRQ^YC2XCjHcbYmSFUbB?ek8YdS3OJiQDdLVQQ3mNO3WmVTGa=WRdVR9E^5TN3C2j\HQU
X-Complaints-To: usenet-abuse@arcor.de

Mark T.B. Carroll <Mark.Carr...@aetion.com> wrote:
> Frank Poettgen <Frank.Poett...@Post.RxWyTxH-AyAzCyHzEyN.de> writes:
> 
>> I would expect
>>
>> reads "1.2" :: [(Int,String)]
>>
>> to be evaluated to
>>
>> [(1,".2")]
>>
>> but using Hugs (Version Sep 2006) it is just
>>
>> []
>>
>> Bug or feature?

> Good question. GHCi, version 6.8.2, agrees with Hugs.

The reason at least in GHC is that all numeric instances use the same
function to parse the string. The string is then converted, unless
conversion fails. Because of that, one also gets e.g.

> reads "1e2" :: [(Int,String)]
[(100,"")]

AFAIK the report doesn't specify exactly how to parse a number, so I 
strongly suspect "feature". But I never noticed that before, too.

- Dirk

Створити групу - Групи Google - Домашня сторінка Google - Правила користування послугою - Заява про конфіденційність і нерозголошення інформації
©2009 Google