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 6738063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:19:21+00:00 2026-05-26T11:19:21+00:00

Returning a datatype. For instance, let’s say that I had made a datatype: data

  • 0

Returning a datatype.
For instance, let’s say that I had made a datatype:

data Something = Something Int [Char]

And, then I did some manipulation with the following function (the exact function of which is irrelevant):

manipulativeFunc::Something->[Something]

I keep getting these strange error messages that

Top level:
    No instance for (Show (Int -> IO ()))
        arising from use of 'print' at Top level
    Probable fix: add an instance declaration for (Show (Int -> IO ()))
    In a 'do' expression: print it

Note that I don’t have any uses of print anywhere in my program, nor do I have any uses of IO. The data declaration and the manipulativeFunc are all I have on it.

What could I be doing wrong?

EDIT: From commenters, I get the message that I may need to declare a Show instance for this task. So, what if I had

data Something = Something Int Int

Then how would I write a Show instance function for it?

  • 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-05-26T11:19:22+00:00Added an answer on May 26, 2026 at 11:19 am

    In order to use the function print, the compiler needs to be able to convert a value into a String, which is ensured by the Show class. You try to display a function, and there is no Show instance defined for it.

    In order to be able to display your Something, use

    data Something = Something Int [Char] deriving Show
    

    manipulativeFunc can’t be displayed that way, but its result if you call it with an argument.

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

Sidebar

Related Questions

i have ajax call which is returning data to me . Say i have
Say instead of returning void a method you returned a reference to the class
I am returning XML data from the Yahoo GeoPlanet web service using HttpWebRequest .
I have a problem returning data back to the function I want it returned
I currently am returning a table that looks like this: Country Result ------ -----
I'm returning multiple pieces of data for each result. In each result I have
(sorry for the english) I have a ASP .net webservice that get data from
I'm returning some preformtatted data from the server as a string. this is passed
I have a db table with column of datatype char(20). I'm not allowed to
Which is better for performance when calling a function that provides a simple datatype

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.