Hey! You might want to check this 
out http://package.elm-lang.org/packages/evancz/url-parser/latest. It's the 
closest thing to the String -> a type signature you are after. I'm 
personally not familiar with Haskell's read, so I can't speak much on that. 

On Monday, January 16, 2017 at 3:56:43 PM UTC-8, Josh Szmajda wrote:
>
> Hey folks!
>
> This is in reference to https://github.com/elm-lang/core/issues/805
>
> I'm looking for a function to convert a String to an internal symbol 
> (signature `String -> a`). Previously this was in `Text.fromString` but 
> apparently that has been removed.
>
> The use-case I have in mind is this router:
>
> ```
> locationUpdate : Navigation.Location -> App.Msg
> locationUpdate location =
>   case (String.dropLeft 2 location.hash) of
>
>     "ViewDocList" -> ViewState ViewDocList
>
>     "ViewDocument" -> ViewState ViewDocument
>
>     _ -> App.NoOp
>
>     -- Would rather code this as:
>     -- case Text.fromString msg of
>     --   Just value -> ViewState value
>     --   Nothing    -> App.NoOp
> ```
>
> In Haskell this would be `read`:
>
> ```
> Prelude> read "4.5" :: Float
> 4.5
> Prelude> :t read "4.5" :: Float
> read "4.5" :: Float :: Float
> ```
>
> Any ideas on when this might come back?
>
> Thanks!
> -Josh
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to