Skip to content

Instantly share code, notes, and snippets.

@dullbananas
Last active March 24, 2020 01:48
Show Gist options
  • Save dullbananas/d7736a5af07979f1a6d66fc2c27fbae1 to your computer and use it in GitHub Desktop.
Save dullbananas/d7736a5af07979f1a6d66fc2c27fbae1 to your computer and use it in GitHub Desktop.
How to make Elm ports slightly more simple
-- 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