Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/docs/bugs/nhc13test7.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


-- FIXED

{-
We should allow any integer literal (eg. "0", "123") to be read as a double.
Try:
nhc13test7 'Test 0'
which does not parse, against
nhc13test7 'Test 0.0'
which does.
-}

import System(getArgs)

data Plan = Plan [Int] [Phase]
          deriving (Read,Show)
data Phase = Phase (Maybe Int) [Int] Double Double Double
           deriving (Read,Show)

data Test = Test Double
          deriving (Read,Show)

main = do argv <- getArgs
          print ((read (argv!!0))::Test)

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.