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

  • SEARCH
  • Home
  • 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 8082361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:04:13+00:00 2026-06-05T17:04:13+00:00

Like the title says I’m having some trouble printing out symbol codes and their

  • 0

Like the title says I’m having some trouble printing out symbol codes and their corresponding symbols using Haskell…what I have at the moment is this:

import Data.Char
import Debug.Trace

foo z | trace ("Symbolcode " ++ show z ++ " is " ++ (chr z)) False = undefined
foo z = if (z <= 128)
    then foo (z+1)
    else show "All done."

…and I get an error like this:

Couldn't match expected type `[Char]' with actual type `Char'
In the return type of a call of `chr'
In the second argument of `(++)', namely `(chr z)'
In the second argument of `(++)', namely `" is " ++ (chr z)'

What am I doing wrong and is there an easier way of doing this (for example without using the trace module)?

  • 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-05T17:04:16+00:00Added an answer on June 5, 2026 at 5:04 pm

    It is a bad idea to use trace for anything other than debugging, because the execution order is unreliable.

    If you want to do something for all integers in a range, start by making the list [0 .. 127] of integers you want to process. To output some text, you should use an IO action such as putStrLn. Unlike trace, putStrLn will always execute when it is supposed to. Map this IO action over your list to print all the characters.

    showCharCode n = putStrLn ("Symbol code " ++ show n ++ " is " ++ [chr n])
    foo = mapM_ showCharCode [0 .. 127]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So like the title says im starting to learn some python and im having
as the title says, I would like to create a many-to-one relationship using Fluent
Like the title says: can we use ...USING fts3(tokenizer icu th_TH, ...) . If
Like the title says, I am using devise. I want to navigate to /users/1
Like the title says I am trying to create some regex that selects anything
Like the title says, we are using ABCPdf6 to render PDFs from XSLT. Everything
like the title says, I am trying to create a drop down menu using
Like the title says, i would like to get a thread-safe HashSet using Guava
Like the title says, I'm wondering if the use of WebClient is the proper
Like the title says, PHP is really confusing me on a simple if comparison

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.