Practical Haskell: A Real-World Guide to Functional Programming, 3rd Edition Alejandro Serrano Mena instant download
Practical Haskell: A Real-World Guide to Functional Programming, 3rd Edition Alejandro Serrano Mena instant download
https://ebookmeta.com/product/practical-haskell-a-real-world-
guide-to-functional-programming-3rd-edition-alejandro-serrano-
mena/
https://ebookmeta.com/product/effective-haskell-solving-real-
world-problems-with-strongly-typed-functional-programming-1st-
edition-rebecca-skinner/
https://ebookmeta.com/product/learn-physics-with-functional-
programming-a-hands-on-guide-to-exploring-physics-with-
haskell-1st-edition-scott-n-walck/
https://ebookmeta.com/product/real-world-ocaml-functional-
programming-for-the-masses-2nd-edition-anil-madhavapeddy/
https://ebookmeta.com/product/project-management-1st-edition-dk/
Trump’s America and International Relations in the
Indo-Pacific: Theoretical Analysis of Changes &
Continuities (Contributions to International Relations)
Tsuneo Akaha (Editor)
https://ebookmeta.com/product/trumps-america-and-international-
relations-in-the-indo-pacific-theoretical-analysis-of-changes-
continuities-contributions-to-international-relations-tsuneo-
akaha-editor/
https://ebookmeta.com/product/patterns-of-religious-commitment-
volume-1-american-piety-the-nature-of-religious-commitment/
https://ebookmeta.com/product/death-in-the-diaspora-british-and-
irish-gravestones-1st-edition-nicholas-evans-editor-angela-
mccarthy-editor/
https://ebookmeta.com/product/cambridge-igcse-o-level-complete-
physics-student-book-fourth-edition-stephen-pople/
https://ebookmeta.com/product/daughter-of-the-pirate-king-1st-
edition-levenseller-tricia/
Practical Haskell
A Real-World Guide to Functional
Programming
Third Edition
Introduction������������������������������������������������������������������������������������������������������������xxi
v
Table of Contents
Understanding Modules��������������������������������������������������������������������������������������������������������� 29
Cabal and Stack��������������������������������������������������������������������������������������������������������������������� 31
Defining Simple Functions���������������������������������������������������������������������������������������������������������� 32
Creating a Simple Function��������������������������������������������������������������������������������������������������� 32
Specifying the Function’s Type���������������������������������������������������������������������������������������������� 33
Developing a Robust Example����������������������������������������������������������������������������������������������� 33
Returning More Than One Value�������������������������������������������������������������������������������������������� 36
Working with Data Types������������������������������������������������������������������������������������������������������������� 38
Pattern Matching������������������������������������������������������������������������������������������������������������������� 43
Records��������������������������������������������������������������������������������������������������������������������������������� 54
Summary������������������������������������������������������������������������������������������������������������������������������������ 60
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
ix
Table of Contents
x
Table of Contents
xi
Table of Contents
xii
Table of Contents
xiii
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 577
xiv
About the Author
Alejandro Serrano Mena has more than a decade of
experience as a developer, trainer, and researcher in
functional programming, with an emphasis in Haskell and
related languages. He holds a PhD from Utrecht University
on the topic of error message customization in compilers.
Most of his work relates to tools helping programmers
to write more correct and reliable code, including static
analyzers and formal verification tools.
Alejandro is an active member of the community. He
maintains several open source projects, has written three books on different levels about
Haskell, and co-hosts a podcast on the same topics. He also gives talks and conducts
workshops at different conferences, spreading the love and the techniques of functional
programming.
xv
Another Random Scribd Document
with Unrelated Content
Virginia looked, pleadingly, in the face of Kate, and wondered to see
her brown cheek pale and her great eyes fill with tears.
“Oh, you do not know what you ask!” cried Kate, in agony, “and I
can not tell you.”
Virginia heard the strange words in amazement.
“Can you not be my sister?”
“No, no, it is impossible,” Kate murmured, sadly.
“Impossible, why?”
“Because—”
The wild war-whoop of the Shawnees, pealing forth on the still
morning air, and ringing in the ears of the three like a signal of
doom, cut short Kate’s words.
Then the door yielded to a heavy blow, and a score of dark forms
rushed into the room.
CHAPTER XXXIX.
THE TOTEM OF THE RENEGADE.
A single glance at the dark forms that filled the doorway, and the
hearts of the three sunk within them.
They were prisoners to the Shawnees!
At the head of the painted warriors was Simon Girty, the renegade.
Girty’s eyes lit up with fiend-like joy as he gazed upon his captives.
“A keen she-devil you are, to snatch the game out of my hands; but
did you think that you could escape from me so easily?” he cried,
addressing Kate.
The warm blood flushed the face of the “Queen,” as she listened to
the insolent words of the white Indian.
“You are in my power; no human force can snatch you from me,” he
continued, exultingly. “A nice trick it was, to pretend to watch my
prisoner for me, and then aid her to escape in the darkness! But I
tracked you, though, cunning as you are. A fit daughter of a worthy
father; but, maybe, my turn will come now, Chiefs,” and he turned to
the warriors that filled the doorway, “which of you want this dainty
brown maid for a squaw? I’ll give her to one, for her fate is in my
hands now.”
All the fire in Kate’s nature shone in the lurid flash of her dark eyes.
“Take care, Simon Girty!” she cried, in anger. “If my father is not
man enough to protect me from insult, my rifle will.”
“Your father is dead, girl, or mighty near it,” returned Girty,
scornfully. “When I discovered the trick that you and he played upon
me, I sunk my tomahawk in his skull and let out his fool’s brains.”
“My father slain!” cried Kate, in horror.
“I reckon that there isn’t much life left in him by this time. He dared
to cross my will, the hound that he was, and I struck him to his
death,” said Girty, fiercely.
Kate felt that she was indeed at Girty’s mercy.
“And for you, my pretty white bird,” and the renegade turned to
Virginia as he spoke, “did you fancy that you could escape the fate
that I marked out for you? You will learn in time that my blows
seldom fail.”
“Oh, have you no mercy!” cried Virginia, in despair.
“What mercy did your father have when his lashes tore my back,
long years ago?” demanded the renegade, fiercely. “The mercy that
he showed to me I will show to him and his. I’ll tear his heart as his
punishment tore my flesh. When he learns your shameful fate, then,
and not till then, will the debt of vengeance be canceled. How he will
curse his evil fortune when he learns that his dainty daughter—the
apple of his eye, the pride of his old age—is the victim of the
renegade, Simon Girty!” and then he laughed loud and long.
“Accursed villain!” cried Winthrop, suddenly, unable to restrain his
fury; and quick as thought, he flung himself upon the renegade,
regardless of the overpowering number of foes that surrounded him.
With a single heavy blow between the eyes, he beat the renegade,
like a log, to the ground; but ere he could pursue his advantage
further, the Shawnee warriors dashed themselves upon him. Ten to
one, Winthrop was speedily overcome and securely bound.
The renegade rose to his feet, his eyes gleaming like a demon’s, and
a livid mark upon his face, where the knuckles of the young man
had bruised the skin.
“You shall pay dearly for that blow!” Girty cried, between his
clenched teeth. “You shall die at the torture-stake, a thousand
deaths all in one. The tomahawks of the Indians will cut your flesh
from your bones, even while you are a living man. You will cry aloud
for death to come to end your misery. And in your last moments the
thought will come that this fair girl—whom I guess you love—will be
wholly in my power—a helpless victim to my caprices. And as you
die in lingering torments, I will stand by your side and taunt you till
death releases you from my power.”
Words can but feebly describe the waked wrath of the renegade.
Winthrop faced him undauntedly.
“It suits your cowardly nature better to taunt a helpless prisoner
than to face a free man. I do love this girl, and the thought that she
is helpless in your power, demon that you are, gives me greater pain
than can all the fire and torture of the red devils with whom you
claim kindred. I am your captive. Look well to me; see that I do not
escape from you, for it would cost you your life if I should ever again
regain my freedom.”
Every muscle in the young man’s form swelled with indignation as he
spoke.
“When you cease to be my captive, death will claim you,” replied
Girty, grimly.
Kate looked around her. She saw no avenue of escape. She felt that
they were hopelessly lost.
“Come,” said Girty; “but first bind the wrists of these two squaws.”
The Indians obeyed his order.
“Now for your future home, the Shawnee village!” Girty cried, in
triumph.
The Indians and their prisoners, led by the renegade, passed
through the door of the cabin and stood within the little clearing that
surrounded the house.
Then forth from the timber came the Shawnee brave, Noc-a-tah.
He came straight to Girty.
“Well, chief, what is it?” asked the renegade. He conjectured from
the Indian’s manner that he was the bearer of some important
tidings.
“Your white brother has gone to the land of shadows—he sends this
totem to you.” Then the Indian drew from his pocket the piece of
birch bark whereon Kendrick had, with his blood and the pointed
twig, traced his dying words.
“Dead, eh?” said Girty, with a sneer. “A totem to me? What can it
be?”
Then the renegade took the piece of bark and endeavored to read
the lines.
Rudely were the letters formed, for Dave Kendrick could boast of but
little scholarship.
The renegade puzzled over the writing. Suddenly the meaning
flashed upon him. A gleam of fierce joy swept over his dark face.
“By all the fiends, this is double vengeance!” he cried in glee. “Chief,
in Chillicothe, thou shalt have the best scalping-knife that I own, in
payment for this precious totem.”
Noc-a-tah gravely nodded, and then disappeared within the thicket.
Girty turned to where the two girls stood, side by side.
The maidens wondered at his searching look.
“What a blind idiot I have been not to have noticed it before,” he
muttered, “and yet I remember, now, the face of the girl did look
familiar to me when I first saw her in the Shawnee village. To think
of my vengeance slipping through my fingers, and then, after long
years, being put again within my hands! There’s fate in this. And
Kendrick, too—he thought, by this dying declaration, to strike a blow
at me, even from the grave. He thought both the girls were safely
out of my hands. He little dreamed when I should read his ‘totem’—
as the savage termed it—that the two he referred to in it would be
helpless prisoners in my power. Could he have foreseen that, he
would have cut off his hand rather than divulge to me what he has
here written.”
Then the renegade laughed long and silently. His captives wondered
at his glee.
“You risked your life to save this girl; why did you do it?” he asked of
Kate, suddenly.
“Because she was helpless in the power of a cruel monster. My heart
told me to save her, even at the risk of my own life,” replied Kate,
promptly.
“And you, girl—are you not grateful to this maiden, who has tried so
hard to save you from me?” he said to Virginia.
“Yes, I am very grateful,” replied the girl, wondering at the question.
“Their hearts don’t tell ’em,” muttered the renegade. “The old adage
is a fable; blood is not thicker than water. Virginia, years ago I stole
your eldest sister, and left her to perish in the forest. This was the
first blow that I aimed at your father. Now see how strangely fate
sometimes disposes of things in this world. The child that I left to
die did not die, but was saved, and has grown to womanhood, and I
all the time thinking her dead. Girls, can’t you guess the truth? The
man that saved and reared the child was Dave Kendrick, the
renegade!”
The truth flashed upon the maidens in an instant.
“Sister!” cried Virginia, warmly; but the bonds upon their wrists
forbade further greeting.
“Yes, she is your sister. Kate, you are Augusta Treveling, the eldest
daughter of the old General,” said Girty, and a triumphant smile was
upon his face.
The smile made the two girls tremble.
“The hound that I gave to the worms never told the secret to me,
but, dying, he wrote it here on this piece of bark. This was his
vengeance,” and Girty laughed loudly. “It will be pleasant news to
the old General, your father, when he hears that both of his
daughters are living, and both are in my power.”
“Oh, man, have you no mercy?” plead Kate.
“Mercy?” cried the renegade, fiercely. “Ask it of the hungry wolf, the
angry bear, or the red savage, when his knife is raised to slay!
Expect mercy from all these, but expect none from the man whose
skin is white but whose heart is red. Come; in Chillicothe you will
meet your fate.”
A broad sheet of flame, springing from the woods to the north of the
little clearing, followed by the sharp report of a dozen rifles,
answered the boast of the renegade.
Of the ten savages who had followed Girty’s lead, seven lay
wounded or dead upon the earth.
From the timber came the ringing shout of the borderers, and a
score or more of the settlers, headed by General Treveling and stout
Jake Jackson, came with a rush into the clearing.
Girty, though badly wounded, and the unhurt savages, had fled at
once.
Jake and fully one-half of the borderers followed in pursuit.
The captives were speedily released from their bonds.
“Let me give thanks to that Heaven that in its bounty has seen fit to
give me back both my daughters to gladden the last years of an old
man’s life!” cried Treveling, in joy, as he folded his children to his
heart.
The timely arrival of the settlers was easily explained. Noc-a-tah, the
Shawnee chief, had faithfully kept the promise made to the dying
renegade, and had first sought Point Pleasant and given the “totem”
into the hands of the General.
The father’s joy on learning that his eldest daughter lived can easily
be imagined.
Jackson, who had seen the Indian depart, instantly counseled that
he should be tracked, that the whereabouts of the rest of the
Shawnees might be discovered.
The advice of the stout Indian-fighter had been followed, and the
happy result was, the rescuing of Girty’s victims.
Well might the aged father lift up his voice in joy.
CHAPTER XL.
THE WHITE DOG AND THE WOLF DEMON.
The two scouts looked upon the blood-stained cap with horror.
“The blood is fresh, too!” cried Boone. “Lark must have been killed
by this monster immediately after we missed him in the thicket.”
“It looks like it,” said Kenton, solemnly.
“Let us look for the body.”
But as they were about to commence their search, the sound of
footfalls approaching through the wood fell upon their ears.
“Hush!” cried Boone, grasping Kenton by the arm as he spoke; “do
you hear that?”
“It’s some one coming through the wood.”
“Yes, and hyer all comers are enemies and not friends; let’s to
cover,” said Boone.
A second after the two woodmen were snugly concealed in the
bushes.
The steps came nearer and nearer, and then, through the gloom of
the night, the watching eyes of the two saw the fearful form of the
terrible Wolf Demon approaching.
He walked not now with stealthy tread but his step was heavy and
slow. His head was bent down, low upon his breast. Slowly he came
on, passed by the ambush of the scouts, then crossed the moonlit
glade and entered the thicket on the opposite side. He was bending
his steps in the direction of the Indian village of Chillicothe.
Hardly had the awful form disappeared within the gloom of the
forest when Boone grasped Kenton nervously by the shoulder.
“Kenton,” he said, in a hoarse whisper, “let us not search for the
body of our friend, whom this awful thing has killed, but revenge his
death.”
“I’m with you, tooth and nail,” replied Kenton, firmly.
“Let’s follow this thing then.”
“Go it,” said Kenton, tersely.
Then the woodmen, with caution, followed in the path of the Wolf
Demon.
The Demon proceeded direct to the Indian village.
The woodmen were guided in their course by the noise of his
footsteps.
Suddenly the sound of the steps ceased.
Boone and Kenton crept forward with increased caution.
A few rods on and they found themselves on the edge of the timber,
and in full view of the Indian village.
The Wolf Demon was not to be seen!
The scouts then guessed the reason why the sounds of the Wolf
Demon’s tread had ceased so suddenly. The Demon had entered the
village in search of prey.
The path that the two had followed entered the village close by the
river’s bank.
It was plain to Boone that the Wolf Demon had selected the same
road into the Indian village that he, Boone, had taken in escaping
from it.
“We’re treed,” said Boone, as they reached the edge of the timber
and perceived that they could proceed no further in their pursuit
without danger of their being discovered by the red-skins.
“A full stop hyer,” said Boone, thoughtfully.
“Yes, it ’pears like it,” Kenton replied.
“S’pose we wait hyer for the varmint? Ef he went into the village this
way, it’s likely that he’ll come out the same path.”
“That’s true.”
“Yes, as preachin’. I don’t know as we kin damage the critter,” said
Boone, thoughtfully. “We hain’t got no silver bullets, and I’ve heerd
say that it takes a silver bullet to stop a spook.”
“We kin try,” said Kenton, decidedly.
“Right again, by hookey! Give us your paw, Sim; we’ll stick by each
other in this.”
“Yes, to death,” answered Kenton.
A firm grip of hands sealed the compact.
Then the two again concealed themselves in the bushes.
They watched and they waited.
THE END.
Beadle’s Dime Library.
1 A Hard Crowd. By Philip S. Warne 10c.
2 The Dare-Devil. By Col. P. Ingraham 10c.
3 Kit Carson, Jr. By Buckskin Sam 10c.
4 The Kidnapper. By Philip S. Warne 10c.
5 The Fire Fiends. By A. P. Morris, Jr. 10c.
6 Wildcat Bob. By Edward L. Wheeler 10c.
7 Death-Notch, the Destroyer. Oll Coomes 10c.
8 The Headless Horseman. By Mayne Reid 10c.
9 Handy Andy. By Samuel Lover 10c.
10 Vidocq, the French Police Spy. Written by himself 10c.
11 Midshipman Easy. By Capt. Maryatt 10c.
12 The Death-Shot. By Capt. Mayne Reid 10c.
13 Pathaway; or, Nick Whiffles, the Old Trapper of the
Northwest. By Dr. J. H. Robinson 10c.
14 Thayendanegea, the Scourge. By Ned Buntline 10c.
15 The Tiger Slayer. By Gustave Aimard 10c.
16 The White Wizard. By Ned Buntline 10c.
17 Nightshade. By Dr. J. H. Robinson 10c.
18 The Sea Bandit. By Ned Buntline 10c.
19 Red Cedar. By Gustave Aimard 10c.
20 The Bandit at Bay. By Gustave Aimard 10c.
21 The Trapper’s Daughter. By Gustave Aimard 10c.
22 Whitelaw; or, Nattie of the Lake Shore. By Dr. J. H.
Robinson 10c.
23 The Red Warrior. By Ned Buntline 10c.
24 The Prairie Flower. By Gustave Aimard 10c.
25 The Gold Guide. By Francis Johnson 10c.
26 The Death Track. By Francis Johnson 10c.
27 The Spotter Detective. By Albert W. Aiken 10c.
28 Three-Fingered Jack, The Road-Agent of the Rockies. By
Joseph E. Badger, Jr. 10c.