exercism / exercism/haskell

Satellite requires unnatural edge case checking

Open
#1,259 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
529
Forks
201
PR merge metrics
No merged PRs in 30d

Description

I feel like the first test of "satellite"
```
Case { description = "Empty tree"
, preorder = ""
, inorder = ""
, expected = Nothing
}
```
should be
```
Case { description = "Empty tree"
, preorder = ""
, inorder = ""
, expected = Just Leaf
}
```
Reasons:
1) the `BinaryTree` type already supports empty trees, so expecting `Nothing` is redundant
2) empty list is a valid inorder and preorder traversal for an empty tree, so expecting `Nothing` is misleading, as it indicates that an error has occured.
3) A recursive implementation of `treeFromTraversals` naturally outputs `Just Leaf` on empty inputs, thus, satisfying the tests requires an awkward wrapper function.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.