Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,324
    • Issues 4,324
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 373
    • Merge Requests 373
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #67

Closed
Open
Opened Apr 23, 2002 by nobody@trac-nobody

Signature context in recursive groups

Hello,

I have a problem with signature contexts in mutually
recursive groups. I want to write a scanner, which is
able to read inputs of the form "int(3)" or
"float(2,0)" and return corresponding values of the
datatype:

data Token = TInt Int
	   | TFloat Float
   deriving (Read,Show)

Both constructors have the same type. Therefore, I want
to pass them to another function, which reads the
corresponding number with the function reads:

scan :: String -> [Token]
scan ('i':'n':'t':str) = scanNumber TInt str
scan ('f':'l':'o':'a':'t':str) = scanNumber TInt str

scanNumber :: Read a => (a -> Token) -> String ->
[Token]
scanNumber tokenCons ('(':str) = case reads str of
		                   ((n,(')':str1)):_) -> tokenCons
                                                                           
n:scan str1
		                   _            -> error "no literal"

main = print (scan "int(4)")

In Hugs this program works fine, but ghc does not
accept it, because of a mutually recursive group. Is
this a feature or a bug?
What does the Haskell 98 standard say?

Thanks and regards,

Frank Huch
Trac metadata
Trac field Value
Version 5.0
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution ResolvedWon'tFix
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#67