Skip to content
This repository has been archived by the owner on Aug 23, 2018. It is now read-only.

Commit

Permalink
Fix elm#837, get rid of KeyCode alias, talk about Unicode instead
Browse files Browse the repository at this point in the history
  • Loading branch information
evancz committed Mar 25, 2017
1 parent c5a2c92 commit c81539f
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/Char.elm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Char exposing
( isUpper, isLower, isDigit, isOctDigit, isHexDigit
, toUpper, toLower, toLocaleUpper, toLocaleLower
, KeyCode, toCode, fromCode
, toCode, fromCode
)

{-| Functions for working with characters. Character literals are enclosed in
Expand All @@ -13,9 +13,8 @@ module Char exposing
# Conversion
@docs toUpper, toLower, toLocaleUpper, toLocaleLower
# Key Codes
@docs KeyCode, toCode, fromCode
# Unicode Code Points
@docs toCode, fromCode
-}

import Native.Char
Expand Down Expand Up @@ -83,21 +82,19 @@ toLocaleLower =
Native.Char.toLocaleLower


{-| Keyboard keys can be represented as integers. These are called *key codes*.
You can use [`toCode`](#toCode) and [`fromCode`](#fromCode) to convert between
key codes and characters.
-}
type alias KeyCode = Int

{-| Convert to the corresponding Unicode [code point][cp].
{-| Convert to key code.
[cp]: https://en.wikipedia.org/wiki/Code_point
-}
toCode : Char -> KeyCode
toCode : Char -> Int
toCode =
Native.Char.toCode


{-| Convert from key code. -}
fromCode : KeyCode -> Char
{-| Convert a Unicode [code point][cp] to a character.
[cp]: https://en.wikipedia.org/wiki/Code_point
-}
fromCode : Int -> Char
fromCode =
Native.Char.fromCode

0 comments on commit c81539f

Please sign in to comment.