Haskell error when creating List comprehension The 2019 Stack Overflow Developer Survey Results Are InBeginners Guide to Haskell?Getting started with HaskellWhat is Haskell actually useful for?What is “lifting” in Haskell?list comprehension vs. lambda + filterLarge-scale design in Haskell?Speed comparison with Project Euler: C vs Python vs Erlang vs HaskellHaskell: Lists, Arrays, Vectors, SequencesHaskell list comprehension errorUtilizing map in haskell on function arguments
Is it possible for absolutely everyone to attain enlightenment?
Compute the product of 3 dictionaries and concatenate keys and values
Computing the expectation of the number of balls in a box
What is the most efficient way to store a numeric range?
How can I define good in a religion that claims no moral authority?
What information about me do stores get via my credit card?
Why isn't the circumferential light around the M87 black hole's event horizon symmetric?
Why didn't the Event Horizon Telescope team mention Sagittarius A*?
I am an eight letter word. What am I?
How to translate "being like"?
Are spiders unable to hurt humans, especially very small spiders?
Worn-tile Scrabble
What do these terms in Caesar's Gallic wars mean?
How do I free up internal storage if I don't have any apps downloaded?
How much of the clove should I use when using big garlic heads?
APIPA and LAN Broadcast Domain
Keeping a retro style to sci-fi spaceships?
Pokemon Turn Based battle (Python)
writing variables above the numbers in tikz picture
Is it okay to consider publishing in my first year of PhD?
Why doesn't shell automatically fix "useless use of cat"?
Why are there uneven bright areas in this photo of black hole?
Old scifi movie from the 50s or 60s with men in solid red uniforms who interrogate a spy from the past
Does HR tell a hiring manager about salary negotiations?
Haskell error when creating List comprehension
The 2019 Stack Overflow Developer Survey Results Are InBeginners Guide to Haskell?Getting started with HaskellWhat is Haskell actually useful for?What is “lifting” in Haskell?list comprehension vs. lambda + filterLarge-scale design in Haskell?Speed comparison with Project Euler: C vs Python vs Erlang vs HaskellHaskell: Lists, Arrays, Vectors, SequencesHaskell list comprehension errorUtilizing map in haskell on function arguments
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm following this guide to create a list comprehension.
data Value = Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten|J|Q|K|A
deriving (Eq, Ord, Enum)
data Suite = Hearts | Spades | Diamonds | Clubs
deriving (Eq, Ord, Enum)
type Card = (Value, Suite)
pack :: [Card]
pack = [(Value,Suite) | Value <- [Two .. A], Suite <- [Hearts .. Clubs]]
When I create the pack function it always throws
error: Data constructor not in scope: Suite :: Suite
haskell functional-programming
add a comment |
I'm following this guide to create a list comprehension.
data Value = Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten|J|Q|K|A
deriving (Eq, Ord, Enum)
data Suite = Hearts | Spades | Diamonds | Clubs
deriving (Eq, Ord, Enum)
type Card = (Value, Suite)
pack :: [Card]
pack = [(Value,Suite) | Value <- [Two .. A], Suite <- [Hearts .. Clubs]]
When I create the pack function it always throws
error: Data constructor not in scope: Suite :: Suite
haskell functional-programming
4
Variable names must begin with a lower case letter.
– Thomas M. DuBuisson
Mar 22 at 4:39
4
By the way, the word you're looking for is "suit". A suite is a set of rooms, a set of musical compositions, or probably since other things (none of them related to what you mean).
– dfeuer
Mar 22 at 4:46
add a comment |
I'm following this guide to create a list comprehension.
data Value = Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten|J|Q|K|A
deriving (Eq, Ord, Enum)
data Suite = Hearts | Spades | Diamonds | Clubs
deriving (Eq, Ord, Enum)
type Card = (Value, Suite)
pack :: [Card]
pack = [(Value,Suite) | Value <- [Two .. A], Suite <- [Hearts .. Clubs]]
When I create the pack function it always throws
error: Data constructor not in scope: Suite :: Suite
haskell functional-programming
I'm following this guide to create a list comprehension.
data Value = Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten|J|Q|K|A
deriving (Eq, Ord, Enum)
data Suite = Hearts | Spades | Diamonds | Clubs
deriving (Eq, Ord, Enum)
type Card = (Value, Suite)
pack :: [Card]
pack = [(Value,Suite) | Value <- [Two .. A], Suite <- [Hearts .. Clubs]]
When I create the pack function it always throws
error: Data constructor not in scope: Suite :: Suite
haskell functional-programming
haskell functional-programming
edited Mar 22 at 21:49
Michael Litchard
1,99621542
1,99621542
asked Mar 22 at 4:33
Gusti AryaGusti Arya
765923
765923
4
Variable names must begin with a lower case letter.
– Thomas M. DuBuisson
Mar 22 at 4:39
4
By the way, the word you're looking for is "suit". A suite is a set of rooms, a set of musical compositions, or probably since other things (none of them related to what you mean).
– dfeuer
Mar 22 at 4:46
add a comment |
4
Variable names must begin with a lower case letter.
– Thomas M. DuBuisson
Mar 22 at 4:39
4
By the way, the word you're looking for is "suit". A suite is a set of rooms, a set of musical compositions, or probably since other things (none of them related to what you mean).
– dfeuer
Mar 22 at 4:46
4
4
Variable names must begin with a lower case letter.
– Thomas M. DuBuisson
Mar 22 at 4:39
Variable names must begin with a lower case letter.
– Thomas M. DuBuisson
Mar 22 at 4:39
4
4
By the way, the word you're looking for is "suit". A suite is a set of rooms, a set of musical compositions, or probably since other things (none of them related to what you mean).
– dfeuer
Mar 22 at 4:46
By the way, the word you're looking for is "suit". A suite is a set of rooms, a set of musical compositions, or probably since other things (none of them related to what you mean).
– dfeuer
Mar 22 at 4:46
add a comment |
1 Answer
1
active
oldest
votes
pack :: [Card]
pack = [(Value,Suite) | Value <- [Two .. A], Suite <- [Hearts .. Clubs]]
The left hand side of <- should be a variable (or a pattern w/ variables in it). In Haskell those start with a lowercase letter. Try this:
pack :: [Card]
pack = [(value,suite) | value <- [Two .. A], suite <- [Hearts .. Clubs]]
1
It's correct to say that the left-hand side of<-is a (refutable) pattern; a variable by itself is a valid pattern.
– chepner
Mar 22 at 11:27
You should look up the definition of the word "or" instead of trying to be pedantic. >:(
– Colin Barrett
Mar 24 at 16:36
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292970%2fhaskell-error-when-creating-list-comprehension%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
pack :: [Card]
pack = [(Value,Suite) | Value <- [Two .. A], Suite <- [Hearts .. Clubs]]
The left hand side of <- should be a variable (or a pattern w/ variables in it). In Haskell those start with a lowercase letter. Try this:
pack :: [Card]
pack = [(value,suite) | value <- [Two .. A], suite <- [Hearts .. Clubs]]
1
It's correct to say that the left-hand side of<-is a (refutable) pattern; a variable by itself is a valid pattern.
– chepner
Mar 22 at 11:27
You should look up the definition of the word "or" instead of trying to be pedantic. >:(
– Colin Barrett
Mar 24 at 16:36
add a comment |
pack :: [Card]
pack = [(Value,Suite) | Value <- [Two .. A], Suite <- [Hearts .. Clubs]]
The left hand side of <- should be a variable (or a pattern w/ variables in it). In Haskell those start with a lowercase letter. Try this:
pack :: [Card]
pack = [(value,suite) | value <- [Two .. A], suite <- [Hearts .. Clubs]]
1
It's correct to say that the left-hand side of<-is a (refutable) pattern; a variable by itself is a valid pattern.
– chepner
Mar 22 at 11:27
You should look up the definition of the word "or" instead of trying to be pedantic. >:(
– Colin Barrett
Mar 24 at 16:36
add a comment |
pack :: [Card]
pack = [(Value,Suite) | Value <- [Two .. A], Suite <- [Hearts .. Clubs]]
The left hand side of <- should be a variable (or a pattern w/ variables in it). In Haskell those start with a lowercase letter. Try this:
pack :: [Card]
pack = [(value,suite) | value <- [Two .. A], suite <- [Hearts .. Clubs]]
pack :: [Card]
pack = [(Value,Suite) | Value <- [Two .. A], Suite <- [Hearts .. Clubs]]
The left hand side of <- should be a variable (or a pattern w/ variables in it). In Haskell those start with a lowercase letter. Try this:
pack :: [Card]
pack = [(value,suite) | value <- [Two .. A], suite <- [Hearts .. Clubs]]
edited Mar 22 at 11:14
answered Mar 22 at 4:46
Colin BarrettColin Barrett
4,28612132
4,28612132
1
It's correct to say that the left-hand side of<-is a (refutable) pattern; a variable by itself is a valid pattern.
– chepner
Mar 22 at 11:27
You should look up the definition of the word "or" instead of trying to be pedantic. >:(
– Colin Barrett
Mar 24 at 16:36
add a comment |
1
It's correct to say that the left-hand side of<-is a (refutable) pattern; a variable by itself is a valid pattern.
– chepner
Mar 22 at 11:27
You should look up the definition of the word "or" instead of trying to be pedantic. >:(
– Colin Barrett
Mar 24 at 16:36
1
1
It's correct to say that the left-hand side of
<- is a (refutable) pattern; a variable by itself is a valid pattern.– chepner
Mar 22 at 11:27
It's correct to say that the left-hand side of
<- is a (refutable) pattern; a variable by itself is a valid pattern.– chepner
Mar 22 at 11:27
You should look up the definition of the word "or" instead of trying to be pedantic. >:(
– Colin Barrett
Mar 24 at 16:36
You should look up the definition of the word "or" instead of trying to be pedantic. >:(
– Colin Barrett
Mar 24 at 16:36
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55292970%2fhaskell-error-when-creating-list-comprehension%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Variable names must begin with a lower case letter.
– Thomas M. DuBuisson
Mar 22 at 4:39
4
By the way, the word you're looking for is "suit". A suite is a set of rooms, a set of musical compositions, or probably since other things (none of them related to what you mean).
– dfeuer
Mar 22 at 4:46