exercism / exercism/haskell

Satellite requires unnatural edge case checking

Aperta
#1,259 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Haskell
Stelle
529
Fork
201
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.