You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.
module Wut exports (..)
type Result(a, e) =
| Ok(a)
| Err(e)
map_result = fn (result: Result(a, e), f: (a) -> b): Result(b, e) ->
match result with
| Ok(a) -> Ok(f(a))
| Err(err) -> Err(err)
end
type Decoder(input, output) = Decoder((input) -> Result(output, Unit))
type alias StringDecoder(output) = Decoder(String, output)
-- This does two strange things:
-- * an incorrect type error
-- * warns about a redundant match pattern (maybe the root cause)
-- Both of which go away when you don't use the `StringDecoder` alias...
huh = fn (Decoder(decode): StringDecoder(a)): StringDecoder(Array(a)) ->
Decoder(fn (s) -> map_result(decode(s), fn (a) -> [a]))
wut = fn (Decoder(decode): Decoder(String, a)): Decoder(String, Array(a)) ->
Decoder(fn (s) -> map_result(decode(s), fn (a) -> [a]))
:scratches-head:
The text was updated successfully, but these errors were encountered:
:scratches-head:
The text was updated successfully, but these errors were encountered: