Last active
March 24, 2020 01:48
-
-
Save dullbananas/d7736a5af07979f1a6d66fc2c27fbae1 to your computer and use it in GitHub Desktop.
How to make Elm ports slightly more simple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Normal ports | |
port outgoingString : String -> Cmd msg | |
port incomingString : (String -> msg) -> Sub msg | |
-- Ports with type aliases | |
type alias OutgoingPort a = | |
a -> Cmd msg | |
type alias IncomingPort a = | |
(a -> msg) -> Sub msg | |
port outgoingString : OutgoingPort String | |
port incomingString : IncomingPort String | |
-- btw this has not been tested yet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment