
25 Jan
2023
25 Jan
'23
8:06 p.m.
On Thu, 26 Jan 2023, Kazu Yamamoto (山本和彦) via Haskell-Cafe wrote:
The recent GHC added incomplete-uni-patterns to the -Wall option. So, we have a waning with the following code:
let [addr,port] = args
To avoid this, I changed the code to:
let addr = head args port = head $ tail args
Both are partial and should be avoided. I have a nestable NonEmpty that lets you use NonEmpty (NonEmpty []) for a list of at least two elements: https://hackage.haskell.org/package/non-empty-0.3.3/docs/Data-NonEmpty.html
In my opinion, this seems Lisp rather than Haskell.
Also, I need to avoid:
let Just val = mval
Rahter, I use:
let val = fromJust mval
This is annoying to me.
If you are sure that the Maybe is always Just, why use Maybe in the first place?