Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,244
    • Issues 5,244
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 567
    • Merge requests 567
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #5380
Closed
Open
Issue created Aug 05, 2011 by sebf@trac-sebf

arrows if command given too general a type

This is a reduced version of a function posted on Haskell Cafe:

{-# LANGUAGE Arrows #-}

testB :: not_bool -> (() -> ()) -> () -> not_unit
testB b f = proc () -> if b then f -< () else f -< ()

There are two problems with the type of this function

  • the first argument can be anything but should be Bool and
  • the result type can be anything but should be ().

Yet the function is accepted by GHC.

This function can be used to define a value of arbitrary type:

anythingYouWant :: anything
anythingYouWant = testB () (const ()) ()

Here are some example calls from my machine:

ghci> anythingYouWant :: Int
1098066529
ghci> anythingYouWant :: String
""
ghci> anythingYouWant :: Char
'\1098066529'
ghci> anythingYouWant () :: ()
()
ghci> anythingYouWant () :: [()]
[()Segmentation fault
Trac metadata
Trac field Value
Version 7.0.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited Mar 09, 2019 by Ross Paterson
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking