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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:52:31+00:00 2026-05-13T17:52:31+00:00

The Control.Exception documentation says I can do the following to create my own exception:

  • 0

The Control.Exception documentation says I can do the following to create my own exception:

 data MyException = ThisException | ThatException
     deriving (Show, Typeable)

 instance Exception MyException

If I paste this into a file and compile (after importing Control.Exception and Data.Typeable), I get:

exp.hs:6:20:
    Can't make a derived instance of `Typeable MyException'
      (You need -XDeriveDataTypeable to derive an instance for this class)
    In the data type declaration for `MyException'

Must I turn on this extension in order to have user-defined exceptions? If not, someone please provide an example. Thanks.

  • 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-13T17:52:32+00:00Added an answer on May 13, 2026 at 5:52 pm

    Yes, you need to turn on that extension. It’s not a good idea to try to write the Typeable instance by hand because it has some ties to the internals of GHC.

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

Sidebar

Related Questions

I got the following Design time exception for my control in WPF System.NotImplementedException The
Here's an extract from the documentation of evaluate : Control.Exception.Base.evaluate :: a -> IO
I'm getting the following exception while redrawing my DataGridView control: Unhandled exception : Odwołanie
I'm getting an exception from Cruise Control about not being able to connect to
Documentation of BlockingQueue says bulk operations are not thread-safe, though it doesn't explicitly mention
I can't find any documentation to confirm this, but it appears that you can
Referencing Spring documentation : Any RuntimeException will trigger rollback, and any checked Exception will
On Linux, feenableexcept and fedisableexcept can be used to control the generation of SIGFPE
I have my own exception handler: module Frog module Errors class NotFound < FrogError
How exactly is the right way to call IEnumerator.Reset ? The documentation says: The

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.