Skip to content

Instantly share code, notes, and snippets.

@osnr
Created April 15, 2014 11:05
Show Gist options
  • Save osnr/10723233 to your computer and use it in GitHub Desktop.
Save osnr/10723233 to your computer and use it in GitHub Desktop.
import Http
import Graphics.Input as I
import Graphics.Input.Field as F
inp : I.Input F.Content
inp = I.input F.noContent
urlify : String -> String
urlify t = "http://en.wikipedia.org/w/api.php?action=query&format=json&callback=?&titles=" ++ t ++ "&prop=revisions&rvprop=content"
page : Signal String -> Signal Element
page s = asText <~ (Http.sendJsonp <| lift urlify s)
main = lift2 above
(F.field F.defaultStyle inp.handle id "Page_title" <~ inp.signal)
(page (lift .string inp.signal))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment