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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:43:29+00:00 2026-06-09T23:43:29+00:00

I am currently trying to do 20 Intermediate Haskell Exercises . I was able

  • 0

I am currently trying to do 20 Intermediate Haskell Exercises. I was able to get done with the 1st 3 exercises (but this is because furry == fmap and Learn You a Haskell has those implementations already). I am currently stuck on the instance that says:

instance Fluffy (EitherLeft t) where                                        
  furry = error "todo"

I am not really understanding what to do. In Learn You Haskell they have a newtype variable called Pair which takes in a tuple. They then can do pattern matching as such:

  fmap f (Pair (x,y)) = Pair (f x, y)

I was thinking maybe you could do something similar in my situation:

  furry f (EitherLeft (Either a b)) = EitherLeft (Either (f a) b)

But, that doesn’t work:

Not in scope: data constructor `Either'

I was thinking maybe I would import Data.Either because there might be some import things he has I don’t have. But that didn’t matter.

I also tried to get just this to work:

  furry f (EitherLeft a b) = error "todo"

But that doesn’t work either:

Constructor `EitherLeft' should have 1 argument, but has been given 2

I couldn’t get this to work either:

  furry f (Right x) = (Right f x)
  furry f (Left x) = Left x

Which gave the error:

Couldn't match expected type `EitherLeft t a'
            with actual type `Either t0 t1'

I have only been able to get:

  furry f (EitherLeft t) = error "todo"

to work. But I have no idea what to do with t.

I don’t necessarily want an answer. I just need a hint as to what to do because I’m reading and I can sort of, understand the examples but I can’t really get my head around to coding this stuff right on my own.

Thanks Dan, this is what I came up with for my solution:

instance Fluffy (EitherLeft t) where                     
  furry f (EitherLeft (Left x)) = EitherLeft $ Left  (f x)                   
  furry f (EitherLeft (Right x)) = EitherLeft $ Right x
  • 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-09T23:43:31+00:00Added an answer on June 9, 2026 at 11:43 pm

    The problem you are having is that the Either datatype does not have a data constructor called Either, basically the Either type looks like this

    data Either a b = Left a
                    | Right b
    

    So a value can have the type Either a b , but there is no value like Either "one" 1 or something like that, but instead Left "one", or Right 1.

    So in the case of EitherLeft, similarly its values will look like EitherLeft (Left a) or EitherLeft (Right b), and need to be pattern matched against as such.

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

Sidebar

Related Questions

I'm currently trying to get the most popular productID from my MSSQL Database. This
Im currently trying to learn some stuff about encryption, it's algorithms and how it
I'm currently trying this: using DocumentFormat.OpenXml.Packaging; using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(fileNameDocx as string, true))
I am currently trying to get the code coverage report for a PHP application
Currently trying to get onepage checkout working properly on an installation of Magento 1.6.0.0.
Im currently trying to get a new Kinect for Windows to run on OSX
Im currently trying to get all input elements from a DIV. $([required]).each(function() { });
Currently trying at add ajax to a site, after much reading I discovered that
Im currently trying to downlaod a audio track from a WCF, i need some
I am currently trying to write some code that will accept some FTP details,

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.