Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8061395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:19:32+00:00 2026-06-05T10:19:32+00:00

I switched from C++ to Haskell and use Gloss to make games. I wrote

  • 0

I switched from C++ to Haskell and use Gloss to make games.
I wrote this valid code in a main.hs:

import Graphics.Gloss.Interface.Pure.Game

events (EventKey (Char 'a') Down _ _) _ = RectangleWire 10 10
events _ x = x

main = play (InWindow "GameEvent" (700, 100) (10, 10))
    white
    100
    (Circle 10.0)
    id
    events
    (\_ world -> world)

Then the command ghc main.hs answered:

[1 of 1] Compiling Main             ( main.hs, main.o )

main.hs:3:43: Not in scope: data constructor `RectangleWire'

It seems some functions are missing from my Gloss lib even though I have the latest version installed. For example, this code, “Game Event” from the gloss-examples package, compiles and runs perfectly (so beautiful):

import Graphics.Gloss

-- | Display the last event received as text.
main
 = play (InWindow "GameEvent" (700, 100) (10, 10))
        white
        100
        ""
        (\str     -> Translate (-340) 0 $ Scale 0.1 0.1 $ Text str)
        (\event _ -> show event)
        (\_ world -> world)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T10:19:33+00:00Added an answer on June 5, 2026 at 10:19 am

    Your code is failing to compile because a data constructor you refer to, RectangleWire is not in scope. The error indicates this:

    main.hs:3:43: Not in scope: data constructor `RectangleWire'
    

    Scanning the documentation for Gloss, it looks like you’re looking for

    rectangleWire :: Float -> Float -> PictureSource
    

    A wireframe rectangle centered about the origin, with the given width and height. Exported from Graphics.Gloss.Data.Picture.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just switched from Eclipse to IntelliJ and noticed that when I use Reformat
I switched from Visual Studio to Code::Blocks yesterday, and just had some strange compiler
I just switched from XAMPP to MAMP and now this rewrite rule does not
Has anyone come across this? Basically I switched from the SUN jre to IBM's
I am new to functional programming and just switched from haskell (Didn't like it
I switched from WEBrick to Phussion Passenger following this guide: http://developer.apple.com/library/mac/#featuredarticles/PhusionRails/index.html . I used
I just switched from 1.2 to trunk (r15175 at this writing) to play with
I've recently switched from a Windows XP machine to Windows 7. I use Subversion
Just switched from Botan 1.4 to Botan 1.10. Configure, make and install worked fine
I've recently switched from Mule 2.2.1 to Mule 3.x The gist of this is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.