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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:35:55+00:00 2026-05-25T01:35:55+00:00

While explaining to someone what a type class X is I struggle to find

  • 0

While explaining to someone what a type class X is I struggle to find good examples of data structures which are exactly X.

So, I request examples for:

  • A type constructor which is not a Functor.
  • A type constructor which is a Functor, but not Applicative.
  • A type constructor which is an Applicative, but is not a Monad.
  • A type constructor which is a Monad.

I think there are plenty examples of Monad everywhere, but a good example of Monad with some relation to previous examples could complete the picture.

I look for examples which would be similar to each other, differing only in aspects important for belonging to the particular type class.

If one could manage to sneak up an example of Arrow somewhere in this hierarchy (is it between Applicative and Monad?), that would be great too!

  • 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-25T01:35:55+00:00Added an answer on May 25, 2026 at 1:35 am

    A type constructor which is not a Functor:

    newtype T a = T (a -> Int)
    

    You can make a contravariant functor out of it, but not a (covariant) functor. Try writing fmap and you’ll fail. Note that the contravariant functor version is reversed:

    fmap      :: Functor f       => (a -> b) -> f a -> f b
    contramap :: Contravariant f => (a -> b) -> f b -> f a
    

    A type constructor which is a functor, but not Applicative:

    I don’t have a good example. There is Const, but ideally I’d like a concrete non-Monoid and I can’t think of any. All types are basically numeric, enumerations, products, sums, or functions when you get down to it. You can see below pigworker and I disagreeing about whether Data.Void is a Monoid;

    instance Monoid Data.Void where
        mempty = undefined
        mappend _ _ = undefined
        mconcat _ = undefined
    

    Since _|_ is a legal value in Haskell, and in fact the only legal value of Data.Void, this meets the Monoid rules. I am unsure what unsafeCoerce has to do with it, because your program is no longer guaranteed not to violate Haskell semantics as soon as you use any unsafe function.

    See the Haskell Wiki for an article on bottom (link) or unsafe functions (link).

    I wonder if it is possible to create such a type constructor using a richer type system, such as Agda or Haskell with various extensions.

    A type constructor which is an Applicative, but not a Monad:

    newtype T a = T {multidimensional array of a}
    

    You can make an Applicative out of it, with something like:

    mkarray [(+10), (+100), id] <*> mkarray [1, 2]
      == mkarray [[11, 101, 1], [12, 102, 2]]
    

    But if you make it a monad, you could get a dimension mismatch. I suspect that examples like this are rare in practice.

    A type constructor which is a Monad:

    []
    

    About Arrows:

    Asking where an Arrow lies on this hierarchy is like asking what kind of shape “red” is. Note the kind mismatch:

    Functor :: * -> *
    Applicative :: * -> *
    Monad :: * -> *
    

    but,

    Arrow :: * -> * -> *
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here in this video at 11th minute, while explaining about strange structure (compared to
A good while ago, I read an article by the creator of viemu ,
Recently while I was explaining the basic difference between pointers and references(in context of
Someone somewhere has had to solve this problem. I can find many a great
I am a developer and I am facing an issue while managing table which
I am working through the Programming Clojure book. While explaining alter and the STM,
I remember reading a great document a while back explaining the rationale for Git
I am having two problems while working in Lisp and I can't find any
I searched for a while on this topic and found some results too, which
I am explaining my scenario, i have a function which print 1 to 10000

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.