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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:13:51+00:00 2026-06-14T22:13:51+00:00

I declare my data type as an instance of class Num and implement only

  • 0

I declare my data type as an instance of class Num and implement only method sum (+). The other methods like (*), negate, abs, fromInteger, etc. I don’t implement. The reason is I don’t need these methods for my data type.

I compile the programme, and it’s ok except some uncomfortable warnings such as:

Warning: No explicit method nor default method for `*'
...

How can I avoid these warnings, or do I need to implement the above methods? Actually, I don’t want to implement them.

  • 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-14T22:13:52+00:00Added an answer on June 14, 2026 at 10:13 pm

    You can silence these warnings with a command line flag (in GHC)

    ghc -fno-warn-missing-methods YourFile.hs
    

    But if you only want to implement addition, then it is probably not appropriate to make your type an instance of Num. If you want just to have a nice operator for an operation on the type, you can define your own, you can even re-use (+) if you

    import Prelude hiding ((+))
    import qualified Prelude  -- so that (+) can be still used in qualified form
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big class. To sum up, it has only one method that
I have a very basic data class that is subclassed from NSObject. I declare
I've created a Dojo module which depends on dojox/data/JsonRestStore like this: define(my/MyRestStore, [dojo/_base/declare, dojox/data/JsonRestStore],
Hi I am writing a linked list data type. I have an inner class
I'm trying to declare my own data with appropriate conversion as class. My code
I have a JSON that contains the following: {p1:{debris:{titanium:0,silicum:0}},p2:{debris:{titanium:0,silicum:0}}... I declare the data using
I am trying to declare a private Data Structure such as the Vector in
Given the following data/schema: DECLARE @t1 TABLE ( Id int NOT NULL ) DECLARE
'Names' in table 'Data' type12pen105A type12pen110A type12pen121B Declare @n int; select Names From Data
My table and data as following, declare @t1 table (myID varchar(200), chequeNo varchar(20)); insert

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.