entities
listlengths
1
2.22k
max_stars_repo_path
stringlengths
6
98
max_stars_repo_name
stringlengths
9
55
max_stars_count
int64
0
8.27k
content
stringlengths
93
965k
id
stringlengths
2
5
new_content
stringlengths
85
964k
modified
bool
1 class
references
stringlengths
98
970k
language
stringclasses
1 value
[ { "context": " [ class Styles.heading ]\n [ text \"Jasper Whitehouse\" ]\n , h2 [ class Styles.subheading ]\n ", "end": 614, "score": 0.9985148907, "start": 597, "tag": "NAME", "value": "Jasper Whitehouse" } ]
src/Header/CircleAvatarTitleSubtitle/View.elm
paulfioravanti/tachyons-components
0
module Header.CircleAvatarTitleSubtitle.View exposing (view) import Header.CircleAvatarTitleSubtitle.Styles as Styles import Html exposing (Html, div, h1, h2, header, img, text) import Html.Attributes exposing (alt, attribute, class, src) view : Html msg view = div [ attribute "data-name" "component" ] [ header [ class Styles.header ] [ img [ class Styles.image , src "http://tachyons.io/img/logo.jpg" , alt "avatar" ] [] , h1 [ class Styles.heading ] [ text "Jasper Whitehouse" ] , h2 [ class Styles.subheading ] [ text "Los Angeles" ] ] ]
44646
module Header.CircleAvatarTitleSubtitle.View exposing (view) import Header.CircleAvatarTitleSubtitle.Styles as Styles import Html exposing (Html, div, h1, h2, header, img, text) import Html.Attributes exposing (alt, attribute, class, src) view : Html msg view = div [ attribute "data-name" "component" ] [ header [ class Styles.header ] [ img [ class Styles.image , src "http://tachyons.io/img/logo.jpg" , alt "avatar" ] [] , h1 [ class Styles.heading ] [ text "<NAME>" ] , h2 [ class Styles.subheading ] [ text "Los Angeles" ] ] ]
true
module Header.CircleAvatarTitleSubtitle.View exposing (view) import Header.CircleAvatarTitleSubtitle.Styles as Styles import Html exposing (Html, div, h1, h2, header, img, text) import Html.Attributes exposing (alt, attribute, class, src) view : Html msg view = div [ attribute "data-name" "component" ] [ header [ class Styles.header ] [ img [ class Styles.image , src "http://tachyons.io/img/logo.jpg" , alt "avatar" ] [] , h1 [ class Styles.heading ] [ text "PI:NAME:<NAME>END_PI" ] , h2 [ class Styles.subheading ] [ text "Los Angeles" ] ] ]
elm
[ { "context": " |> Events.simulate (Events.Input \"admin\")\n |> Events.expectEve", "end": 8073, "score": 0.6214190125, "start": 8068, "tag": "USERNAME", "value": "admin" }, { "context": "s.expectEvent (UpdateLoginFormMsg (EnterUserName \"admin\"))\n , test \"Should update the password", "end": 8167, "score": 0.9486482143, "start": 8162, "tag": "USERNAME", "value": "admin" }, { "context": " : LoginForm\ndefaultLoginForm =\n { username = \"username\"\n , password = \"password\"\n , loginIncorrect", "end": 21782, "score": 0.9984008074, "start": 21774, "tag": "USERNAME", "value": "username" }, { "context": "m =\n { username = \"username\"\n , password = \"password\"\n , loginIncorrect = False\n }\n\n\ndefaultAbou", "end": 21810, "score": 0.9991353154, "start": 21802, "tag": "PASSWORD", "value": "password" } ]
webui/tests/Views/HeaderSuite.elm
sohaibiftikhar/cluster-broccoli
0
module Views.HeaderSuite exposing (tests) import Model exposing (TabState(Instances)) import Views.Header as Header import Models.Resources.AboutInfo as AboutInfo exposing (AboutInfo) import Models.Resources.Role as Role exposing (Role(Administrator)) import Models.Ui.LoginForm as LoginForm exposing (LoginForm) import Updates.Messages exposing (UpdateLoginFormMsg(EnterUserName, EnterPassword, LoginAttempt, LogoutAttempt)) import Messages exposing (AnyMsg(UpdateLoginFormMsg, TemplateFilter, InstanceFilter)) import Test exposing (test, describe, Test) import Test.Html.Query as Query import Test.Html.Selector as Selector import Test.Html.Events as Events tests : Test tests = describe "Header View" [ describe "Login Form" [ test "Should render username in input field" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-username" ] |> Query.has [ Selector.attribute "value" defaultLoginForm.username ] , test "Should render password in input field" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-password" ] |> Query.has [ Selector.attribute "value" defaultLoginForm.password ] , test "Should look normal if the login is correct" <| \() -> let maybeAboutInfo = Nothing loginForm = { defaultLoginForm | loginIncorrect = False } maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-form" ] |> Query.has [ Selector.classes [ "form-inline", "ml-auto" ] ] , test "Should shake if the login is correct" <| \() -> let maybeAboutInfo = Nothing loginForm = { defaultLoginForm | loginIncorrect = True } maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-form" ] |> Query.has [ Selector.classes [ "form-inline", "ml-auto", "animated", "shake" ] ] , test "Should render if auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-login-form" ] , test "Should not render if auth is not required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-login-form" ] , test "Should not render if we don't know if auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Nothing templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-login-form" ] , test "Should update the username when the user name input field changes" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-username" ] |> Events.simulate (Events.Input "admin") |> Events.expectEvent (UpdateLoginFormMsg (EnterUserName "admin")) , test "Should update the password when the password input field changes" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-password" ] |> Events.simulate (Events.Input "secret") |> Events.expectEvent (UpdateLoginFormMsg (EnterPassword "secret")) , test "Should attempt to login with the entered credentials on form sumbission" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-form" ] |> Events.simulate Events.Submit |> Events.expectEvent (UpdateLoginFormMsg (LoginAttempt defaultLoginForm.username defaultLoginForm.password)) ] , describe "Logout Form" [ test "Should render if auth is enabled but not required (which means you are logged in)" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-logout-form" ] , test "Should not render if auth is disabled and not required" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo False loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-logout-form" ] , test "Should not render if it is unknown whether auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-logout-form" ] , test "Should attempt to login with the entered credentials on form sumbission" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-logout-form" ] |> Events.simulate Events.Submit |> Events.expectEvent (UpdateLoginFormMsg LogoutAttempt) ] , describe "Template Filter" [ test "Should update the template filter when the user types values" <| \() -> let maybeAboutInfo = Just defaultAboutInfo loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" input = "zeppelin" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-template-filter" ] |> Events.simulate (Events.Input input) |> Events.expectEvent (TemplateFilter input) , test "Should not render if it is unknown whether auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-template-filter" ] , test "Should render if it when logged in" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-template-filter" ] , test "Should render if no login is required" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo False loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-template-filter" ] ] , describe "Instance Filter" [ test "Should update the instance filter when the user types values" <| \() -> let maybeAboutInfo = Just defaultAboutInfo loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" input = "zeppelin" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-instance-filter" ] |> Events.simulate (Events.Input input) |> Events.expectEvent (InstanceFilter input) , test "Should not render if it is unknown whether auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-instance-filter" ] , test "Should render if it when logged in" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-instance-filter" ] , test "Should render if no login is required" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo False loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-instance-filter" ] ] ] defaultLoginForm : LoginForm defaultLoginForm = { username = "username" , password = "password" , loginIncorrect = False } defaultAboutInfo : AboutInfo defaultAboutInfo = { projectInfo = { name = "pname" , version = "pversion" } , scalaInfo = { version = "sversion" } , sbtInfo = { version = "sbtversion" } , authInfo = { enabled = True , userInfo = { name = "user" , role = Administrator , instanceRegex = ".*" } } , services = { clusterManagerInfo = { connected = True } , serviceDiscoveryInfo = { connected = True } } } withAuthEnabled aboutInfo authEnabled = { enabled = authEnabled , userInfo = aboutInfo.authInfo.userInfo } |> AboutInfo.asAuthInfoOf aboutInfo
14181
module Views.HeaderSuite exposing (tests) import Model exposing (TabState(Instances)) import Views.Header as Header import Models.Resources.AboutInfo as AboutInfo exposing (AboutInfo) import Models.Resources.Role as Role exposing (Role(Administrator)) import Models.Ui.LoginForm as LoginForm exposing (LoginForm) import Updates.Messages exposing (UpdateLoginFormMsg(EnterUserName, EnterPassword, LoginAttempt, LogoutAttempt)) import Messages exposing (AnyMsg(UpdateLoginFormMsg, TemplateFilter, InstanceFilter)) import Test exposing (test, describe, Test) import Test.Html.Query as Query import Test.Html.Selector as Selector import Test.Html.Events as Events tests : Test tests = describe "Header View" [ describe "Login Form" [ test "Should render username in input field" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-username" ] |> Query.has [ Selector.attribute "value" defaultLoginForm.username ] , test "Should render password in input field" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-password" ] |> Query.has [ Selector.attribute "value" defaultLoginForm.password ] , test "Should look normal if the login is correct" <| \() -> let maybeAboutInfo = Nothing loginForm = { defaultLoginForm | loginIncorrect = False } maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-form" ] |> Query.has [ Selector.classes [ "form-inline", "ml-auto" ] ] , test "Should shake if the login is correct" <| \() -> let maybeAboutInfo = Nothing loginForm = { defaultLoginForm | loginIncorrect = True } maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-form" ] |> Query.has [ Selector.classes [ "form-inline", "ml-auto", "animated", "shake" ] ] , test "Should render if auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-login-form" ] , test "Should not render if auth is not required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-login-form" ] , test "Should not render if we don't know if auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Nothing templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-login-form" ] , test "Should update the username when the user name input field changes" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-username" ] |> Events.simulate (Events.Input "admin") |> Events.expectEvent (UpdateLoginFormMsg (EnterUserName "admin")) , test "Should update the password when the password input field changes" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-password" ] |> Events.simulate (Events.Input "secret") |> Events.expectEvent (UpdateLoginFormMsg (EnterPassword "secret")) , test "Should attempt to login with the entered credentials on form sumbission" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-form" ] |> Events.simulate Events.Submit |> Events.expectEvent (UpdateLoginFormMsg (LoginAttempt defaultLoginForm.username defaultLoginForm.password)) ] , describe "Logout Form" [ test "Should render if auth is enabled but not required (which means you are logged in)" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-logout-form" ] , test "Should not render if auth is disabled and not required" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo False loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-logout-form" ] , test "Should not render if it is unknown whether auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-logout-form" ] , test "Should attempt to login with the entered credentials on form sumbission" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-logout-form" ] |> Events.simulate Events.Submit |> Events.expectEvent (UpdateLoginFormMsg LogoutAttempt) ] , describe "Template Filter" [ test "Should update the template filter when the user types values" <| \() -> let maybeAboutInfo = Just defaultAboutInfo loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" input = "zeppelin" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-template-filter" ] |> Events.simulate (Events.Input input) |> Events.expectEvent (TemplateFilter input) , test "Should not render if it is unknown whether auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-template-filter" ] , test "Should render if it when logged in" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-template-filter" ] , test "Should render if no login is required" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo False loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-template-filter" ] ] , describe "Instance Filter" [ test "Should update the instance filter when the user types values" <| \() -> let maybeAboutInfo = Just defaultAboutInfo loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" input = "zeppelin" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-instance-filter" ] |> Events.simulate (Events.Input input) |> Events.expectEvent (InstanceFilter input) , test "Should not render if it is unknown whether auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-instance-filter" ] , test "Should render if it when logged in" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-instance-filter" ] , test "Should render if no login is required" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo False loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-instance-filter" ] ] ] defaultLoginForm : LoginForm defaultLoginForm = { username = "username" , password = "<PASSWORD>" , loginIncorrect = False } defaultAboutInfo : AboutInfo defaultAboutInfo = { projectInfo = { name = "pname" , version = "pversion" } , scalaInfo = { version = "sversion" } , sbtInfo = { version = "sbtversion" } , authInfo = { enabled = True , userInfo = { name = "user" , role = Administrator , instanceRegex = ".*" } } , services = { clusterManagerInfo = { connected = True } , serviceDiscoveryInfo = { connected = True } } } withAuthEnabled aboutInfo authEnabled = { enabled = authEnabled , userInfo = aboutInfo.authInfo.userInfo } |> AboutInfo.asAuthInfoOf aboutInfo
true
module Views.HeaderSuite exposing (tests) import Model exposing (TabState(Instances)) import Views.Header as Header import Models.Resources.AboutInfo as AboutInfo exposing (AboutInfo) import Models.Resources.Role as Role exposing (Role(Administrator)) import Models.Ui.LoginForm as LoginForm exposing (LoginForm) import Updates.Messages exposing (UpdateLoginFormMsg(EnterUserName, EnterPassword, LoginAttempt, LogoutAttempt)) import Messages exposing (AnyMsg(UpdateLoginFormMsg, TemplateFilter, InstanceFilter)) import Test exposing (test, describe, Test) import Test.Html.Query as Query import Test.Html.Selector as Selector import Test.Html.Events as Events tests : Test tests = describe "Header View" [ describe "Login Form" [ test "Should render username in input field" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-username" ] |> Query.has [ Selector.attribute "value" defaultLoginForm.username ] , test "Should render password in input field" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-password" ] |> Query.has [ Selector.attribute "value" defaultLoginForm.password ] , test "Should look normal if the login is correct" <| \() -> let maybeAboutInfo = Nothing loginForm = { defaultLoginForm | loginIncorrect = False } maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-form" ] |> Query.has [ Selector.classes [ "form-inline", "ml-auto" ] ] , test "Should shake if the login is correct" <| \() -> let maybeAboutInfo = Nothing loginForm = { defaultLoginForm | loginIncorrect = True } maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-form" ] |> Query.has [ Selector.classes [ "form-inline", "ml-auto", "animated", "shake" ] ] , test "Should render if auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-login-form" ] , test "Should not render if auth is not required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-login-form" ] , test "Should not render if we don't know if auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Nothing templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-login-form" ] , test "Should update the username when the user name input field changes" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-username" ] |> Events.simulate (Events.Input "admin") |> Events.expectEvent (UpdateLoginFormMsg (EnterUserName "admin")) , test "Should update the password when the password input field changes" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-password" ] |> Events.simulate (Events.Input "secret") |> Events.expectEvent (UpdateLoginFormMsg (EnterPassword "secret")) , test "Should attempt to login with the entered credentials on form sumbission" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just True templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-login-form" ] |> Events.simulate Events.Submit |> Events.expectEvent (UpdateLoginFormMsg (LoginAttempt defaultLoginForm.username defaultLoginForm.password)) ] , describe "Logout Form" [ test "Should render if auth is enabled but not required (which means you are logged in)" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-logout-form" ] , test "Should not render if auth is disabled and not required" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo False loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-logout-form" ] , test "Should not render if it is unknown whether auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-logout-form" ] , test "Should attempt to login with the entered credentials on form sumbission" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-logout-form" ] |> Events.simulate Events.Submit |> Events.expectEvent (UpdateLoginFormMsg LogoutAttempt) ] , describe "Template Filter" [ test "Should update the template filter when the user types values" <| \() -> let maybeAboutInfo = Just defaultAboutInfo loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" input = "zeppelin" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-template-filter" ] |> Events.simulate (Events.Input input) |> Events.expectEvent (TemplateFilter input) , test "Should not render if it is unknown whether auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-template-filter" ] , test "Should render if it when logged in" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-template-filter" ] , test "Should render if no login is required" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo False loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-template-filter" ] ] , describe "Instance Filter" [ test "Should update the instance filter when the user types values" <| \() -> let maybeAboutInfo = Just defaultAboutInfo loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" input = "zeppelin" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.find [ Selector.id "header-instance-filter" ] |> Events.simulate (Events.Input input) |> Events.expectEvent (InstanceFilter input) , test "Should not render if it is unknown whether auth is required" <| \() -> let maybeAboutInfo = Nothing loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.hasNot [ Selector.id "header-instance-filter" ] , test "Should render if it when logged in" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo True loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-instance-filter" ] , test "Should render if no login is required" <| \() -> let maybeAboutInfo = Just <| withAuthEnabled defaultAboutInfo False loginForm = defaultLoginForm maybeAuthRequired = Just False templateFilter = "" instanceFilter = "" nodeFilter = "" in Header.view maybeAboutInfo loginForm maybeAuthRequired templateFilter instanceFilter nodeFilter Instances |> Query.fromHtml |> Query.has [ Selector.id "header-instance-filter" ] ] ] defaultLoginForm : LoginForm defaultLoginForm = { username = "username" , password = "PI:PASSWORD:<PASSWORD>END_PI" , loginIncorrect = False } defaultAboutInfo : AboutInfo defaultAboutInfo = { projectInfo = { name = "pname" , version = "pversion" } , scalaInfo = { version = "sversion" } , sbtInfo = { version = "sbtversion" } , authInfo = { enabled = True , userInfo = { name = "user" , role = Administrator , instanceRegex = ".*" } } , services = { clusterManagerInfo = { connected = True } , serviceDiscoveryInfo = { connected = True } } } withAuthEnabled aboutInfo authEnabled = { enabled = authEnabled , userInfo = aboutInfo.authInfo.userInfo } |> AboutInfo.asAuthInfoOf aboutInfo
elm
[ { "context": " author {\n id\n firstName\n lastName\n role\n ", "end": 772, "score": 0.9947481751, "start": 763, "tag": "NAME", "value": "firstName" }, { "context": " id\n firstName\n lastName\n role\n }\n grou", "end": 795, "score": 0.9792002439, "start": 787, "tag": "NAME", "value": "lastName" } ]
assets/elm/src/Subscription/PostCreated.elm
davecremins/level
0
module Subscription.PostCreated exposing (..) import Json.Decode as Decode import Json.Decode.Pipeline as Pipeline import Json.Encode as Encode import Data.Post exposing (Post, postDecoder) import Socket exposing (Payload) type alias Params = { id : String } type alias Data = { post : Post } clientId : String -> String clientId id = "post_created_" ++ id payload : String -> Payload payload id = Payload (clientId id) query (Just <| variables <| Params id) query : String query = """ subscription PostCreated( $id: ID! ) { postCreated(groupId: $id) { post { id body bodyHtml postedAt author { id firstName lastName role } groups { id name } } } } """ variables : Params -> Encode.Value variables params = Encode.object [ ( "id", Encode.string params.id ) ] decoder : Decode.Decoder Data decoder = Decode.at [ "data", "postCreated" ] <| (Pipeline.decode Data |> Pipeline.custom (Decode.at [ "post" ] postDecoder) )
6485
module Subscription.PostCreated exposing (..) import Json.Decode as Decode import Json.Decode.Pipeline as Pipeline import Json.Encode as Encode import Data.Post exposing (Post, postDecoder) import Socket exposing (Payload) type alias Params = { id : String } type alias Data = { post : Post } clientId : String -> String clientId id = "post_created_" ++ id payload : String -> Payload payload id = Payload (clientId id) query (Just <| variables <| Params id) query : String query = """ subscription PostCreated( $id: ID! ) { postCreated(groupId: $id) { post { id body bodyHtml postedAt author { id <NAME> <NAME> role } groups { id name } } } } """ variables : Params -> Encode.Value variables params = Encode.object [ ( "id", Encode.string params.id ) ] decoder : Decode.Decoder Data decoder = Decode.at [ "data", "postCreated" ] <| (Pipeline.decode Data |> Pipeline.custom (Decode.at [ "post" ] postDecoder) )
true
module Subscription.PostCreated exposing (..) import Json.Decode as Decode import Json.Decode.Pipeline as Pipeline import Json.Encode as Encode import Data.Post exposing (Post, postDecoder) import Socket exposing (Payload) type alias Params = { id : String } type alias Data = { post : Post } clientId : String -> String clientId id = "post_created_" ++ id payload : String -> Payload payload id = Payload (clientId id) query (Just <| variables <| Params id) query : String query = """ subscription PostCreated( $id: ID! ) { postCreated(groupId: $id) { post { id body bodyHtml postedAt author { id PI:NAME:<NAME>END_PI PI:NAME:<NAME>END_PI role } groups { id name } } } } """ variables : Params -> Encode.Value variables params = Encode.object [ ( "id", Encode.string params.id ) ] decoder : Decode.Decoder Data decoder = Decode.at [ "data", "postCreated" ] <| (Pipeline.decode Data |> Pipeline.custom (Decode.at [ "post" ] postDecoder) )
elm
[ { "context": "me =\n { content = \"hodor\"\n , sentBy = { name = \"Hodor\" }\n , sentOn = time\n }\n\n\n\n-- update\n\n\nupdate : ", "end": 1046, "score": 0.999008894, "start": 1041, "tag": "NAME", "value": "Hodor" }, { "context": "- init\n\n\nmockUser : Person\nmockUser =\n { name = \"Matias\" }\n\n\ninit : Model\ninit =\n { input = \"\"\n , histo", "end": 4643, "score": 0.9994412661, "start": 4637, "tag": "NAME", "value": "Matias" } ]
Main.elm
klemola/elm-chat
0
module Main (..) where import Html exposing (..) import Html.Events exposing (..) import Html.Attributes exposing (..) import Time exposing (Time) import Date exposing (fromTime) import Signal exposing (Signal) import String type Action = SendMessage | Input String | NoOp type StateChange = UserAction ( Time, Action ) | Response ( Time, Bool ) type alias Person = { name : String } type alias Message = { content : String , sentBy : Person , sentOn : Time } type alias History = List Message type alias Model = { input : String , history : History , user : Person } -- helpers msgTime : Time -> String msgTime timestamp = let date = fromTime timestamp pad n = String.padLeft 2 '0' (toString n) in (pad (Date.hour date)) ++ ":" ++ (pad (Date.minute date)) msgColor : Message -> String msgColor msg = if msg.sentBy == mockUser then "beige" else "pink" mockResponse : Time -> Message mockResponse time = { content = "hodor" , sentBy = { name = "Hodor" } , sentOn = time } -- update update : StateChange -> Model -> Model update change state = case change of UserAction ( time, action ) -> handleUserAction time action state Response ( time, bool ) -> { state | history = (mockResponse time) :: state.history } handleUserAction : Time -> Action -> Model -> Model handleUserAction time action state = case action of SendMessage -> { state | history = (userMessage state time) :: state.history , input = "" } Input text -> { state | input = text } NoOp -> state userMessage : Model -> Time -> Message userMessage state time = { content = state.input , sentBy = state.user , sentOn = time } -- view header : String -> Html header heading = div [ style [ ( "padding", "0.5rem" ) , ( "text-align", "center" ) ] ] [ h2 [] [ text heading ] ] messages : Model -> Html messages model = div [ style [ ( "padding-bottom", "3rem" ) , ( "overflow", "scroll" ) ] ] [ ul [ style [ ( "list-style", "none" ) , ( "padding", "0" ) , ( "margin", "0" ) ] ] (model.history |> List.reverse |> List.map message ) ] message : Message -> Html message msg = li [ style [ ( "background", msgColor msg ) , ( "padding", "0.3rem 0.5rem" ) , ( "display", "flex" ) ] ] [ msgContent msg , msgSentOn msg.sentOn ] msgContent : Message -> Html msgContent msg = span [ style [ ( "flex", "5" ) ] ] [ text (msg.sentBy.name ++ ": " ++ msg.content) ] msgSentOn : Time -> Html msgSentOn sentOn = span [ style [ ( "flex", "1" ) , ( "text-align", "right" ) ] ] [ text (msgTime sentOn) ] inputArea : Model -> Html inputArea model = div [ style [ ( "display", "flex" ) , ( "position", "fixed" ) , ( "bottom", "0" ) , ( "width", "100%" ) , ( "border-top", "0.2rem solid #e5e5e5" ) , ( "height", "2.8rem" ) ] ] [ messageInput model.input , sendButton ] messageInput : String -> Html messageInput currentInput = input [ style [ ( "flex", "5" ) , ( "border", "none" ) , ( "background", "#eee" ) , ( "padding", "0.5rem" ) , ( "font-size", "1.2rem" ) ] , placeholder "Your message..." , autofocus True , value currentInput , on "input" targetValue (\str -> Signal.message actions.address (Input str)) ] [] sendButton : Html sendButton = button [ style [ ( "flex", "1" ) , ( "background", "lightblue" ) , ( "color", "#345B80" ) , ( "border", "none" ) , ( "font-size", "1.2rem" ) , ( "padding", "0.5rem" ) ] , (onClick actions.address SendMessage) ] [ text ">" ] mockMessageControl : Html mockMessageControl = button [ style [ ( "width", "100%" ) , ( "background", "lightgreen" ) , ( "border", "none" ) , ( "font-size", "1rem" ) , ( "padding", "0.5rem" ) ] , (onClick serverResponses.address True) ] [ text "Mock response" ] view : String -> Model -> Html view heading model = div [] [ header heading , mockMessageControl , messages model , inputArea model ] html : Model -> Html html model = view "Convo" model -- init mockUser : Person mockUser = { name = "Matias" } init : Model init = { input = "" , history = [] , user = mockUser } actions : Signal.Mailbox Action actions = Signal.mailbox NoOp serverResponses : Signal.Mailbox Bool serverResponses = Signal.mailbox True inputSignal : Signal StateChange inputSignal = Signal.merge (Signal.map UserAction (Time.timestamp actions.signal)) (Signal.map Response (Time.timestamp serverResponses.signal)) model : Signal Model model = Signal.foldp update init inputSignal main : Signal Html main = Signal.map html model
15946
module Main (..) where import Html exposing (..) import Html.Events exposing (..) import Html.Attributes exposing (..) import Time exposing (Time) import Date exposing (fromTime) import Signal exposing (Signal) import String type Action = SendMessage | Input String | NoOp type StateChange = UserAction ( Time, Action ) | Response ( Time, Bool ) type alias Person = { name : String } type alias Message = { content : String , sentBy : Person , sentOn : Time } type alias History = List Message type alias Model = { input : String , history : History , user : Person } -- helpers msgTime : Time -> String msgTime timestamp = let date = fromTime timestamp pad n = String.padLeft 2 '0' (toString n) in (pad (Date.hour date)) ++ ":" ++ (pad (Date.minute date)) msgColor : Message -> String msgColor msg = if msg.sentBy == mockUser then "beige" else "pink" mockResponse : Time -> Message mockResponse time = { content = "hodor" , sentBy = { name = "<NAME>" } , sentOn = time } -- update update : StateChange -> Model -> Model update change state = case change of UserAction ( time, action ) -> handleUserAction time action state Response ( time, bool ) -> { state | history = (mockResponse time) :: state.history } handleUserAction : Time -> Action -> Model -> Model handleUserAction time action state = case action of SendMessage -> { state | history = (userMessage state time) :: state.history , input = "" } Input text -> { state | input = text } NoOp -> state userMessage : Model -> Time -> Message userMessage state time = { content = state.input , sentBy = state.user , sentOn = time } -- view header : String -> Html header heading = div [ style [ ( "padding", "0.5rem" ) , ( "text-align", "center" ) ] ] [ h2 [] [ text heading ] ] messages : Model -> Html messages model = div [ style [ ( "padding-bottom", "3rem" ) , ( "overflow", "scroll" ) ] ] [ ul [ style [ ( "list-style", "none" ) , ( "padding", "0" ) , ( "margin", "0" ) ] ] (model.history |> List.reverse |> List.map message ) ] message : Message -> Html message msg = li [ style [ ( "background", msgColor msg ) , ( "padding", "0.3rem 0.5rem" ) , ( "display", "flex" ) ] ] [ msgContent msg , msgSentOn msg.sentOn ] msgContent : Message -> Html msgContent msg = span [ style [ ( "flex", "5" ) ] ] [ text (msg.sentBy.name ++ ": " ++ msg.content) ] msgSentOn : Time -> Html msgSentOn sentOn = span [ style [ ( "flex", "1" ) , ( "text-align", "right" ) ] ] [ text (msgTime sentOn) ] inputArea : Model -> Html inputArea model = div [ style [ ( "display", "flex" ) , ( "position", "fixed" ) , ( "bottom", "0" ) , ( "width", "100%" ) , ( "border-top", "0.2rem solid #e5e5e5" ) , ( "height", "2.8rem" ) ] ] [ messageInput model.input , sendButton ] messageInput : String -> Html messageInput currentInput = input [ style [ ( "flex", "5" ) , ( "border", "none" ) , ( "background", "#eee" ) , ( "padding", "0.5rem" ) , ( "font-size", "1.2rem" ) ] , placeholder "Your message..." , autofocus True , value currentInput , on "input" targetValue (\str -> Signal.message actions.address (Input str)) ] [] sendButton : Html sendButton = button [ style [ ( "flex", "1" ) , ( "background", "lightblue" ) , ( "color", "#345B80" ) , ( "border", "none" ) , ( "font-size", "1.2rem" ) , ( "padding", "0.5rem" ) ] , (onClick actions.address SendMessage) ] [ text ">" ] mockMessageControl : Html mockMessageControl = button [ style [ ( "width", "100%" ) , ( "background", "lightgreen" ) , ( "border", "none" ) , ( "font-size", "1rem" ) , ( "padding", "0.5rem" ) ] , (onClick serverResponses.address True) ] [ text "Mock response" ] view : String -> Model -> Html view heading model = div [] [ header heading , mockMessageControl , messages model , inputArea model ] html : Model -> Html html model = view "Convo" model -- init mockUser : Person mockUser = { name = "<NAME>" } init : Model init = { input = "" , history = [] , user = mockUser } actions : Signal.Mailbox Action actions = Signal.mailbox NoOp serverResponses : Signal.Mailbox Bool serverResponses = Signal.mailbox True inputSignal : Signal StateChange inputSignal = Signal.merge (Signal.map UserAction (Time.timestamp actions.signal)) (Signal.map Response (Time.timestamp serverResponses.signal)) model : Signal Model model = Signal.foldp update init inputSignal main : Signal Html main = Signal.map html model
true
module Main (..) where import Html exposing (..) import Html.Events exposing (..) import Html.Attributes exposing (..) import Time exposing (Time) import Date exposing (fromTime) import Signal exposing (Signal) import String type Action = SendMessage | Input String | NoOp type StateChange = UserAction ( Time, Action ) | Response ( Time, Bool ) type alias Person = { name : String } type alias Message = { content : String , sentBy : Person , sentOn : Time } type alias History = List Message type alias Model = { input : String , history : History , user : Person } -- helpers msgTime : Time -> String msgTime timestamp = let date = fromTime timestamp pad n = String.padLeft 2 '0' (toString n) in (pad (Date.hour date)) ++ ":" ++ (pad (Date.minute date)) msgColor : Message -> String msgColor msg = if msg.sentBy == mockUser then "beige" else "pink" mockResponse : Time -> Message mockResponse time = { content = "hodor" , sentBy = { name = "PI:NAME:<NAME>END_PI" } , sentOn = time } -- update update : StateChange -> Model -> Model update change state = case change of UserAction ( time, action ) -> handleUserAction time action state Response ( time, bool ) -> { state | history = (mockResponse time) :: state.history } handleUserAction : Time -> Action -> Model -> Model handleUserAction time action state = case action of SendMessage -> { state | history = (userMessage state time) :: state.history , input = "" } Input text -> { state | input = text } NoOp -> state userMessage : Model -> Time -> Message userMessage state time = { content = state.input , sentBy = state.user , sentOn = time } -- view header : String -> Html header heading = div [ style [ ( "padding", "0.5rem" ) , ( "text-align", "center" ) ] ] [ h2 [] [ text heading ] ] messages : Model -> Html messages model = div [ style [ ( "padding-bottom", "3rem" ) , ( "overflow", "scroll" ) ] ] [ ul [ style [ ( "list-style", "none" ) , ( "padding", "0" ) , ( "margin", "0" ) ] ] (model.history |> List.reverse |> List.map message ) ] message : Message -> Html message msg = li [ style [ ( "background", msgColor msg ) , ( "padding", "0.3rem 0.5rem" ) , ( "display", "flex" ) ] ] [ msgContent msg , msgSentOn msg.sentOn ] msgContent : Message -> Html msgContent msg = span [ style [ ( "flex", "5" ) ] ] [ text (msg.sentBy.name ++ ": " ++ msg.content) ] msgSentOn : Time -> Html msgSentOn sentOn = span [ style [ ( "flex", "1" ) , ( "text-align", "right" ) ] ] [ text (msgTime sentOn) ] inputArea : Model -> Html inputArea model = div [ style [ ( "display", "flex" ) , ( "position", "fixed" ) , ( "bottom", "0" ) , ( "width", "100%" ) , ( "border-top", "0.2rem solid #e5e5e5" ) , ( "height", "2.8rem" ) ] ] [ messageInput model.input , sendButton ] messageInput : String -> Html messageInput currentInput = input [ style [ ( "flex", "5" ) , ( "border", "none" ) , ( "background", "#eee" ) , ( "padding", "0.5rem" ) , ( "font-size", "1.2rem" ) ] , placeholder "Your message..." , autofocus True , value currentInput , on "input" targetValue (\str -> Signal.message actions.address (Input str)) ] [] sendButton : Html sendButton = button [ style [ ( "flex", "1" ) , ( "background", "lightblue" ) , ( "color", "#345B80" ) , ( "border", "none" ) , ( "font-size", "1.2rem" ) , ( "padding", "0.5rem" ) ] , (onClick actions.address SendMessage) ] [ text ">" ] mockMessageControl : Html mockMessageControl = button [ style [ ( "width", "100%" ) , ( "background", "lightgreen" ) , ( "border", "none" ) , ( "font-size", "1rem" ) , ( "padding", "0.5rem" ) ] , (onClick serverResponses.address True) ] [ text "Mock response" ] view : String -> Model -> Html view heading model = div [] [ header heading , mockMessageControl , messages model , inputArea model ] html : Model -> Html html model = view "Convo" model -- init mockUser : Person mockUser = { name = "PI:NAME:<NAME>END_PI" } init : Model init = { input = "" , history = [] , user = mockUser } actions : Signal.Mailbox Action actions = Signal.mailbox NoOp serverResponses : Signal.Mailbox Bool serverResponses = Signal.mailbox True inputSignal : Signal StateChange inputSignal = Signal.merge (Signal.map UserAction (Time.timestamp actions.signal)) (Signal.map Response (Time.timestamp serverResponses.signal)) model : Signal Model model = Signal.foldp update init inputSignal main : Signal Html main = Signal.map html model
elm
[ { "context": "s zeroDelta\n@docs toTicks\n\nCopyright (c) 2016-2018 Robin Luiten\n\n-}\n\nimport Date exposing (Date)\nimport Date.Extr", "end": 541, "score": 0.999854207, "start": 529, "tag": "NAME", "value": "Robin Luiten" } ]
src/Date/Extra/Period.elm
AdrianRibao/elm-date-extra
81
module Date.Extra.Period exposing ( DeltaRecord , Period(..) , add , diff , toTicks , zeroDelta ) {-| Period is a fixed length of time. It is an elapsed time concept, which does not include the concept of Years Months or Daylight saving variations. - Represents a fixed (and calendar-independent) length of time. Name of type concept copied from NodaTime. @docs add @docs diff @docs Period @docs DeltaRecord @docs zeroDelta @docs toTicks Copyright (c) 2016-2018 Robin Luiten -} import Date exposing (Date) import Date.Extra.Internal2 as Internal2 {-| A Period. Week is a convenience for users if they want to use it, it does just scale Day in functionality so is not strictly required. DELTARECORD values are multiplied addend on application. -} type Period = Millisecond | Second | Minute | Hour | Day | Week | Delta DeltaRecord {-| A multi granularity period delta. -} type alias DeltaRecord = { week : Int , day : Int , hour : Int , minute : Int , second : Int , millisecond : Int } {-| All zero delta. Useful as a starting point if you want to set a few fields only. -} zeroDelta : DeltaRecord zeroDelta = { week = 0 , day = 0 , hour = 0 , minute = 0 , second = 0 , millisecond = 0 } {-| Return tick counts for periods. Useful to get total ticks in a Delta. -} toTicks : Period -> Int toTicks period = case period of Millisecond -> Internal2.ticksAMillisecond Second -> Internal2.ticksASecond Minute -> Internal2.ticksAMinute Hour -> Internal2.ticksAnHour Day -> Internal2.ticksADay Week -> Internal2.ticksAWeek Delta delta -> (Internal2.ticksAMillisecond * delta.millisecond) + (Internal2.ticksASecond * delta.second) + (Internal2.ticksAMinute * delta.minute) + (Internal2.ticksAnHour * delta.hour) + (Internal2.ticksADay * delta.day) + (Internal2.ticksAWeek * delta.week) {-| Add Period count to date. -} add : Period -> Int -> Date -> Date add period = addTimeUnit (toTicks period) {-| Add time units. -} addTimeUnit : Int -> Int -> Date -> Date addTimeUnit unit addend date = date |> Internal2.toTime |> (+) (addend * unit) |> Internal2.fromTime {-| Return a Period representing date difference. date1 - date2. If you add the result of this function to date2 with addend of 1 will return date1. -} diff : Date -> Date -> DeltaRecord diff date1 date2 = let ticksDiff = Internal2.toTime date1 - Internal2.toTime date2 hourDiff = Date.hour date1 - Date.hour date2 minuteDiff = Date.minute date1 - Date.minute date2 secondDiff = Date.second date1 - Date.second date2 millisecondDiff = Date.millisecond date1 - Date.millisecond date2 ticksDayDiff = ticksDiff - (hourDiff * Internal2.ticksAnHour) - (minuteDiff * Internal2.ticksAMinute) - (secondDiff * Internal2.ticksASecond) - (millisecondDiff * Internal2.ticksAMillisecond) onlyDaysDiff = ticksDayDiff // Internal2.ticksADay ( weekDiff, dayDiff ) = if onlyDaysDiff < 0 then let absDayDiff = abs onlyDaysDiff in ( negate (absDayDiff // 7) , negate (absDayDiff % 7) ) else ( onlyDaysDiff // 7 , onlyDaysDiff % 7 ) in { week = weekDiff , day = dayDiff , hour = hourDiff , minute = minuteDiff , second = secondDiff , millisecond = millisecondDiff }
43562
module Date.Extra.Period exposing ( DeltaRecord , Period(..) , add , diff , toTicks , zeroDelta ) {-| Period is a fixed length of time. It is an elapsed time concept, which does not include the concept of Years Months or Daylight saving variations. - Represents a fixed (and calendar-independent) length of time. Name of type concept copied from NodaTime. @docs add @docs diff @docs Period @docs DeltaRecord @docs zeroDelta @docs toTicks Copyright (c) 2016-2018 <NAME> -} import Date exposing (Date) import Date.Extra.Internal2 as Internal2 {-| A Period. Week is a convenience for users if they want to use it, it does just scale Day in functionality so is not strictly required. DELTARECORD values are multiplied addend on application. -} type Period = Millisecond | Second | Minute | Hour | Day | Week | Delta DeltaRecord {-| A multi granularity period delta. -} type alias DeltaRecord = { week : Int , day : Int , hour : Int , minute : Int , second : Int , millisecond : Int } {-| All zero delta. Useful as a starting point if you want to set a few fields only. -} zeroDelta : DeltaRecord zeroDelta = { week = 0 , day = 0 , hour = 0 , minute = 0 , second = 0 , millisecond = 0 } {-| Return tick counts for periods. Useful to get total ticks in a Delta. -} toTicks : Period -> Int toTicks period = case period of Millisecond -> Internal2.ticksAMillisecond Second -> Internal2.ticksASecond Minute -> Internal2.ticksAMinute Hour -> Internal2.ticksAnHour Day -> Internal2.ticksADay Week -> Internal2.ticksAWeek Delta delta -> (Internal2.ticksAMillisecond * delta.millisecond) + (Internal2.ticksASecond * delta.second) + (Internal2.ticksAMinute * delta.minute) + (Internal2.ticksAnHour * delta.hour) + (Internal2.ticksADay * delta.day) + (Internal2.ticksAWeek * delta.week) {-| Add Period count to date. -} add : Period -> Int -> Date -> Date add period = addTimeUnit (toTicks period) {-| Add time units. -} addTimeUnit : Int -> Int -> Date -> Date addTimeUnit unit addend date = date |> Internal2.toTime |> (+) (addend * unit) |> Internal2.fromTime {-| Return a Period representing date difference. date1 - date2. If you add the result of this function to date2 with addend of 1 will return date1. -} diff : Date -> Date -> DeltaRecord diff date1 date2 = let ticksDiff = Internal2.toTime date1 - Internal2.toTime date2 hourDiff = Date.hour date1 - Date.hour date2 minuteDiff = Date.minute date1 - Date.minute date2 secondDiff = Date.second date1 - Date.second date2 millisecondDiff = Date.millisecond date1 - Date.millisecond date2 ticksDayDiff = ticksDiff - (hourDiff * Internal2.ticksAnHour) - (minuteDiff * Internal2.ticksAMinute) - (secondDiff * Internal2.ticksASecond) - (millisecondDiff * Internal2.ticksAMillisecond) onlyDaysDiff = ticksDayDiff // Internal2.ticksADay ( weekDiff, dayDiff ) = if onlyDaysDiff < 0 then let absDayDiff = abs onlyDaysDiff in ( negate (absDayDiff // 7) , negate (absDayDiff % 7) ) else ( onlyDaysDiff // 7 , onlyDaysDiff % 7 ) in { week = weekDiff , day = dayDiff , hour = hourDiff , minute = minuteDiff , second = secondDiff , millisecond = millisecondDiff }
true
module Date.Extra.Period exposing ( DeltaRecord , Period(..) , add , diff , toTicks , zeroDelta ) {-| Period is a fixed length of time. It is an elapsed time concept, which does not include the concept of Years Months or Daylight saving variations. - Represents a fixed (and calendar-independent) length of time. Name of type concept copied from NodaTime. @docs add @docs diff @docs Period @docs DeltaRecord @docs zeroDelta @docs toTicks Copyright (c) 2016-2018 PI:NAME:<NAME>END_PI -} import Date exposing (Date) import Date.Extra.Internal2 as Internal2 {-| A Period. Week is a convenience for users if they want to use it, it does just scale Day in functionality so is not strictly required. DELTARECORD values are multiplied addend on application. -} type Period = Millisecond | Second | Minute | Hour | Day | Week | Delta DeltaRecord {-| A multi granularity period delta. -} type alias DeltaRecord = { week : Int , day : Int , hour : Int , minute : Int , second : Int , millisecond : Int } {-| All zero delta. Useful as a starting point if you want to set a few fields only. -} zeroDelta : DeltaRecord zeroDelta = { week = 0 , day = 0 , hour = 0 , minute = 0 , second = 0 , millisecond = 0 } {-| Return tick counts for periods. Useful to get total ticks in a Delta. -} toTicks : Period -> Int toTicks period = case period of Millisecond -> Internal2.ticksAMillisecond Second -> Internal2.ticksASecond Minute -> Internal2.ticksAMinute Hour -> Internal2.ticksAnHour Day -> Internal2.ticksADay Week -> Internal2.ticksAWeek Delta delta -> (Internal2.ticksAMillisecond * delta.millisecond) + (Internal2.ticksASecond * delta.second) + (Internal2.ticksAMinute * delta.minute) + (Internal2.ticksAnHour * delta.hour) + (Internal2.ticksADay * delta.day) + (Internal2.ticksAWeek * delta.week) {-| Add Period count to date. -} add : Period -> Int -> Date -> Date add period = addTimeUnit (toTicks period) {-| Add time units. -} addTimeUnit : Int -> Int -> Date -> Date addTimeUnit unit addend date = date |> Internal2.toTime |> (+) (addend * unit) |> Internal2.fromTime {-| Return a Period representing date difference. date1 - date2. If you add the result of this function to date2 with addend of 1 will return date1. -} diff : Date -> Date -> DeltaRecord diff date1 date2 = let ticksDiff = Internal2.toTime date1 - Internal2.toTime date2 hourDiff = Date.hour date1 - Date.hour date2 minuteDiff = Date.minute date1 - Date.minute date2 secondDiff = Date.second date1 - Date.second date2 millisecondDiff = Date.millisecond date1 - Date.millisecond date2 ticksDayDiff = ticksDiff - (hourDiff * Internal2.ticksAnHour) - (minuteDiff * Internal2.ticksAMinute) - (secondDiff * Internal2.ticksASecond) - (millisecondDiff * Internal2.ticksAMillisecond) onlyDaysDiff = ticksDayDiff // Internal2.ticksADay ( weekDiff, dayDiff ) = if onlyDaysDiff < 0 then let absDayDiff = abs onlyDaysDiff in ( negate (absDayDiff // 7) , negate (absDayDiff % 7) ) else ( onlyDaysDiff // 7 , onlyDaysDiff % 7 ) in { week = weekDiff , day = dayDiff , hour = hourDiff , minute = minuteDiff , second = secondDiff , millisecond = millisecondDiff }
elm
[ { "context": "la\"\n , album = \"Umbrella\"\n , artists = [ \"Ember Island\" ]\n , url = Just \"https://open.spotify.", "end": 1837, "score": 0.5679204464, "start": 1834, "tag": "NAME", "value": "ber" } ]
tests/Spotify/TestData.elm
Drako/SpotifyBackup
2
module Spotify.TestData exposing (..) import Spotify.Payloads exposing (Image, Paging, Playlist, Track) imageJson : String imageJson = "{\"url\":\"<image-url>\", \"width\": 64, \"height\": 64}" imageObject : Image imageObject = { url = "<image-url>", width = Just 64, height = Just 64 } imageWithoutSizeJson : String imageWithoutSizeJson = "{\"url\":\"<image-url>\"}" imageWithoutSizeObject : Image imageWithoutSizeObject = { imageObject | width = Nothing, height = Nothing } playlistObject : Playlist playlistObject = { href = "<playlist-webapi-link>" , url = "<some-url>" , id = "<some-id>" , images = [ imageObject ] , name = "example" , isPublic = False , tracks = { href = "<tracks-webapi-link>", total = 1 } , owner = { displayName = Nothing, id = "<some-id>", url = "<some-url>" } } playlistJson : String playlistJson = "{\"href\": \"<playlist-webapi-link>\"," ++ "\"external_urls\": {\"spotify\": \"<some-url>\"}," ++ "\"id\": \"<some-id>\", \"images\": [" ++ imageJson ++ "], \"name\": \"example\", \"public\": false, \"tracks\": {" ++ "\"href\": \"<tracks-webapi-link>\", \"total\": 1" ++ "}, \"owner\": {" ++ "\"display_name\": null, \"id\": \"<some-id>\", \"external_urls\": {\"spotify\": \"<some-url>\"}" ++ "}}" trackJson : String trackJson = "{\"track\":{" ++ "\"name\": \"Umbrella\", \"album\": {\"name\": \"Umbrella\"}," ++ "\"artists\": [{\"name\": \"Ember Island\"}]," ++ "\"external_urls\": {\"spotify\": \"https://open.spotify.com/track/2FX5HPP1FNNuLlt2UU9os7\"}," ++ "\"uri\": \"spotify:track:2FX5HPP1FNNuLlt2UU9os7\"" ++ "}}" trackObject : Track trackObject = { name = "Umbrella" , album = "Umbrella" , artists = [ "Ember Island" ] , url = Just "https://open.spotify.com/track/2FX5HPP1FNNuLlt2UU9os7" , uri = "spotify:track:2FX5HPP1FNNuLlt2UU9os7" } noTrackJson : String noTrackJson = -- some json object not containing the "track" key "{}" noTrackObject : Track noTrackObject = { name = "", album = "", artists = [], url = Nothing, uri = "" } pagingString : String -> String pagingString str = "{\"href\": \"<paging-webapi-link>\", \"items\": [" ++ str ++ "], \"limit\": 1, \"next\": null, \"offset\": 0, \"previous\": null, \"total\": 1}" pagingObject : a -> Paging a pagingObject obj = { href = "<paging-webapi-link>" , items = [ obj ] , limit = 1 , next = Nothing , offset = 0 , previous = Nothing , total = 1 }
30247
module Spotify.TestData exposing (..) import Spotify.Payloads exposing (Image, Paging, Playlist, Track) imageJson : String imageJson = "{\"url\":\"<image-url>\", \"width\": 64, \"height\": 64}" imageObject : Image imageObject = { url = "<image-url>", width = Just 64, height = Just 64 } imageWithoutSizeJson : String imageWithoutSizeJson = "{\"url\":\"<image-url>\"}" imageWithoutSizeObject : Image imageWithoutSizeObject = { imageObject | width = Nothing, height = Nothing } playlistObject : Playlist playlistObject = { href = "<playlist-webapi-link>" , url = "<some-url>" , id = "<some-id>" , images = [ imageObject ] , name = "example" , isPublic = False , tracks = { href = "<tracks-webapi-link>", total = 1 } , owner = { displayName = Nothing, id = "<some-id>", url = "<some-url>" } } playlistJson : String playlistJson = "{\"href\": \"<playlist-webapi-link>\"," ++ "\"external_urls\": {\"spotify\": \"<some-url>\"}," ++ "\"id\": \"<some-id>\", \"images\": [" ++ imageJson ++ "], \"name\": \"example\", \"public\": false, \"tracks\": {" ++ "\"href\": \"<tracks-webapi-link>\", \"total\": 1" ++ "}, \"owner\": {" ++ "\"display_name\": null, \"id\": \"<some-id>\", \"external_urls\": {\"spotify\": \"<some-url>\"}" ++ "}}" trackJson : String trackJson = "{\"track\":{" ++ "\"name\": \"Umbrella\", \"album\": {\"name\": \"Umbrella\"}," ++ "\"artists\": [{\"name\": \"Ember Island\"}]," ++ "\"external_urls\": {\"spotify\": \"https://open.spotify.com/track/2FX5HPP1FNNuLlt2UU9os7\"}," ++ "\"uri\": \"spotify:track:2FX5HPP1FNNuLlt2UU9os7\"" ++ "}}" trackObject : Track trackObject = { name = "Umbrella" , album = "Umbrella" , artists = [ "Em<NAME> Island" ] , url = Just "https://open.spotify.com/track/2FX5HPP1FNNuLlt2UU9os7" , uri = "spotify:track:2FX5HPP1FNNuLlt2UU9os7" } noTrackJson : String noTrackJson = -- some json object not containing the "track" key "{}" noTrackObject : Track noTrackObject = { name = "", album = "", artists = [], url = Nothing, uri = "" } pagingString : String -> String pagingString str = "{\"href\": \"<paging-webapi-link>\", \"items\": [" ++ str ++ "], \"limit\": 1, \"next\": null, \"offset\": 0, \"previous\": null, \"total\": 1}" pagingObject : a -> Paging a pagingObject obj = { href = "<paging-webapi-link>" , items = [ obj ] , limit = 1 , next = Nothing , offset = 0 , previous = Nothing , total = 1 }
true
module Spotify.TestData exposing (..) import Spotify.Payloads exposing (Image, Paging, Playlist, Track) imageJson : String imageJson = "{\"url\":\"<image-url>\", \"width\": 64, \"height\": 64}" imageObject : Image imageObject = { url = "<image-url>", width = Just 64, height = Just 64 } imageWithoutSizeJson : String imageWithoutSizeJson = "{\"url\":\"<image-url>\"}" imageWithoutSizeObject : Image imageWithoutSizeObject = { imageObject | width = Nothing, height = Nothing } playlistObject : Playlist playlistObject = { href = "<playlist-webapi-link>" , url = "<some-url>" , id = "<some-id>" , images = [ imageObject ] , name = "example" , isPublic = False , tracks = { href = "<tracks-webapi-link>", total = 1 } , owner = { displayName = Nothing, id = "<some-id>", url = "<some-url>" } } playlistJson : String playlistJson = "{\"href\": \"<playlist-webapi-link>\"," ++ "\"external_urls\": {\"spotify\": \"<some-url>\"}," ++ "\"id\": \"<some-id>\", \"images\": [" ++ imageJson ++ "], \"name\": \"example\", \"public\": false, \"tracks\": {" ++ "\"href\": \"<tracks-webapi-link>\", \"total\": 1" ++ "}, \"owner\": {" ++ "\"display_name\": null, \"id\": \"<some-id>\", \"external_urls\": {\"spotify\": \"<some-url>\"}" ++ "}}" trackJson : String trackJson = "{\"track\":{" ++ "\"name\": \"Umbrella\", \"album\": {\"name\": \"Umbrella\"}," ++ "\"artists\": [{\"name\": \"Ember Island\"}]," ++ "\"external_urls\": {\"spotify\": \"https://open.spotify.com/track/2FX5HPP1FNNuLlt2UU9os7\"}," ++ "\"uri\": \"spotify:track:2FX5HPP1FNNuLlt2UU9os7\"" ++ "}}" trackObject : Track trackObject = { name = "Umbrella" , album = "Umbrella" , artists = [ "EmPI:NAME:<NAME>END_PI Island" ] , url = Just "https://open.spotify.com/track/2FX5HPP1FNNuLlt2UU9os7" , uri = "spotify:track:2FX5HPP1FNNuLlt2UU9os7" } noTrackJson : String noTrackJson = -- some json object not containing the "track" key "{}" noTrackObject : Track noTrackObject = { name = "", album = "", artists = [], url = Nothing, uri = "" } pagingString : String -> String pagingString str = "{\"href\": \"<paging-webapi-link>\", \"items\": [" ++ str ++ "], \"limit\": 1, \"next\": null, \"offset\": 0, \"previous\": null, \"total\": 1}" pagingObject : a -> Paging a pagingObject obj = { href = "<paging-webapi-link>" , items = [ obj ] , limit = 1 , next = Nothing , offset = 0 , previous = Nothing , total = 1 }
elm
[ { "context": " , a [ href \"https://github.com/caburj\" ] [ text \"Joseph Caburnay\" ]\n ", "end": 366, "score": 0.9995424747, "start": 360, "tag": "USERNAME", "value": "caburj" }, { "context": " , a [ href \"https://github.com/caburj\" ] [ text \"Joseph Caburnay\" ]\n , text \" and Jean Katrine ", "end": 393, "score": 0.9998953938, "start": 378, "tag": "NAME", "value": "Joseph Caburnay" }, { "context": "oseph Caburnay\" ]\n , text \" and Jean Katrine Boyles.\"\n ]\n , p []\n ", "end": 449, "score": 0.9998995066, "start": 430, "tag": "NAME", "value": "Jean Katrine Boyles" } ]
src/Footer.elm
caburj/transaccion
1
module Footer exposing (..) import Html exposing (..) import Html.Attributes exposing (..) main = node "footer" [ id "footer", class "footer" ] [ div [] [ div [] [ p [] [ strong [] [ text "transaccion" ] , text " by " , a [ href "https://github.com/caburj" ] [ text "Joseph Caburnay" ] , text " and Jean Katrine Boyles." ] , p [] [ text "Cooked in " , a [ href "https://elm-lang.org/" ] [ text "Elm" ] , text ". Flavored with " , a [ href "https://bulma.io" ] [ text "Bulma" ] , text " and " , a [ href "https://remotestorage.io" ] [ text "remotestoragejs." ] ] , p [] [ text "Licensed under the " , a [ href "https://www.apache.org/licenses/LICENSE-2.0" ] [ text "Apache License 2.0." ] ] ] ] ]
37328
module Footer exposing (..) import Html exposing (..) import Html.Attributes exposing (..) main = node "footer" [ id "footer", class "footer" ] [ div [] [ div [] [ p [] [ strong [] [ text "transaccion" ] , text " by " , a [ href "https://github.com/caburj" ] [ text "<NAME>" ] , text " and <NAME>." ] , p [] [ text "Cooked in " , a [ href "https://elm-lang.org/" ] [ text "Elm" ] , text ". Flavored with " , a [ href "https://bulma.io" ] [ text "Bulma" ] , text " and " , a [ href "https://remotestorage.io" ] [ text "remotestoragejs." ] ] , p [] [ text "Licensed under the " , a [ href "https://www.apache.org/licenses/LICENSE-2.0" ] [ text "Apache License 2.0." ] ] ] ] ]
true
module Footer exposing (..) import Html exposing (..) import Html.Attributes exposing (..) main = node "footer" [ id "footer", class "footer" ] [ div [] [ div [] [ p [] [ strong [] [ text "transaccion" ] , text " by " , a [ href "https://github.com/caburj" ] [ text "PI:NAME:<NAME>END_PI" ] , text " and PI:NAME:<NAME>END_PI." ] , p [] [ text "Cooked in " , a [ href "https://elm-lang.org/" ] [ text "Elm" ] , text ". Flavored with " , a [ href "https://bulma.io" ] [ text "Bulma" ] , text " and " , a [ href "https://remotestorage.io" ] [ text "remotestoragejs." ] ] , p [] [ text "Licensed under the " , a [ href "https://www.apache.org/licenses/LICENSE-2.0" ] [ text "Apache License 2.0." ] ] ] ] ]
elm
[ { "context": "3\",\n \"email\": \"d@level.space\",\n \"insertedAt", "end": 765, "score": 0.9999091029, "start": 752, "tag": "EMAIL", "value": "d@level.space" }, { "context": " , email = \"d@level.space\"\n , insert", "end": 1684, "score": 0.9999011755, "start": 1671, "tag": "EMAIL", "value": "d@level.space" } ]
assets/elm/tests/Data/InvitationTest.elm
cas27/level
0
module Data.InvitationTest exposing (..) import Expect exposing (Expectation) import Data.Invitation as Invitation import Test exposing (..) import Json.Decode exposing (decodeString) import TestHelpers exposing (success) import Date {-| Tests for JSON decoders. -} decoders : Test decoders = describe "decoders" [ describe "Invitation.invitationConnectionDecoder" [ test "decodes invitation JSON" <| \_ -> let json = """ { "edges": [{ "node": { "id": "123", "email": "d@level.space", "insertedAt": "2017-12-29T01:45:32Z" } }], "pageInfo": { "hasPreviousPage": false, "hasNextPage": false, "startCursor": "XXX", "endCursor": "XXX" }, "totalCount": 1 } """ result = decodeString Invitation.invitationConnectionDecoder json expected = { edges = [ { node = { id = "123" , email = "d@level.space" , insertedAt = Date.fromTime 1514511932000 } } ] , pageInfo = { hasPreviousPage = False , hasNextPage = False , startCursor = Just "XXX" , endCursor = Just "XXX" } , totalCount = 1 } in Expect.equal (Ok expected) result , test "does not succeed given invalid JSON" <| \_ -> let json = """ { "id": "9999" } """ result = decodeString Invitation.invitationConnectionDecoder json in Expect.equal False (success result) ] ]
31370
module Data.InvitationTest exposing (..) import Expect exposing (Expectation) import Data.Invitation as Invitation import Test exposing (..) import Json.Decode exposing (decodeString) import TestHelpers exposing (success) import Date {-| Tests for JSON decoders. -} decoders : Test decoders = describe "decoders" [ describe "Invitation.invitationConnectionDecoder" [ test "decodes invitation JSON" <| \_ -> let json = """ { "edges": [{ "node": { "id": "123", "email": "<EMAIL>", "insertedAt": "2017-12-29T01:45:32Z" } }], "pageInfo": { "hasPreviousPage": false, "hasNextPage": false, "startCursor": "XXX", "endCursor": "XXX" }, "totalCount": 1 } """ result = decodeString Invitation.invitationConnectionDecoder json expected = { edges = [ { node = { id = "123" , email = "<EMAIL>" , insertedAt = Date.fromTime 1514511932000 } } ] , pageInfo = { hasPreviousPage = False , hasNextPage = False , startCursor = Just "XXX" , endCursor = Just "XXX" } , totalCount = 1 } in Expect.equal (Ok expected) result , test "does not succeed given invalid JSON" <| \_ -> let json = """ { "id": "9999" } """ result = decodeString Invitation.invitationConnectionDecoder json in Expect.equal False (success result) ] ]
true
module Data.InvitationTest exposing (..) import Expect exposing (Expectation) import Data.Invitation as Invitation import Test exposing (..) import Json.Decode exposing (decodeString) import TestHelpers exposing (success) import Date {-| Tests for JSON decoders. -} decoders : Test decoders = describe "decoders" [ describe "Invitation.invitationConnectionDecoder" [ test "decodes invitation JSON" <| \_ -> let json = """ { "edges": [{ "node": { "id": "123", "email": "PI:EMAIL:<EMAIL>END_PI", "insertedAt": "2017-12-29T01:45:32Z" } }], "pageInfo": { "hasPreviousPage": false, "hasNextPage": false, "startCursor": "XXX", "endCursor": "XXX" }, "totalCount": 1 } """ result = decodeString Invitation.invitationConnectionDecoder json expected = { edges = [ { node = { id = "123" , email = "PI:EMAIL:<EMAIL>END_PI" , insertedAt = Date.fromTime 1514511932000 } } ] , pageInfo = { hasPreviousPage = False , hasNextPage = False , startCursor = Just "XXX" , endCursor = Just "XXX" } , totalCount = 1 } in Expect.equal (Ok expected) result , test "does not succeed given invalid JSON" <| \_ -> let json = """ { "id": "9999" } """ result = decodeString Invitation.invitationConnectionDecoder json in Expect.equal False (success result) ] ]
elm
[ { "context": "ve understanding, let's look at the moment of time Neil Armstrong first\nset foot on the moon. If we look at [wikipe", "end": 1444, "score": 0.8161001205, "start": 1430, "tag": "NAME", "value": "Neil Armstrong" } ]
src/Chrono/Moment.elm
fmechant/crono
0
module Chrono.Moment exposing ( Moment, now , intoFuture, intoPast , earliest, chronologicalComparison , fromMsSinceEpoch, toMsAfterEpoch , TimeLapse(..), Direction(..), every, elapsed , hours, minutes, seconds, milliseconds, and , timeLapseView ) {-| Module for working with moments in time and time lapses. Hours, minutes, seconds make sense here. If you are looking for concepts like days or weeks, look into [Date][./Date]. Months or years are used in the [GregorianCalendar][./GregorianCalendar] module. If you are looking for [TimeZone][./Date#TimeZone], it is part of the Date module, because time zones define the mapping between a moment and a date/time. # Moments @docs Moment, now ## Time Travel @docs intoFuture, intoPast ## Comparing Moments @docs earliest, chronologicalComparison ## Exchanging Moments with Other Systems @docs fromMsSinceEpoch, toMsAfterEpoch # Time Lapses @docs TimeLapse, Direction, every, elapsed ## Defining Time Lapses @docs hours, minutes, seconds, milliseconds, and ## Viewwing Time Lapses @docs timeLapseView -} import Task exposing (Task) import Time as CoreTime {-| A specific moment in time. For example, the moment you started reading this sentence. What we call `Moment`, is what [elm/time][coretime] calls `Posix` and what [Abseil][abseil] calls _Absolute Time_. To improve understanding, let's look at the moment of time Neil Armstrong first set foot on the moon. If we look at [wikipedia][wikiapollo], it says that happened on July 21, 1969 at 02:56 UTC. When viewing live in Europe, you could have seen that on July 21 at 04:56. In New York, that would have been on July 20 at 22:56. Remark that even the date is different. To be able to represent a moment in time, we pick a moment in the past (the epoch), and work relative from that. [coretime]: https://package.elm-lang.org/packages/elm/time/latest [abseil]: https://abseil.io/docs/cpp/guides/time [wikiapollo]: https://en.wikipedia.org/wiki/Apollo_11 -} type Moment = Moment Int {-| Get the moment when this task is run. This is typically used with the Elm architecture, like this: import Task type Msg = SystemGotNow Moment update msg model = case msg of _ -> ( model, Task.perform SystemGotNow now ) -} now : Task x Moment now = Task.map (fromMsSinceEpoch << CoreTime.posixToMillis) CoreTime.now {-| Get the moment that occured the number of milliseconds after the epoch. Typically only used when receiving a moment that was previously exported. Avoid using this for calculations, let this library do the hard work for you. -} fromMsSinceEpoch : Int -> Moment fromMsSinceEpoch ms = Moment ms {-| Get the number of milliseconds after the epoch that this moment occured. Typically only used for exporting the moment. Avoid using this for calculations, let this library do the hard work for you. -} toMsAfterEpoch : Moment -> Int toMsAfterEpoch (Moment ms) = ms {-| Move the moment into the future for a time lapse. If you want to move days, weeks, months or years, use Date or GregorianCalendar for that. -} intoFuture : TimeLapse -> Moment -> Moment intoFuture (TimeLapse lapseInMs) (Moment momentInMs) = Moment <| momentInMs + lapseInMs {-| Move the moment into the past for a time lapse. If you want to move days, weeks, months or years, use Date or GregorianCalendar for that. -} intoPast : TimeLapse -> Moment -> Moment intoPast (TimeLapse lapseInMs) (Moment momentInMs) = Moment <| momentInMs - lapseInMs {-| Get the moment that happened first. -} earliest : Moment -> Moment -> Moment earliest (Moment ms) (Moment ms2) = Moment (min ms ms2) {-| Compare two moments chronologically. Typically used with `List.sortWith`. import List let base = fromMsSinceEpoch 0 later = intoFuture (minutes 5) base earlier = intoPast (hours 20) base in [earlier, base, later] == List.sortWith chronologicalComparison [later, earlier, base] --> True -} chronologicalComparison : Moment -> Moment -> Order chronologicalComparison (Moment m) (Moment n) = Basics.compare m n ---- TimeLapse ---- {-| TimeLapses represent a specific time lapse between two moments. For example, the time lapse between starting to read the first sentence, and the start of reading this sentence. It is represented in the moment module, because we are thinking about actual elaps of specific seconds, minutes and hours. **TimeLapse has no way of describing days,** because one day is not always 24 hours. For example, going 24 hours into the future is not the same as going a day into the future. In Europe it is only the same in about 363 days a year, because of daylight time savings. If you want to describe duration of days, weeks, months or years, use Date or GregorianCalendar for that. -} type TimeLapse = TimeLapse Int {-| Direction represents the relative position of one moment regarding another moment, whether it is into the future, or into the past. -} type Direction = IntoTheFuture | IntoThePast {-| A time lapse of some milliseconds. Only use positive values, if you want your code to be predictable. -} milliseconds : Int -> TimeLapse milliseconds value = TimeLapse value {-| A time lapse of some seconds. Only use positive values, if you want your code to be predictable. -} seconds : Int -> TimeLapse seconds value = milliseconds <| value * 1000 {-| A time lapse of some minutes. Only use positive values, if you want your code to be predictable. -} minutes : Int -> TimeLapse minutes value = seconds <| value * 60 {-| A time lapse of some hours. Only use positive values, if you want your code to be predictable. -} hours : Int -> TimeLapse hours value = minutes <| value * 60 {-| Combine two time lapses. It has an odd signiture to be able to efficiently use it using the pipe (|>) operator. Example: hours 2 |> and minutes 45 |> timeLapseView --> { hours = 2, minutes = 45, seconds = 0, milliseconds = 0} -} and : (Int -> TimeLapse) -> Int -> TimeLapse -> TimeLapse and fct value (TimeLapse timeLapse) = let (TimeLapse toAdd) = fct value in TimeLapse (timeLapse + toAdd) {-| Show the time lapse split up in milliseconds, seconds, minutes and hours. Typically used to create your own specific view of the time lapse. let myTimeLapseView timeLapse = let {hours, minutes} = timeLapseView timeLapse in String.fromInt hours ++ ":" ++ String.fromInt minutes in hours 5 |> and minutes 45 |> myTimeLapseView --> "5:45" -} timeLapseView : TimeLapse -> { milliseconds : Int, seconds : Int, minutes : Int, hours : Int } timeLapseView (TimeLapse timeLapse) = let -- Subtract the whole part, when dividing by the factor, and return the whole part, and the remaining value. substractWhole : Int -> Int -> ( Int, Int ) substractWhole value factor = let whole = value // factor in ( whole, value - whole * factor ) ( wholeHours, withoutHours ) = substractWhole timeLapse 3600000 ( wholeMinutes, withoutMinutes ) = substractWhole withoutHours 60000 ( wholeSeconds, withoutSeconds ) = substractWhole withoutMinutes 1000 in { milliseconds = withoutSeconds, seconds = wholeSeconds, minutes = wholeMinutes, hours = wholeHours } {-| How much time has elapsed between the moments. The result is a time lapse, with the indication whether one moment is in the future or in the past regarding to the other moment. -} elapsed : Moment -> Moment -> ( TimeLapse, Direction ) elapsed (Moment from) (Moment to) = let diff = to - from dir = if diff < 0 then IntoThePast else IntoTheFuture in ( TimeLapse <| abs diff, dir ) {-| Get the current moment, every time lapse. If it is unclear to you why it returns a Sub, please review the Elm architecture. -} every : TimeLapse -> (Moment -> msg) -> Sub msg every (TimeLapse timeLapse) function = CoreTime.every (toFloat timeLapse) (CoreTime.posixToMillis >> fromMsSinceEpoch >> function)
37293
module Chrono.Moment exposing ( Moment, now , intoFuture, intoPast , earliest, chronologicalComparison , fromMsSinceEpoch, toMsAfterEpoch , TimeLapse(..), Direction(..), every, elapsed , hours, minutes, seconds, milliseconds, and , timeLapseView ) {-| Module for working with moments in time and time lapses. Hours, minutes, seconds make sense here. If you are looking for concepts like days or weeks, look into [Date][./Date]. Months or years are used in the [GregorianCalendar][./GregorianCalendar] module. If you are looking for [TimeZone][./Date#TimeZone], it is part of the Date module, because time zones define the mapping between a moment and a date/time. # Moments @docs Moment, now ## Time Travel @docs intoFuture, intoPast ## Comparing Moments @docs earliest, chronologicalComparison ## Exchanging Moments with Other Systems @docs fromMsSinceEpoch, toMsAfterEpoch # Time Lapses @docs TimeLapse, Direction, every, elapsed ## Defining Time Lapses @docs hours, minutes, seconds, milliseconds, and ## Viewwing Time Lapses @docs timeLapseView -} import Task exposing (Task) import Time as CoreTime {-| A specific moment in time. For example, the moment you started reading this sentence. What we call `Moment`, is what [elm/time][coretime] calls `Posix` and what [Abseil][abseil] calls _Absolute Time_. To improve understanding, let's look at the moment of time <NAME> first set foot on the moon. If we look at [wikipedia][wikiapollo], it says that happened on July 21, 1969 at 02:56 UTC. When viewing live in Europe, you could have seen that on July 21 at 04:56. In New York, that would have been on July 20 at 22:56. Remark that even the date is different. To be able to represent a moment in time, we pick a moment in the past (the epoch), and work relative from that. [coretime]: https://package.elm-lang.org/packages/elm/time/latest [abseil]: https://abseil.io/docs/cpp/guides/time [wikiapollo]: https://en.wikipedia.org/wiki/Apollo_11 -} type Moment = Moment Int {-| Get the moment when this task is run. This is typically used with the Elm architecture, like this: import Task type Msg = SystemGotNow Moment update msg model = case msg of _ -> ( model, Task.perform SystemGotNow now ) -} now : Task x Moment now = Task.map (fromMsSinceEpoch << CoreTime.posixToMillis) CoreTime.now {-| Get the moment that occured the number of milliseconds after the epoch. Typically only used when receiving a moment that was previously exported. Avoid using this for calculations, let this library do the hard work for you. -} fromMsSinceEpoch : Int -> Moment fromMsSinceEpoch ms = Moment ms {-| Get the number of milliseconds after the epoch that this moment occured. Typically only used for exporting the moment. Avoid using this for calculations, let this library do the hard work for you. -} toMsAfterEpoch : Moment -> Int toMsAfterEpoch (Moment ms) = ms {-| Move the moment into the future for a time lapse. If you want to move days, weeks, months or years, use Date or GregorianCalendar for that. -} intoFuture : TimeLapse -> Moment -> Moment intoFuture (TimeLapse lapseInMs) (Moment momentInMs) = Moment <| momentInMs + lapseInMs {-| Move the moment into the past for a time lapse. If you want to move days, weeks, months or years, use Date or GregorianCalendar for that. -} intoPast : TimeLapse -> Moment -> Moment intoPast (TimeLapse lapseInMs) (Moment momentInMs) = Moment <| momentInMs - lapseInMs {-| Get the moment that happened first. -} earliest : Moment -> Moment -> Moment earliest (Moment ms) (Moment ms2) = Moment (min ms ms2) {-| Compare two moments chronologically. Typically used with `List.sortWith`. import List let base = fromMsSinceEpoch 0 later = intoFuture (minutes 5) base earlier = intoPast (hours 20) base in [earlier, base, later] == List.sortWith chronologicalComparison [later, earlier, base] --> True -} chronologicalComparison : Moment -> Moment -> Order chronologicalComparison (Moment m) (Moment n) = Basics.compare m n ---- TimeLapse ---- {-| TimeLapses represent a specific time lapse between two moments. For example, the time lapse between starting to read the first sentence, and the start of reading this sentence. It is represented in the moment module, because we are thinking about actual elaps of specific seconds, minutes and hours. **TimeLapse has no way of describing days,** because one day is not always 24 hours. For example, going 24 hours into the future is not the same as going a day into the future. In Europe it is only the same in about 363 days a year, because of daylight time savings. If you want to describe duration of days, weeks, months or years, use Date or GregorianCalendar for that. -} type TimeLapse = TimeLapse Int {-| Direction represents the relative position of one moment regarding another moment, whether it is into the future, or into the past. -} type Direction = IntoTheFuture | IntoThePast {-| A time lapse of some milliseconds. Only use positive values, if you want your code to be predictable. -} milliseconds : Int -> TimeLapse milliseconds value = TimeLapse value {-| A time lapse of some seconds. Only use positive values, if you want your code to be predictable. -} seconds : Int -> TimeLapse seconds value = milliseconds <| value * 1000 {-| A time lapse of some minutes. Only use positive values, if you want your code to be predictable. -} minutes : Int -> TimeLapse minutes value = seconds <| value * 60 {-| A time lapse of some hours. Only use positive values, if you want your code to be predictable. -} hours : Int -> TimeLapse hours value = minutes <| value * 60 {-| Combine two time lapses. It has an odd signiture to be able to efficiently use it using the pipe (|>) operator. Example: hours 2 |> and minutes 45 |> timeLapseView --> { hours = 2, minutes = 45, seconds = 0, milliseconds = 0} -} and : (Int -> TimeLapse) -> Int -> TimeLapse -> TimeLapse and fct value (TimeLapse timeLapse) = let (TimeLapse toAdd) = fct value in TimeLapse (timeLapse + toAdd) {-| Show the time lapse split up in milliseconds, seconds, minutes and hours. Typically used to create your own specific view of the time lapse. let myTimeLapseView timeLapse = let {hours, minutes} = timeLapseView timeLapse in String.fromInt hours ++ ":" ++ String.fromInt minutes in hours 5 |> and minutes 45 |> myTimeLapseView --> "5:45" -} timeLapseView : TimeLapse -> { milliseconds : Int, seconds : Int, minutes : Int, hours : Int } timeLapseView (TimeLapse timeLapse) = let -- Subtract the whole part, when dividing by the factor, and return the whole part, and the remaining value. substractWhole : Int -> Int -> ( Int, Int ) substractWhole value factor = let whole = value // factor in ( whole, value - whole * factor ) ( wholeHours, withoutHours ) = substractWhole timeLapse 3600000 ( wholeMinutes, withoutMinutes ) = substractWhole withoutHours 60000 ( wholeSeconds, withoutSeconds ) = substractWhole withoutMinutes 1000 in { milliseconds = withoutSeconds, seconds = wholeSeconds, minutes = wholeMinutes, hours = wholeHours } {-| How much time has elapsed between the moments. The result is a time lapse, with the indication whether one moment is in the future or in the past regarding to the other moment. -} elapsed : Moment -> Moment -> ( TimeLapse, Direction ) elapsed (Moment from) (Moment to) = let diff = to - from dir = if diff < 0 then IntoThePast else IntoTheFuture in ( TimeLapse <| abs diff, dir ) {-| Get the current moment, every time lapse. If it is unclear to you why it returns a Sub, please review the Elm architecture. -} every : TimeLapse -> (Moment -> msg) -> Sub msg every (TimeLapse timeLapse) function = CoreTime.every (toFloat timeLapse) (CoreTime.posixToMillis >> fromMsSinceEpoch >> function)
true
module Chrono.Moment exposing ( Moment, now , intoFuture, intoPast , earliest, chronologicalComparison , fromMsSinceEpoch, toMsAfterEpoch , TimeLapse(..), Direction(..), every, elapsed , hours, minutes, seconds, milliseconds, and , timeLapseView ) {-| Module for working with moments in time and time lapses. Hours, minutes, seconds make sense here. If you are looking for concepts like days or weeks, look into [Date][./Date]. Months or years are used in the [GregorianCalendar][./GregorianCalendar] module. If you are looking for [TimeZone][./Date#TimeZone], it is part of the Date module, because time zones define the mapping between a moment and a date/time. # Moments @docs Moment, now ## Time Travel @docs intoFuture, intoPast ## Comparing Moments @docs earliest, chronologicalComparison ## Exchanging Moments with Other Systems @docs fromMsSinceEpoch, toMsAfterEpoch # Time Lapses @docs TimeLapse, Direction, every, elapsed ## Defining Time Lapses @docs hours, minutes, seconds, milliseconds, and ## Viewwing Time Lapses @docs timeLapseView -} import Task exposing (Task) import Time as CoreTime {-| A specific moment in time. For example, the moment you started reading this sentence. What we call `Moment`, is what [elm/time][coretime] calls `Posix` and what [Abseil][abseil] calls _Absolute Time_. To improve understanding, let's look at the moment of time PI:NAME:<NAME>END_PI first set foot on the moon. If we look at [wikipedia][wikiapollo], it says that happened on July 21, 1969 at 02:56 UTC. When viewing live in Europe, you could have seen that on July 21 at 04:56. In New York, that would have been on July 20 at 22:56. Remark that even the date is different. To be able to represent a moment in time, we pick a moment in the past (the epoch), and work relative from that. [coretime]: https://package.elm-lang.org/packages/elm/time/latest [abseil]: https://abseil.io/docs/cpp/guides/time [wikiapollo]: https://en.wikipedia.org/wiki/Apollo_11 -} type Moment = Moment Int {-| Get the moment when this task is run. This is typically used with the Elm architecture, like this: import Task type Msg = SystemGotNow Moment update msg model = case msg of _ -> ( model, Task.perform SystemGotNow now ) -} now : Task x Moment now = Task.map (fromMsSinceEpoch << CoreTime.posixToMillis) CoreTime.now {-| Get the moment that occured the number of milliseconds after the epoch. Typically only used when receiving a moment that was previously exported. Avoid using this for calculations, let this library do the hard work for you. -} fromMsSinceEpoch : Int -> Moment fromMsSinceEpoch ms = Moment ms {-| Get the number of milliseconds after the epoch that this moment occured. Typically only used for exporting the moment. Avoid using this for calculations, let this library do the hard work for you. -} toMsAfterEpoch : Moment -> Int toMsAfterEpoch (Moment ms) = ms {-| Move the moment into the future for a time lapse. If you want to move days, weeks, months or years, use Date or GregorianCalendar for that. -} intoFuture : TimeLapse -> Moment -> Moment intoFuture (TimeLapse lapseInMs) (Moment momentInMs) = Moment <| momentInMs + lapseInMs {-| Move the moment into the past for a time lapse. If you want to move days, weeks, months or years, use Date or GregorianCalendar for that. -} intoPast : TimeLapse -> Moment -> Moment intoPast (TimeLapse lapseInMs) (Moment momentInMs) = Moment <| momentInMs - lapseInMs {-| Get the moment that happened first. -} earliest : Moment -> Moment -> Moment earliest (Moment ms) (Moment ms2) = Moment (min ms ms2) {-| Compare two moments chronologically. Typically used with `List.sortWith`. import List let base = fromMsSinceEpoch 0 later = intoFuture (minutes 5) base earlier = intoPast (hours 20) base in [earlier, base, later] == List.sortWith chronologicalComparison [later, earlier, base] --> True -} chronologicalComparison : Moment -> Moment -> Order chronologicalComparison (Moment m) (Moment n) = Basics.compare m n ---- TimeLapse ---- {-| TimeLapses represent a specific time lapse between two moments. For example, the time lapse between starting to read the first sentence, and the start of reading this sentence. It is represented in the moment module, because we are thinking about actual elaps of specific seconds, minutes and hours. **TimeLapse has no way of describing days,** because one day is not always 24 hours. For example, going 24 hours into the future is not the same as going a day into the future. In Europe it is only the same in about 363 days a year, because of daylight time savings. If you want to describe duration of days, weeks, months or years, use Date or GregorianCalendar for that. -} type TimeLapse = TimeLapse Int {-| Direction represents the relative position of one moment regarding another moment, whether it is into the future, or into the past. -} type Direction = IntoTheFuture | IntoThePast {-| A time lapse of some milliseconds. Only use positive values, if you want your code to be predictable. -} milliseconds : Int -> TimeLapse milliseconds value = TimeLapse value {-| A time lapse of some seconds. Only use positive values, if you want your code to be predictable. -} seconds : Int -> TimeLapse seconds value = milliseconds <| value * 1000 {-| A time lapse of some minutes. Only use positive values, if you want your code to be predictable. -} minutes : Int -> TimeLapse minutes value = seconds <| value * 60 {-| A time lapse of some hours. Only use positive values, if you want your code to be predictable. -} hours : Int -> TimeLapse hours value = minutes <| value * 60 {-| Combine two time lapses. It has an odd signiture to be able to efficiently use it using the pipe (|>) operator. Example: hours 2 |> and minutes 45 |> timeLapseView --> { hours = 2, minutes = 45, seconds = 0, milliseconds = 0} -} and : (Int -> TimeLapse) -> Int -> TimeLapse -> TimeLapse and fct value (TimeLapse timeLapse) = let (TimeLapse toAdd) = fct value in TimeLapse (timeLapse + toAdd) {-| Show the time lapse split up in milliseconds, seconds, minutes and hours. Typically used to create your own specific view of the time lapse. let myTimeLapseView timeLapse = let {hours, minutes} = timeLapseView timeLapse in String.fromInt hours ++ ":" ++ String.fromInt minutes in hours 5 |> and minutes 45 |> myTimeLapseView --> "5:45" -} timeLapseView : TimeLapse -> { milliseconds : Int, seconds : Int, minutes : Int, hours : Int } timeLapseView (TimeLapse timeLapse) = let -- Subtract the whole part, when dividing by the factor, and return the whole part, and the remaining value. substractWhole : Int -> Int -> ( Int, Int ) substractWhole value factor = let whole = value // factor in ( whole, value - whole * factor ) ( wholeHours, withoutHours ) = substractWhole timeLapse 3600000 ( wholeMinutes, withoutMinutes ) = substractWhole withoutHours 60000 ( wholeSeconds, withoutSeconds ) = substractWhole withoutMinutes 1000 in { milliseconds = withoutSeconds, seconds = wholeSeconds, minutes = wholeMinutes, hours = wholeHours } {-| How much time has elapsed between the moments. The result is a time lapse, with the indication whether one moment is in the future or in the past regarding to the other moment. -} elapsed : Moment -> Moment -> ( TimeLapse, Direction ) elapsed (Moment from) (Moment to) = let diff = to - from dir = if diff < 0 then IntoThePast else IntoTheFuture in ( TimeLapse <| abs diff, dir ) {-| Get the current moment, every time lapse. If it is unclear to you why it returns a Sub, please review the Elm architecture. -} every : TimeLapse -> (Moment -> msg) -> Sub msg every (TimeLapse timeLapse) function = CoreTime.every (toFloat timeLapse) (CoreTime.posixToMillis >> fromMsSinceEpoch >> function)
elm
[ { "context": "nference.compareConferences\n [ { name = \"@Swift\"\n , link = \"http://atswift.io/index-", "end": 306, "score": 0.9959062338, "start": 299, "tag": "USERNAME", "value": "\"@Swift" }, { "context": "\"Swift\" ]\n }\n , { name = \"PHPBenelux\"\n , link = \"http://conference.phpben", "end": 5052, "score": 0.7277331352, "start": 5042, "tag": "USERNAME", "value": "PHPBenelux" }, { "context": "g \"SML\" ]\n }\n , { name = \"RubyFuza\"\n , link = \"http://www.rubyfuza.org/", "end": 7224, "score": 0.7889757752, "start": 7216, "tag": "NAME", "value": "RubyFuza" }, { "context": " \"Ruby\" ]\n }\n , { name = \"SunshinePHP\"\n , link = \"http://2016.sunshinephp.", "end": 7635, "score": 0.7974077463, "start": 7624, "tag": "USERNAME", "value": "SunshinePHP" }, { "context": "P\" ]\n }\n , { name = \"hello.js\"\n , link = \"http://hellojs.org/\"\n ", "end": 14720, "score": 0.6822246313, "start": 14718, "tag": "NAME", "value": "js" }, { "context": "Script\" ]\n }\n , { name = \"Lambda Days\"\n , link = \"http://www.lambdadays.or", "end": 15126, "score": 0.7315446138, "start": 15115, "tag": "NAME", "value": "Lambda Days" }, { "context": "Erlang\" ]\n }\n , { name = \"BOB 2016\"\n , link = \"http://bobkonf.de/2016/e", "end": 15555, "score": 0.8270243406, "start": 15547, "tag": "NAME", "value": "BOB 2016" }, { "context": "]\n }\n , { name = \":clojureD\"\n , link = \"http://www.clojured.de/\"", "end": 16907, "score": 0.6199516058, "start": 16906, "tag": "USERNAME", "value": "D" }, { "context": "Script\" ]\n }\n , { name = \"GopherCon Dubai\"\n , link = \"http://www.gophercon.ae/", "end": 18689, "score": 0.999578774, "start": 18674, "tag": "NAME", "value": "GopherCon Dubai" }, { "context": "Script\" ]\n }\n , { name = \"UXistanbul\"\n , link = \"http://uxistanbul.org/\"\n", "end": 19511, "score": 0.8289394379, "start": 19501, "tag": "USERNAME", "value": "UXistanbul" }, { "context": "ag \"UX\" ]\n }\n , { name = \"ConFoo\"\n , link = \"http://confoo.ca/en\"\n ", "end": 19901, "score": 0.9240502715, "start": 19895, "tag": "NAME", "value": "ConFoo" }, { "context": "amming\" ]\n }\n , { name = \"Chamberconf\"\n , link = \"http://chamberconf.pl/\"\n", "end": 22845, "score": 0.8914451599, "start": 22834, "tag": "NAME", "value": "Chamberconf" }, { "context": "eneral\" ]\n }\n , { name = \"droidcon Tunisia\"\n , link = \"http://www.droidcon.tn/\"", "end": 23246, "score": 0.9997643232, "start": 23230, "tag": "NAME", "value": "droidcon Tunisia" }, { "context": "eneral\" ]\n }\n , { name = \"Bath Ruby\"\n , link = \"http://bathruby.us1.list", "end": 28920, "score": 0.9902262092, "start": 28911, "tag": "NAME", "value": "Bath Ruby" }, { "context": " \"Ruby\" ]\n }\n , { name = \"JSConf Beirut\"\n , link = \"http://www.jsconfbeirut.", "end": 30191, "score": 0.8829869032, "start": 30178, "tag": "NAME", "value": "JSConf Beirut" }, { "context": "ag \"UX\" ]\n }\n , { name = \"CocoaConf Yosemite\"\n , link = \"http://cocoaconf.", "end": 31043, "score": 0.8668642044, "start": 31032, "tag": "NAME", "value": "CocoaConf Y" }, { "context": " }\n , { name = \"CocoaConf Yosemite\"\n , link = \"http://cocoaconf.com/yos", "end": 31050, "score": 0.578774333, "start": 31046, "tag": "NAME", "value": "mite" }, { "context": " , link = \"http://cocoaconf.com/yosemite\"\n , startDate = ( 2016, Mar, 14 )\n ", "end": 31105, "score": 0.90505898, "start": 31102, "tag": "NAME", "value": "ite" }, { "context": "Erlang\" ]\n }\n , { name = \"Smashing Conf\"\n , link = \"http://smashingconf.com/", "end": 31903, "score": 0.9923624992, "start": 31890, "tag": "NAME", "value": "Smashing Conf" }, { "context": "ag \"UX\" ]\n }\n , { name = \"DIBI\"\n , link = \"http://dibiconference.co", "end": 32293, "score": 0.9665439129, "start": 32289, "tag": "NAME", "value": "DIBI" }, { "context": "ag \"UX\" ]\n }\n , { name = \"droidcon San Francisco\"\n , link = \"http://sf.", "end": 32694, "score": 0.9400499463, "start": 32686, "tag": "NAME", "value": "droidcon" }, { "context": "Mobile\" ]\n }\n , { name = \"mdevcon\"\n , link = \"http://mdevcon.com/\"\n ", "end": 33118, "score": 0.9980790019, "start": 33111, "tag": "USERNAME", "value": "mdevcon" }, { "context": "ndroid\" ]\n }\n , { name = \"Nordic PGDay\"\n , link = \"http://2016.nordicpgday.", "end": 33582, "score": 0.9886592627, "start": 33570, "tag": "NAME", "value": "Nordic PGDay" }, { "context": " \"Ruby\" ]\n }\n , { name = \"SwiftAveiro\"\n , link = \"https://attending.io/eve", "end": 36610, "score": 0.996040225, "start": 36599, "tag": "NAME", "value": "SwiftAveiro" }, { "context": " , link = \"https://attending.io/events/swiftaveiro\"\n , startDate = ( 2016, Mar, 20 )\n ", "end": 36675, "score": 0.9680323601, "start": 36664, "tag": "USERNAME", "value": "swiftaveiro" }, { "context": "CSS\" ]\n }\n , { name = \"DevExperience\"\n , link = \"http://devexperience.ro/", "end": 39124, "score": 0.7205966115, "start": 39114, "tag": "NAME", "value": "Experience" }, { "context": "eneral\" ]\n }\n , { name = \"droidcon Dubai\"\n , link = \"http://droidcon.ae/\"\n ", "end": 39528, "score": 0.9997254014, "start": 39514, "tag": "NAME", "value": "droidcon Dubai" }, { "context": "ag \"UX\" ]\n }\n , { name = \"Clarity Conf\"\n , link = \"http://clarityconf.com/\"", "end": 41205, "score": 0.9991531372, "start": 41193, "tag": "NAME", "value": "Clarity Conf" }, { "context": "ag \"UX\" ]\n }\n , { name = \"Ruby on Ales\"\n , link = \"https://ruby.onales.com/", "end": 41599, "score": 0.9608340263, "start": 41587, "tag": "NAME", "value": "Ruby on Ales" }, { "context": " \"Ruby\" ]\n }\n , { name = \"Codemotion Dubai\"\n , link = \"http://rome2016.codemoti", "end": 41992, "score": 0.957477212, "start": 41976, "tag": "NAME", "value": "Codemotion Dubai" }, { "context": "neral\" ]\n }\n , { name = \"Flourish!\"\n , link = \"http://flourishconf.", "end": 42390, "score": 0.5302696228, "start": 42386, "tag": "NAME", "value": "lour" }, { "context": "]\n }\n , { name = \"Flourish!\"\n , link = \"http://flourishconf.com/2", "end": 42393, "score": 0.5223770738, "start": 42393, "tag": "NAME", "value": "" }, { "context": "e\" ]\n }\n , { name = \"Fronteers Spring Thing\"\n , link = \"https://", "end": 42791, "score": 0.5688106418, "start": 42790, "tag": "NAME", "value": "e" }, { "context": " }\n , { name = \"Fronteers Spring Thing\"\n , link = \"https://fronteers.nl/spr", "end": 42807, "score": 0.5455969572, "start": 42802, "tag": "NAME", "value": "Thing" }, { "context": "ag \"UX\" ]\n }\n , { name = \"RubyConf Philippines\"\n , link = \"http://rubyconf.ph/\"\n ", "end": 46192, "score": 0.9869426489, "start": 46172, "tag": "NAME", "value": "RubyConf Philippines" }, { "context": " \"Ruby\" ]\n }\n , { name = \"Greach\"\n , link = \"http://greachconf.com/\"\n", "end": 46588, "score": 0.9627680182, "start": 46582, "tag": "NAME", "value": "Greach" }, { "context": "Gradle\" ]\n }\n , { name = \"Jazoon TechDays\"\n , link = \"http://jazoon.com/\"\n ", "end": 47026, "score": 0.9903710485, "start": 47011, "tag": "NAME", "value": "Jazoon TechDays" }, { "context": "\"Ember\" ]\n }\n , { name = \"AlterConf Minneapolis\"\n , link = \"http://www.alterconf.com", "end": 47470, "score": 0.9553243518, "start": 47449, "tag": "NAME", "value": "AlterConf Minneapolis" }, { "context": "Skills\" ]\n }\n , { name = \"MobCon\"\n , link = \"http://mobcon.com/mobcon", "end": 47938, "score": 0.8313794732, "start": 47932, "tag": "NAME", "value": "MobCon" }, { "context": "ndroid\" ]\n }\n , { name = \"Respond 2016\"\n , link = \"http://www.webdirectio", "end": 48389, "score": 0.8679497242, "start": 48379, "tag": "NAME", "value": "Respond 20" }, { "context": "ag \"UX\" ]\n }\n , { name = \"Yggdrasil\"\n , link = \"http://yggdrasilkonferan", "end": 48819, "score": 0.9574346542, "start": 48810, "tag": "NAME", "value": "Yggdrasil" }, { "context": "amming\" ]\n }\n , { name = \"CocoaConf Austin\"\n , link = \"http://cocoaconf.com/aus", "end": 53077, "score": 0.9905281067, "start": 53061, "tag": "NAME", "value": "CocoaConf Austin" }, { "context": " ]\n }\n , { name = \"Xamarin Evolve\"\n , link = \"https://evolve.xamarin.c", "end": 58978, "score": 0.576413095, "start": 58972, "tag": "NAME", "value": "Evolve" }, { "context": "g Data\" ]\n }\n , { name = \"TestIstanbul\"\n , link = \"http://testistanbul.org/", "end": 61943, "score": 0.9923322201, "start": 61931, "tag": "NAME", "value": "TestIstanbul" }, { "context": "esting\" ]\n }\n , { name = \"droidcon Zagreb\"\n , link = \"http://droidcon.hr/en/\"\n", "end": 62365, "score": 0.9991161227, "start": 62350, "tag": "NAME", "value": "droidcon Zagreb" }, { "context": " ]\n }\n , { name = \"Squares Conference\"\n , link = \"http://squaresconference", "end": 62801, "score": 0.5220517516, "start": 62791, "tag": "NAME", "value": "Conference" }, { "context": "DevOps\" ]\n }\n , { name = \"NSNorth\"\n , link = \"http://nsnorth.ca/\"", "end": 64473, "score": 0.7777658701, "start": 64471, "tag": "NAME", "value": "NS" }, { "context": "vOps\" ]\n }\n , { name = \"NSNorth\"\n , link = \"http://nsnorth.ca/\"\n ", "end": 64478, "score": 0.5098417401, "start": 64473, "tag": "USERNAME", "value": "North" }, { "context": "g \"IOS\" ]\n }\n , { name = \"YOW! Lambda Jam\"\n , link = \"http://lambdajam.yowconf", "end": 64883, "score": 0.8079386353, "start": 64868, "tag": "NAME", "value": "YOW! Lambda Jam" }, { "context": "amming\" ]\n }\n , { name = \"JSDayES\"\n , link = \"http://jsday.es/\"\n", "end": 65326, "score": 0.5822377205, "start": 65325, "tag": "NAME", "value": "J" }, { "context": "mming\" ]\n }\n , { name = \"JSDayES\"\n , link = \"http://jsday.es/\"\n ", "end": 65332, "score": 0.7094389796, "start": 65326, "tag": "USERNAME", "value": "SDayES" }, { "context": "\"Cocoa\" ]\n }\n , { name = \"SyntaxCon\"\n , link = \"http://2016.syntaxcon.co", "end": 70947, "score": 0.5953065157, "start": 70938, "tag": "NAME", "value": "SyntaxCon" }, { "context": "eral\" ]\n }\n , { name = \"!!Con\"\n , link = \"http://bangbangcon.com/\"", "end": 71354, "score": 0.5661218762, "start": 71351, "tag": "NAME", "value": "Con" }, { "context": "g Data\" ]\n }\n , { name = \"Beyond Tellerrand\"\n , link = \"http://beyondtellerrand.", "end": 72669, "score": 0.9997591972, "start": 72652, "tag": "NAME", "value": "Beyond Tellerrand" }, { "context": "Erlang\" ]\n }\n , { name = \"jsDay\"\n , link = \"http://2016.jsday.it/\"\n ", "end": 76131, "score": 0.9305558205, "start": 76126, "tag": "USERNAME", "value": "jsDay" }, { "context": "ag \"UX\" ]\n }\n , { name = \"droidcon Montreal\"\n , link = \"http://www.droidcon.ca/\"", "end": 81189, "score": 0.9997512698, "start": 81172, "tag": "NAME", "value": "droidcon Montreal" }, { "context": "Mobile\" ]\n }\n , { name = \"Valio Con\"\n , link = \"http://valiocon.com/\"\n ", "end": 82059, "score": 0.9992881417, "start": 82050, "tag": "NAME", "value": "Valio Con" }, { "context": "amming\" ]\n }\n , { name = \"UIKonf\"\n , link = \"http://www.uikonf.com/\"\n", "end": 83758, "score": 0.6515670419, "start": 83752, "tag": "USERNAME", "value": "UIKonf" }, { "context": " Conf\"\n , link = \"https://github.com/purescript/purescript/wiki/PureScript-Conf-2016\"\n ", "end": 88403, "score": 0.9407792091, "start": 88393, "tag": "USERNAME", "value": "purescript" }, { "context": "g \"IOS\" ]\n }\n , { name = \"LambdaConf\"\n , link = \"http://lambdaconf.us/\"\n ", "end": 90539, "score": 0.8085347414, "start": 90529, "tag": "NAME", "value": "LambdaConf" }, { "context": "g \"PHP\" ]\n }\n , { name = \"PyCon Tutorials\"\n , link = \"https://us.", "end": 91428, "score": 0.7230775952, "start": 91426, "tag": "NAME", "value": "Py" }, { "context": "Python\" ]\n }\n , { name = \"PyCon\"\n , link = \"https://us.pycon.org/201", "end": 91832, "score": 0.7425879836, "start": 91827, "tag": "NAME", "value": "PyCon" }, { "context": "g \"Git\" ]\n }\n , { name = \"MagmaConf\"\n , link = \"http://www.magma", "end": 93920, "score": 0.6268404126, "start": 93919, "tag": "NAME", "value": "M" }, { "context": " \"Git\" ]\n }\n , { name = \"MagmaConf\"\n , link = \"http://www.magmaconf.com", "end": 93928, "score": 0.8078168631, "start": 93920, "tag": "USERNAME", "value": "agmaConf" }, { "context": "anship\" ]\n }\n , { name = \"Web Rebels\"\n , link = \"https://www.webrebels.or", "end": 97697, "score": 0.9995343685, "start": 97687, "tag": "NAME", "value": "Web Rebels" }, { "context": "Script\" ]\n }\n , { name = \"Berlin Buzzwords\"\n , link = \"http://berlinbuzzwords.d", "end": 98536, "score": 0.999813199, "start": 98520, "tag": "NAME", "value": "Berlin Buzzwords" }, { "context": "eneral\" ]\n }\n , { name = \"droidcon Berlin\"\n , link = \"http://droidcon.de/\"\n ", "end": 102738, "score": 0.9975741506, "start": 102723, "tag": "NAME", "value": "droidcon Berlin" }, { "context": "eneral\" ]\n }\n , { name = \"Nordic Ruby\"\n , link = \"http://www.nordicruby.or", "end": 105703, "score": 0.8596997261, "start": 105692, "tag": "NAME", "value": "Nordic Ruby" }, { "context": "ps\" ]\n }\n , { name = \"Codemotion Dublin\"\n , link = \"http://dublin2016.codemo", "end": 107425, "score": 0.7721084356, "start": 107412, "tag": "NAME", "value": "motion Dublin" }, { "context": "uby\" ]\n }\n , { name = \"Web Design Day\"\n , link = \"http://webdesignday.com/", "end": 108265, "score": 0.6019124985, "start": 108255, "tag": "NAME", "value": "Design Day" }, { "context": "X\" ]\n }\n , { name = \"Dinosaur.js\"\n , link = \"http://dinosaurjs.org", "end": 108654, "score": 0.5070824027, "start": 108651, "tag": "NAME", "value": "aur" }, { "context": "Script\" ]\n }\n , { name = \"GIANT Conf\"\n , link = \"http://www.giantux.com/c", "end": 109080, "score": 0.950822413, "start": 109070, "tag": "NAME", "value": "GIANT Conf" }, { "context": "ag \"UX\" ]\n }\n , { name = \"You Gotta Love Frontend\"\n , link = \"http://y", "end": 109465, "score": 0.6908581257, "start": 109458, "tag": "NAME", "value": "You Got" }, { "context": "DevOps\" ]\n }\n , { name = \"Brighton Ruby\"\n , link = \"http://brightonruby.com/", "end": 112133, "score": 0.9998357892, "start": 112120, "tag": "NAME", "value": "Brighton Ruby" }, { "context": " \"Ruby\" ]\n }\n , { name = \"Chef Conf\"\n , link = \"https://www.chef.io/chef", "end": 112546, "score": 0.9991335869, "start": 112537, "tag": "NAME", "value": "Chef Conf" }, { "context": "DevOps\" ]\n }\n , { name = \"GopherCon\"\n , link = \"https://www.gophercon.co", "end": 112969, "score": 0.9998152256, "start": 112960, "tag": "NAME", "value": "GopherCon" }, { "context": "g \"PHP\" ]\n }\n , { name = \"Curry On\"\n , link = \"http://curry-on.org/2016", "end": 115485, "score": 0.9993681312, "start": 115477, "tag": "NAME", "value": "Curry On" }, { "context": "neral\" ]\n }\n , { name = \"UberConf\"\n , link = \"https://uberconf.com/con", "end": 115880, "score": 0.9007773399, "start": 115873, "tag": "NAME", "value": "berConf" }, { "context": "Ops\" ]\n }\n , { name = \"Midwest JS\"\n , link = \"http://midwestjs.com/", "end": 121592, "score": 0.6137788296, "start": 121588, "tag": "NAME", "value": "west" }, { "context": "botics\" ]\n }\n , { name = \"FP Conf\"\n , link = \"http://fpconf.org/\"\n ", "end": 122447, "score": 0.6434465647, "start": 122440, "tag": "NAME", "value": "FP Conf" }, { "context": "Script\" ]\n }\n , { name = \"React Rally\"\n , link = \"http://www.reactrally.co", "end": 124559, "score": 0.9990155697, "start": 124548, "tag": "NAME", "value": "React Rally" }, { "context": "\"Agile\" ]\n }\n , { name = \"ColdFront\"\n , link = \"https://2016.coldfrontco", "end": 126814, "score": 0.7899004817, "start": 126805, "tag": "NAME", "value": "ColdFront" }, { "context": "ft\" ]\n }\n , { name = \"RubyKaigi\"\n , link = \"http://rubykaigi.org/201", "end": 128966, "score": 0.6701882482, "start": 128961, "tag": "NAME", "value": "Kaigi" }, { "context": "\"IOS\" ]\n }\n , { name = \"Agile Prague\"\n , link = \"http://agileprague.com/\"", "end": 129796, "score": 0.9122723341, "start": 129786, "tag": "NAME", "value": "ile Prague" }, { "context": "\"Agile\" ]\n }\n , { name = \"SwanseaCon\"\n , link = \"http://swanseacon.co.uk/", "end": 130224, "score": 0.9667813778, "start": 130214, "tag": "NAME", "value": "SwanseaCon" }, { "context": "ag \"UX\" ]\n }\n , { name = \"Strangeloop\"\n , link = \"http://thestrangeloop.co", "end": 131538, "score": 0.9082445502, "start": 131527, "tag": "USERNAME", "value": "Strangeloop" }, { "context": "s\" ]\n }\n , { name = \"WindyCityThings\"\n , link = \"https://www.windyc", "end": 132409, "score": 0.4885621965, "start": 132405, "tag": "USERNAME", "value": "City" }, { "context": "\n }\n , { name = \"DrupalCon Dublin\"\n , link = \"https://events.drupal.or", "end": 141240, "score": 0.6182493567, "start": 141234, "tag": "NAME", "value": "Dublin" }, { "context": "DevOps\" ]\n }\n , { name = \"Jazoon TechDays\"\n , link = \"http://jazoon.com/\"\n ", "end": 142529, "score": 0.9983876348, "start": 142514, "tag": "NAME", "value": "Jazoon TechDays" }, { "context": "\"Cocoa\" ]\n }\n , { name = \"Beyond Tellerrand\"\n , link = \"http://beyondtellerrand.", "end": 149719, "score": 0.9935773015, "start": 149702, "tag": "NAME", "value": "Beyond Tellerrand" }, { "context": "evOps\" ]\n }\n , { name = \"droidconIN\"\n , link = \"https://droidcon.in/2016", "end": 150594, "score": 0.9655447006, "start": 150585, "tag": "USERNAME", "value": "roidconIN" }, { "context": "\"Cloud\" ]\n }\n , { name = \"JS Kongress Munich\"\n , link = \"http://js-kongress.de/\"\n", "end": 153061, "score": 0.993535459, "start": 153043, "tag": "NAME", "value": "JS Kongress Munich" }, { "context": " \".Net\" ]\n }\n , { name = \"Úll\"\n , link = \"http://2016.ull.ie/\"\n ", "end": 158903, "score": 0.990591228, "start": 158900, "tag": "NAME", "value": "Úll" }, { "context": "g \"IOS\" ]\n }\n , { name = \"Nantes FP Day\"\n , link = \"http://fpday.org/\"\n ", "end": 159300, "score": 0.9962568879, "start": 159287, "tag": "NAME", "value": "Nantes FP Day" }, { "context": "Script\" ]\n }\n , { name = \"CascadiaFest\"\n , link = \"http://2016.cascadiafest", "end": 161821, "score": 0.9983909726, "start": 161809, "tag": "NAME", "value": "CascadiaFest" }, { "context": "\"Agile\" ]\n }\n , { name = \"Valio Con\"\n , link = \"http://valiocon.com/\"\n ", "end": 166030, "score": 0.9709940553, "start": 166021, "tag": "NAME", "value": "Valio Con" }, { "context": "ag \"UX\" ]\n }\n , { name = \"JailbreakCon\"\n , link = \"http://www.jailbreakcon.", "end": 166418, "score": 0.796523571, "start": 166406, "tag": "NAME", "value": "JailbreakCon" }, { "context": "g \"IOS\" ]\n }\n , { name = \"DEF CON\"\n , link = \"https://www.defcon.org/\"", "end": 167221, "score": 0.7407431602, "start": 167214, "tag": "NAME", "value": "DEF CON" }, { "context": "curity\" ]\n }\n , { name = \"DerbyCon\"\n , link = \"https://www.derbycon.com", "end": 167627, "score": 0.9031329155, "start": 167619, "tag": "NAME", "value": "DerbyCon" }, { "context": "curity\" ]\n }\n , { name = \"CarolinaCon\"\n , link = \"http://www.carolinacon.o", "end": 170966, "score": 0.9993739128, "start": 170955, "tag": "NAME", "value": "CarolinaCon" }, { "context": "curity\" ]\n }\n , { name = \"THOTCON\"\n , link = \"http://thotcon.org/\"\n ", "end": 171371, "score": 0.99610883, "start": 171364, "tag": "NAME", "value": "THOTCON" } ]
frontend/src/InitialData.elm
robertjlooby/confsinfo
21
module InitialData exposing (model) import Conference import Date exposing (Month(..)) import FilteredTag import GenericSet import Model import Tag exposing (Tag(..)) model : Model.Model model = { conferences = GenericSet.fromList Conference.compareConferences [ { name = "@Swift" , link = "http://atswift.io/index-en.html" , startDate = ( 2016, Jan, 10 ) , endDate = ( 2016, Jan, 10 ) , location = "Beijing, China" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "China", Tag "Swift", Tag "IOS" ] } , { name = "NDC London Workshops" , link = "http://ndc-london.com/" , startDate = ( 2016, Jan, 11 ) , endDate = ( 2016, Jan, 12 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "NDC London" , link = "http://ndc-london.com/" , startDate = ( 2016, Jan, 13 ) , endDate = ( 2016, Jan, 15 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "Internet of Things Milan" , link = "https://www.mongodb.com/events/internet-of-things-milan" , startDate = ( 2016, Jan, 14 ) , endDate = ( 2016, Jan, 14 ) , location = "Milan, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "MongoDB", Tag "Big Data", Tag "Internet Of Things" ] } , { name = "JS Remote Conf" , link = "https://allremoteconfs.com/js-2016" , startDate = ( 2016, Jan, 14 ) , endDate = ( 2016, Jan, 16 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript" ] } , { name = "GR8Conf IN" , link = "http://gr8conf.in/" , startDate = ( 2016, Jan, 16 ) , endDate = ( 2016, Jan, 16 ) , location = "New Delhi, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "O'Reilly Design Conference" , link = "http://conferences.oreilly.com/design/ux-interaction-iot-us" , startDate = ( 2016, Jan, 20 ) , endDate = ( 2016, Jan, 22 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "SVG Summit" , link = "http://environmentsforhumans.com/2016/svg-summit/" , startDate = ( 2016, Jan, 21 ) , endDate = ( 2016, Jan, 21 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Remote", Tag "SVG" ] } , { name = "/dev/winter" , link = "http://devcycles.net/2016/winter/" , startDate = ( 2016, Jan, 23 ) , endDate = ( 2016, Jan, 23 ) , location = "Cambridge, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "DevOps", Tag "NoSQL", Tag "Functional Programming" ] } , { name = "PhoneGap Day" , link = "http://pgday.phonegap.com/us2016/" , startDate = ( 2016, Jan, 28 ) , endDate = ( 2016, Jan, 28 ) , location = "Lehi, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PhoneGap", Tag "Mobile" ] } , { name = "dotSwift" , link = "http://www.dotswift.io/" , startDate = ( 2016, Jan, 29 ) , endDate = ( 2016, Jan, 29 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Swift" ] } , { name = "PHPBenelux" , link = "http://conference.phpbenelux.eu/2016/" , startDate = ( 2016, Jan, 29 ) , endDate = ( 2016, Jan, 30 ) , location = "Antwerp, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "PHP" ] } , { name = "AlterConf D.C." , link = "http://www.alterconf.com/sessions/washington-dc" , startDate = ( 2016, Jan, 30 ) , endDate = ( 2016, Jan, 30 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "Diversity", Tag "Soft Skills" ] } , { name = "FOSDEM" , link = "https://fosdem.org/2016/" , startDate = ( 2016, Jan, 30 ) , endDate = ( 2016, Jan, 31 ) , location = "Brussels, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "Open Source", Tag "General" ] } , { name = "PgConf.Russia" , link = "https://pgconf.ru/" , startDate = ( 2016, Feb, 3 ) , endDate = ( 2016, Feb, 5 ) , location = "Moscow, Russia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Russian", Tag "Developers", Tag "Russia", Tag "PostgreSQL" ] } , { name = "Compose 2016" , link = "http://www.composeconference.org/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 5 ) , location = "Brooklyn, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming", Tag "Haskell", Tag "F#", Tag "OCaml", Tag "SML" ] } , { name = "RubyFuza" , link = "http://www.rubyfuza.org/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 5 ) , location = "Cape Town, South Africa" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "South Africa", Tag "Ruby" ] } , { name = "SunshinePHP" , link = "http://2016.sunshinephp.com/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 6 ) , location = "Miami, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP" ] } , { name = "The Microservices Conference" , link = "http://microxchg.io/2016/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 5 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Microservices" ] } , { name = "UX/DEV Summit" , link = "http://uxdsummit.com/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 6 ) , location = "Fort Lauderdale, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX", Tag "AngularJS", Tag "Ember", Tag "React" ] } , { name = "Forward JS Workshops" , link = "http://forwardjs.com/home" , startDate = ( 2016, Feb, 8 ) , endDate = ( 2016, Feb, 9 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "NodeJS" ] } , { name = "Jfokus" , link = "http://www.jfokus.se/jfokus/" , startDate = ( 2016, Feb, 8 ) , endDate = ( 2016, Feb, 10 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Java", Tag "General" ] } , { name = "Jfokus IoT" , link = "http://www.jfokus.se/iot/" , startDate = ( 2016, Feb, 8 ) , endDate = ( 2016, Feb, 10 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Internet Of Things" ] } , { name = "Webstock" , link = "http://www.webstock.org.nz/16/" , startDate = ( 2016, Feb, 9 ) , endDate = ( 2016, Feb, 12 ) , location = "Wellington, New Zealand" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "New Zealand", Tag "General" ] } , { name = "Forward JS" , link = "http://forwardjs.com/home" , startDate = ( 2016, Feb, 10 ) , endDate = ( 2016, Feb, 10 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "NodeJS" ] } , { name = "RubyConf Australia" , link = "http://www.rubyconf.org.au/2016" , startDate = ( 2016, Feb, 10 ) , endDate = ( 2016, Feb, 13 ) , location = "Gold Coast, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Ruby" ] } , { name = "Clojure Remote" , link = "http://clojureremote.com/" , startDate = ( 2016, Feb, 11 ) , endDate = ( 2016, Feb, 12 ) , location = "Remote" , cfpStartDate = Just ( 2015, Oct, 30 ) , cfpEndDate = Just ( 2015, Dec, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Clojure", Tag "Functional Programming" ] } , { name = "Forward JS Workshops" , link = "http://forwardjs.com/home" , startDate = ( 2016, Feb, 11 ) , endDate = ( 2016, Feb, 13 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "NodeJS" ] } , { name = "DeveloperWeek" , link = "http://www.developerweek.com/" , startDate = ( 2016, Feb, 12 ) , endDate = ( 2016, Feb, 18 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Nov, 23 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "NodeJS", Tag "Python", Tag "PHP", Tag "DevOps", Tag "Ruby", Tag "Mobile", Tag "NoSQL", Tag "General" ] } , { name = "DevNexus" , link = "http://devnexus.com/s/index" , startDate = ( 2016, Feb, 15 ) , endDate = ( 2016, Feb, 17 ) , location = "Atlanta, GA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Agile", Tag "Big Data", Tag "Java", Tag "JavaScript", Tag "General" ] } , { name = "Spark Summit East" , link = "https://spark-summit.org/east-2016/" , startDate = ( 2016, Feb, 16 ) , endDate = ( 2016, Feb, 18 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data" ] } , { name = "Elastic{ON}" , link = "https://www.elastic.co/elasticon" , startDate = ( 2016, Feb, 17 ) , endDate = ( 2016, Feb, 19 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Nov, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "MongoDB", Tag "Big Data", Tag "Elasticsearch", Tag "Logstash" ] } , { name = "DrupalCon Asia" , link = "https://events.drupal.org/asia2016" , startDate = ( 2016, Feb, 18 ) , endDate = ( 2016, Feb, 21 ) , location = "Mumbai, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Nov, 2 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Drupal", Tag "PHP" ] } , { name = "hello.js" , link = "http://hellojs.org/" , startDate = ( 2016, Feb, 18 ) , endDate = ( 2016, Feb, 19 ) , location = "Cluj-Napoca, Romania" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Romania", Tag "JavaScript" ] } , { name = "Lambda Days" , link = "http://www.lambdadays.org/" , startDate = ( 2016, Feb, 18 ) , endDate = ( 2016, Feb, 19 ) , location = "Krakow, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Functional Programming", Tag "Erlang" ] } , { name = "BOB 2016" , link = "http://bobkonf.de/2016/en/" , startDate = ( 2016, Feb, 19 ) , endDate = ( 2016, Feb, 19 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "German", Tag "Developers", Tag "Germany", Tag "Functional Programming", Tag "Clojure", Tag "Haskell", Tag "Scala", Tag "Erlang" ] } , { name = "GopherCon India" , link = "http://www.gophercon.in/" , startDate = ( 2016, Feb, 19 ) , endDate = ( 2016, Feb, 10 ) , location = "Bengaluru, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Go" ] } , { name = "Bulgaria Web Summit" , link = "http://bulgariawebsummit.com/" , startDate = ( 2016, Feb, 20 ) , endDate = ( 2016, Feb, 20 ) , location = "Sofia, Bulgaria" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Bulgaria", Tag "UX", Tag "JavaScript", Tag "General" ] } , { name = ":clojureD" , link = "http://www.clojured.de/" , startDate = ( 2016, Feb, 20 ) , endDate = ( 2016, Feb, 20 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Functional Programming", Tag "Clojure" ] } , { name = "The Rolling Scopes Conference" , link = "http://2016.conf.rollingscopes.com/" , startDate = ( 2016, Feb, 20 ) , endDate = ( 2016, Feb, 21 ) , location = "Minsk, Belarus" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Russian", Tag "Developers", Tag "Belarus", Tag "CSS", Tag "NodeJS", Tag "JavaScript" ] } , { name = "How.Camp" , link = "http://how.camp/" , startDate = ( 2016, Feb, 21 ) , endDate = ( 2016, Feb, 21 ) , location = "Sofia, Bulgaria" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Bulgaria", Tag "UX", Tag "JavaScript" ] } , { name = "React.js Conf" , link = "http://conf.reactjs.com/" , startDate = ( 2016, Feb, 22 ) , endDate = ( 2016, Feb, 23 ) , location = "San Francisco, CA" , cfpStartDate = Just ( 2015, Nov, 25 ) , cfpEndDate = Just ( 2015, Dec, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "React", Tag "JavaScript" ] } , { name = "GopherCon Dubai" , link = "http://www.gophercon.ae/" , startDate = ( 2016, Feb, 23 ) , endDate = ( 2016, Feb, 23 ) , location = "Dubai, UAE" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "Go" ] } , { name = "JavaScript Summit" , link = "http://environmentsforhumans.com/2016/javascript-summit/" , startDate = ( 2016, Feb, 23 ) , endDate = ( 2016, Feb, 23 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript" ] } , { name = "UXistanbul" , link = "http://uxistanbul.org/" , startDate = ( 2016, Feb, 23 ) , endDate = ( 2016, Feb, 23 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Turkey", Tag "UX" ] } , { name = "ConFoo" , link = "http://confoo.ca/en" , startDate = ( 2016, Feb, 24 ) , endDate = ( 2016, Feb, 26 ) , location = "Montreal, QC, Canada" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "French", Tag "Developers", Tag "Canada", Tag "General" ] } , { name = "Freelance Remote Conf" , link = "https://allremoteconfs.com/freelance-2016" , startDate = ( 2016, Feb, 24 ) , endDate = ( 2016, Feb, 26 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Designers", Tag "Remote", Tag "General", Tag "Soft Skills" ] } , { name = "UX Riga" , link = "http://www.uxriga.lv/" , startDate = ( 2016, Feb, 25 ) , endDate = ( 2016, Feb, 25 ) , location = "Riga, Latvia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Latvia", Tag "UX" ] } , { name = "Interaction 16" , link = "http://interaction16.ixda.org/" , startDate = ( 2016, Mar, 1 ) , endDate = ( 2016, Mar, 4 ) , location = "Helsinki, Finland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Finland", Tag "UX" ] } , { name = "try! Swift" , link = "http://www.tryswiftconf.com/en" , startDate = ( 2016, Mar, 2 ) , endDate = ( 2016, Mar, 4 ) , location = "Tokyo, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Swift", Tag "IOS" ] } , { name = "EnhanceConf" , link = "http://enhanceconf.com/" , startDate = ( 2016, Mar, 3 ) , endDate = ( 2016, Mar, 4 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "CSS", Tag "JavaScript", Tag "Progressive Enhancement" ] } , { name = "fsharpConf" , link = "http://fsharpconf.com/" , startDate = ( 2016, Mar, 4 ) , endDate = ( 2016, Mar, 4 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "F#", Tag ".Net", Tag "Functional Programming" ] } , { name = "Chamberconf" , link = "http://chamberconf.pl/" , startDate = ( 2016, Mar, 5 ) , endDate = ( 2016, Mar, 6 ) , location = "Moszna, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Polish", Tag "Developers", Tag "Poland", Tag "General" ] } , { name = "droidcon Tunisia" , link = "http://www.droidcon.tn/" , startDate = ( 2016, Mar, 5 ) , endDate = ( 2016, Mar, 6 ) , location = "Hammamet, Tunisia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Tunisia", Tag "Android", Tag "Mobile" ] } , { name = "Frontend Conference" , link = "http://kfug.jp/frontconf2016/" , startDate = ( 2016, Mar, 5 ) , endDate = ( 2016, Mar, 5 ) , location = "Osaka, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Japanese", Tag "Designers", Tag "Developers", Tag "Japan", Tag "UX", Tag "JavaScript", Tag "CSS", Tag "AngularJS" ] } , { name = "Big Data Paris" , link = "http://www.bigdataparis.com/" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 8 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "French", Tag "Developers", Tag "France", Tag "MongoDB", Tag "Big Data" ] } , { name = "Erlang Factory SF Workshops" , link = "http://www.erlang-factory.com/sfbay2016/home" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 9 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Erlang" ] } , { name = "Fluent Conf Trainings" , link = "http://conferences.oreilly.com/fluent/javascript-html-us" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 8 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "CSS", Tag "JavaScript", Tag "UX", Tag "React", Tag "AngularJS", Tag "Docker" ] } , { name = "QCon London" , link = "http://qconlondon.com/" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 9 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "Fluent Conf" , link = "http://conferences.oreilly.com/fluent/javascript-html-us" , startDate = ( 2016, Mar, 8 ) , endDate = ( 2016, Mar, 10 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "CSS", Tag "JavaScript", Tag "UX", Tag "React", Tag "AngularJS", Tag "Docker" ] } , { name = "jDays" , link = "http://www.jdays.se/" , startDate = ( 2016, Mar, 8 ) , endDate = ( 2016, Mar, 9 ) , location = "Gothenburg, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Java" ] } , { name = "Apache Geode Summit" , link = "http://geodesummit.com/" , startDate = ( 2016, Mar, 9 ) , endDate = ( 2016, Mar, 9 ) , location = "Palo Alto, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data", Tag "Cloud" ] } , { name = "Erlang Factory SF" , link = "http://www.erlang-factory.com/sfbay2016/home" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 11 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Erlang" ] } , { name = "ScaleConf" , link = "http://scaleconf.org/" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 11 ) , location = "Cape Town, South Africa" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "South Africa", Tag "Scalability" ] } , { name = "SoCraTes ES" , link = "http://www.socrates-conference.es/doku.php" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 13 ) , location = "Gran Canaria, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Software Craftsmanship" ] } , { name = "QCon London Tutorials" , link = "http://qconlondon.com/" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 11 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "Bath Ruby" , link = "http://bathruby.us1.list-manage1.com/subscribe?u=f18bb7508370614edaffb50dd&id=73743da027" , startDate = ( 2016, Mar, 11 ) , endDate = ( 2016, Mar, 11 ) , location = "Bath, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Ruby" ] } , { name = "RWDevCon 2016" , link = "http://rwdevcon.com/" , startDate = ( 2016, Mar, 11 ) , endDate = ( 2016, Mar, 12 ) , location = "Alexandria, VA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Swift" ] } , { name = "wroc_love.rb" , link = "http://www.wrocloverb.com/" , startDate = ( 2016, Mar, 11 ) , endDate = ( 2016, Mar, 13 ) , location = "Wroclaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Ruby" ] } , { name = "JSConf Beirut" , link = "http://www.jsconfbeirut.com/" , startDate = ( 2016, Mar, 12 ) , endDate = ( 2016, Mar, 13 ) , location = "Beirut, Lebanon" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Lebanon", Tag "JavaScript" ] } , { name = "An Event Apart Nashville" , link = "http://aneventapart.com/event/nashville-2016" , startDate = ( 2016, Mar, 14 ) , endDate = ( 2016, Mar, 16 ) , location = "Nashville, TN" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "CocoaConf Yosemite" , link = "http://cocoaconf.com/yosemite" , startDate = ( 2016, Mar, 14 ) , endDate = ( 2016, Mar, 17 ) , location = "National Park, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Cocoa" ] } , { name = "Erlang Factory SF Workshops" , link = "http://www.erlang-factory.com/sfbay2016/home" , startDate = ( 2016, Mar, 14 ) , endDate = ( 2016, Mar, 16 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Erlang" ] } , { name = "Smashing Conf" , link = "http://smashingconf.com/" , startDate = ( 2016, Mar, 15 ) , endDate = ( 2016, Mar, 16 ) , location = "Oxford, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "UX" ] } , { name = "DIBI" , link = "http://dibiconference.com/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 18 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Scotland", Tag "UX" ] } , { name = "droidcon San Francisco" , link = "http://sf.droidcon.com/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 18 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Android", Tag "Mobile" ] } , { name = "mdevcon" , link = "http://mdevcon.com/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 18 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Just ( 2015, Nov, 8 ) , cfpEndDate = Just ( 2015, Dec, 23 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "Mobile", Tag "IOS", Tag "Android" ] } , { name = "Nordic PGDay" , link = "http://2016.nordicpgday.org/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 17 ) , location = "Helsinki, Finland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Finland", Tag "PostgreSQL" ] } , { name = "pgDay Asia" , link = "http://2016.pgday.asia/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 19 ) , location = "Singapore" , cfpStartDate = Just ( 2015, Nov, 26 ) , cfpEndDate = Just ( 2016, Jan, 22 ) , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "PostgreSQL" ] } , { name = "Codemotion Rome" , link = "http://rome2016.codemotionworld.com/" , startDate = ( 2016, Mar, 18 ) , endDate = ( 2016, Mar, 19 ) , location = "Rome, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "General" ] } , { name = "Scale Summit" , link = "http://www.scalesummit.org/" , startDate = ( 2016, Mar, 18 ) , endDate = ( 2016, Mar, 18 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Scalability" ] } , { name = "Dutch Clojure Days" , link = "http://clojure.org/events/2016/dutch_clojure_days" , startDate = ( 2016, Mar, 19 ) , endDate = ( 2016, Mar, 19 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 23 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "Clojure", Tag "Functional Programming" ] } , { name = "GR8Day Warsaw" , link = "http://warsaw.gr8days.pl/" , startDate = ( 2016, Mar, 19 ) , endDate = ( 2016, Mar, 19 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "RubyConf India" , link = "http://rubyconfindia.org/" , startDate = ( 2016, Mar, 19 ) , endDate = ( 2016, Mar, 20 ) , location = "Kochi, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Ruby" ] } , { name = "SwiftAveiro" , link = "https://attending.io/events/swiftaveiro" , startDate = ( 2016, Mar, 20 ) , endDate = ( 2016, Mar, 20 ) , location = "Aveiro, Portugal" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Portugal", Tag "IOS", Tag "Swift" ] } , { name = "MountainWest RubyConf" , link = "http://mtnwestrubyconf.org/2016/" , startDate = ( 2016, Mar, 21 ) , endDate = ( 2016, Mar, 22 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "PIPELINE" , link = "http://web.pipelineconf.info/" , startDate = ( 2016, Mar, 23 ) , endDate = ( 2016, Mar, 23 ) , location = "London, England" , cfpStartDate = Just ( 2015, Oct, 19 ) , cfpEndDate = Just ( 2015, Dec, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile" ] } , { name = "Ruby Remote Conf" , link = "https://allremoteconfs.com/ruby-2016" , startDate = ( 2016, Mar, 23 ) , endDate = ( 2016, Mar, 25 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Ruby" ] } , { name = "CocoaConf Chicago" , link = "http://cocoaconf.com/chicago-2016/home" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 26 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "CSS Day" , link = "http://2016.cssday.it/" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 25 ) , location = "Faenza, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Italian", Tag "Designers", Tag "Italy", Tag "CSS" ] } , { name = "DevExperience" , link = "http://devexperience.ro/" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 25 ) , location = "Lasi, Romania" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Romania", Tag "General" ] } , { name = "droidcon Dubai" , link = "http://droidcon.ae/" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 26 ) , location = "Dubai, UAE" , cfpStartDate = Just ( 2015, Oct, 27 ) , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "Android", Tag "Mobile" ] } , { name = "Space City JS" , link = "http://spacecity.codes/" , startDate = ( 2016, Mar, 26 ) , endDate = ( 2016, Mar, 26 ) , location = "Houston, TX" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "EmberConf" , link = "http://emberconf.com/" , startDate = ( 2016, Mar, 29 ) , endDate = ( 2016, Mar, 30 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ember" ] } , { name = "RWD Summit" , link = "http://environmentsforhumans.com/2016/responsive-web-design-summit/" , startDate = ( 2016, Mar, 29 ) , endDate = ( 2016, Mar, 31 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Remote", Tag "CSS", Tag "UX" ] } , { name = "Clarity Conf" , link = "http://clarityconf.com/" , startDate = ( 2016, Mar, 31 ) , endDate = ( 2016, Apr, 1 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Ruby on Ales" , link = "https://ruby.onales.com/" , startDate = ( 2016, Mar, 31 ) , endDate = ( 2016, Apr, 1 ) , location = "Bend, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "Codemotion Dubai" , link = "http://rome2016.codemotionworld.com/" , startDate = ( 2016, Apr, 1 ) , endDate = ( 2016, Apr, 2 ) , location = "Dubai, UAE" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "General" ] } , { name = "Flourish!" , link = "http://flourishconf.com/2016/" , startDate = ( 2016, Apr, 1 ) , endDate = ( 2016, Apr, 2 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source" ] } , { name = "Fronteers Spring Thing" , link = "https://fronteers.nl/spring" , startDate = ( 2016, Apr, 1 ) , endDate = ( 2016, Apr, 1 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "JavaScript" ] } , { name = "An Event Apart Seattle" , link = "http://aneventapart.com/event/seattle-2016" , startDate = ( 2016, Apr, 4 ) , endDate = ( 2016, Apr, 6 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Istanbul Tech Talks" , link = "http://www.istanbultechtalks.com/" , startDate = ( 2016, Apr, 5 ) , endDate = ( 2016, Apr, 5 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Turkey", Tag "General" ] } , { name = "Smashing Conf SF" , link = "http://smashingconf.com/sf-2016/" , startDate = ( 2016, Apr, 5 ) , endDate = ( 2016, Apr, 6 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Ancient City Ruby" , link = "http://www.ancientcityruby.com/" , startDate = ( 2016, Apr, 6 ) , endDate = ( 2016, Apr, 8 ) , location = "St. Augustine, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "AWS Summit Bogotá" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 6 ) , endDate = ( 2016, Apr, 6 ) , location = "Bogotá, Colombia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Colombia", Tag "AWS", Tag "DevOps" ] } , { name = "droidcon Italy" , link = "http://it.droidcon.com/2016/" , startDate = ( 2016, Apr, 7 ) , endDate = ( 2016, Apr, 8 ) , location = "Turin, Italy" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "Android", Tag "Mobile" ] } , { name = "Respond 2016 Sydney" , link = "http://www.webdirections.org/respond16/" , startDate = ( 2016, Apr, 7 ) , endDate = ( 2016, Apr, 8 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "CSS", Tag "UX" ] } , { name = "RubyConf Philippines" , link = "http://rubyconf.ph/" , startDate = ( 2016, Apr, 7 ) , endDate = ( 2016, Apr, 9 ) , location = "Taguig, Philippines" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Philippines", Tag "Ruby" ] } , { name = "Greach" , link = "http://greachconf.com/" , startDate = ( 2016, Apr, 8 ) , endDate = ( 2016, Apr, 9 ) , location = "Madrid, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "Jazoon TechDays" , link = "http://jazoon.com/" , startDate = ( 2016, Apr, 8 ) , endDate = ( 2016, Apr, 8 ) , location = "Bern, Switzerland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Switzerland", Tag "JavaScript", Tag "AngularJS", Tag "Ember" ] } , { name = "AlterConf Minneapolis" , link = "http://www.alterconf.com/sessions/minneapolis-mn" , startDate = ( 2016, Apr, 9 ) , endDate = ( 2016, Apr, 9 ) , location = "Minneapolis, MN" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 1 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "Diversity", Tag "Soft Skills" ] } , { name = "MobCon" , link = "http://mobcon.com/mobcon-europe/" , startDate = ( 2016, Apr, 10 ) , endDate = ( 2016, Apr, 10 ) , location = "Sofia, Bulgaria" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "Bulgaria", Tag "Mobile", Tag "IOS", Tag "Android" ] } , { name = "Respond 2016" , link = "http://www.webdirections.org/respond16/" , startDate = ( 2016, Apr, 11 ) , endDate = ( 2016, Apr, 12 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "CSS", Tag "UX" ] } , { name = "Yggdrasil" , link = "http://yggdrasilkonferansen.no/" , startDate = ( 2016, Apr, 11 ) , endDate = ( 2016, Apr, 12 ) , location = "Sandefjord, Norway" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Norwegian", Tag "Designers", Tag "Norway", Tag "UX" ] } , { name = "AWS Summit Berlin" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 12 ) , endDate = ( 2016, Apr, 12 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "AWS", Tag "DevOps" ] } , { name = "Converge SE" , link = "http://convergese.com/" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 15 ) , location = "Columbia, SC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "Hadoop Summit Europe" , link = "http://2016.hadoopsummit.org/dublin/" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 14 ) , location = "Dublin, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "Hadoop", Tag "Big Data", Tag "Internet Of Things" ] } , { name = "iOS Remote Conf" , link = "https://allremoteconfs.com/ios-2016" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 15 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "IOS" ] } , { name = "Peers Conference" , link = "http://peersconf.com/" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 15 ) , location = "St. Petersburg, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "Soft Skills" ] } , { name = "ACE! Conference" , link = "http://aceconf.com/" , startDate = ( 2016, Apr, 14 ) , endDate = ( 2016, Apr, 15 ) , location = "Krakow, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Agile", Tag "Software Craftsmanship" ] } , { name = "AWS Summit Milan" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 14 ) , endDate = ( 2016, Apr, 14 ) , location = "Milan, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "AWS", Tag "DevOps" ] } , { name = "Rootconf" , link = "https://rootconf.in/2016/" , startDate = ( 2016, Apr, 14 ) , endDate = ( 2016, Apr, 15 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "DevOps", Tag "Cloud" ] } , { name = "Clojure/west" , link = "http://clojurewest.org/" , startDate = ( 2016, Apr, 15 ) , endDate = ( 2016, Apr, 16 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Clojure", Tag "Functional Programming" ] } , { name = "CocoaConf Austin" , link = "http://cocoaconf.com/austin-2016/home" , startDate = ( 2016, Apr, 15 ) , endDate = ( 2016, Apr, 16 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "JSConf Uruguay" , link = "https://jsconf.uy/" , startDate = ( 2016, Apr, 15 ) , endDate = ( 2016, Apr, 16 ) , location = "Montevideo, Uruguay" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Uruguay", Tag "JavaScript" ] } , { name = "Scalar" , link = "http://scalar-conf.com/" , startDate = ( 2016, Apr, 16 ) , endDate = ( 2016, Apr, 16 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Scala" ] } , { name = "JavaScript Frameworks Day" , link = "http://frameworksdays.com/event/js-frameworks-day-2016" , startDate = ( 2016, Apr, 17 ) , endDate = ( 2016, Apr, 17 ) , location = "Kiev, Ukraine" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Russian", Tag "Developers", Tag "Ukraine", Tag "JavaScript" ] } , { name = "AWS Summit Chicago" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 18 ) , endDate = ( 2016, Apr, 19 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "PGConf US" , link = "http://www.pgconf.us/2016/" , startDate = ( 2016, Apr, 18 ) , endDate = ( 2016, Apr, 20 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PostgreSQL" ] } , { name = "ACCU" , link = "http://accu.org/index.php/conferences/accu_conference_2016" , startDate = ( 2016, Apr, 19 ) , endDate = ( 2016, Apr, 23 ) , location = "Bristol, England" , cfpStartDate = Just ( 2015, Oct, 12 ) , cfpEndDate = Just ( 2015, Nov, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General", Tag "C++" ] } , { name = "Industry Conf" , link = "http://2016.industryconf.com/" , startDate = ( 2016, Apr, 20 ) , endDate = ( 2016, Apr, 20 ) , location = "Newcastle, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "CycleConf" , link = "http://cycleconf.com/" , startDate = ( 2016, Apr, 21 ) , endDate = ( 2016, Apr, 24 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Denmark", Tag "CycleJS", Tag "JavaScript" ] } , { name = "MCE" , link = "http://mceconf.com/" , startDate = ( 2016, Apr, 21 ) , endDate = ( 2016, Apr, 22 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Poland", Tag "Mobile", Tag "UX" ] } , { name = "Render Conf" , link = "http://2016.render-conf.com/" , startDate = ( 2016, Apr, 21 ) , endDate = ( 2016, Apr, 22 ) , location = "Oxford, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "England", Tag "CSS", Tag "JavaScript", Tag "UX" ] } , { name = "dotSecurity" , link = "http://www.dotsecurity.io/" , startDate = ( 2016, Apr, 22 ) , endDate = ( 2016, Apr, 22 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Security" ] } , { name = "Generate NY" , link = "http://generateconf.com/new-york-2016" , startDate = ( 2016, Apr, 22 ) , endDate = ( 2016, Apr, 22 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "ProgSCon" , link = "http://progscon.co.uk/" , startDate = ( 2016, Apr, 22 ) , endDate = ( 2016, Apr, 22 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 21 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "Xamarin Evolve" , link = "https://evolve.xamarin.com/" , startDate = ( 2016, Apr, 24 ) , endDate = ( 2016, Apr, 28 ) , location = "Orlando, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Mobile", Tag "IOS", Tag "Android", Tag ".Net" ] } , { name = "dotScale" , link = "http://www.dotscale.io/" , startDate = ( 2016, Apr, 25 ) , endDate = ( 2016, Apr, 25 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Scalability" ] } , { name = "OpenVis Conf" , link = "https://openvisconf.com/" , startDate = ( 2016, Apr, 25 ) , endDate = ( 2016, Apr, 26 ) , location = "Boston, MA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "DataVisualization" ] } , { name = "AWS Summit Kuala Lumpur" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 26 ) , location = "Kuala Lumpur, Malaysia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Malaysia", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Sydney" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 28 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "AWS", Tag "DevOps" ] } , { name = "Craft Conf" , link = "http://craft-conf.com/2016" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 29 ) , location = "Budapest, Hungary" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Hungary", Tag "Software Craftsmanship" ] } , { name = "Kafka Summit" , link = "http://kafka-summit.org/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 26 ) , location = "San Francisco, CA" , cfpStartDate = Just ( 2015, Sep, 29 ) , cfpEndDate = Just ( 2016, Jan, 11 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data" ] } , { name = "TestIstanbul" , link = "http://testistanbul.org/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 26 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Turkish", Tag "Developers", Tag "Turkey", Tag "Testing" ] } , { name = "droidcon Zagreb" , link = "http://droidcon.hr/en/" , startDate = ( 2016, Apr, 27 ) , endDate = ( 2016, Apr, 29 ) , location = "Zagreb, Croatia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Croatia", Tag "Android", Tag "Mobile" ] } , { name = "Squares Conference" , link = "http://squaresconference.com/" , startDate = ( 2016, Apr, 27 ) , endDate = ( 2016, Apr, 29 ) , location = "Grapevine, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "University of Illinois WebCon" , link = "http://webcon.illinois.edu/" , startDate = ( 2016, Apr, 27 ) , endDate = ( 2016, Apr, 28 ) , location = "Champaign, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "AWS Summit Buenos Aires" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 28 ) , location = "Buenos Aires, Argentina" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Argentina", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Singapore" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 28 ) , location = "Singapore" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "AWS", Tag "DevOps" ] } , { name = "NSNorth" , link = "http://nsnorth.ca/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 30 ) , location = "Toronto, Ontario, Canada" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "IOS" ] } , { name = "YOW! Lambda Jam" , link = "http://lambdajam.yowconference.com.au/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 29 ) , location = "Brisbane, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Functional Programming" ] } , { name = "JSDayES" , link = "http://jsday.es/" , startDate = ( 2016, Apr, 29 ) , endDate = ( 2016, Apr, 30 ) , location = "Madrid, Spain" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "Spanish", Tag "Developers", Tag "Spain", Tag "JavaScript", Tag "NodeJS", Tag "AngularJS" ] } , { name = "Chicago Code Camp" , link = "http://www.chicagocodecamp.com/" , startDate = ( 2016, Apr, 30 ) , endDate = ( 2016, Apr, 30 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "flatMap(Oslo)" , link = "http://2016.flatmap.no/" , startDate = ( 2016, May, 2 ) , endDate = ( 2016, May, 3 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 3 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Scala", Tag "Functional Programming", Tag "Java" ] } , { name = "AWS Summit Santiago" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 3 ) , location = "Santiago, Chile" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Chile", Tag "AWS", Tag "DevOps" ] } , { name = "Continuous Lifecycle London" , link = "http://continuouslifecycle.london/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 5 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "DevOps" ] } , { name = "JSConf Belgium" , link = "https://jsconf.be/nl/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 3 ) , location = "Brugge, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "JavaScript" ] } , { name = "YOW! West" , link = "http://west.yowconference.com.au/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 4 ) , location = "Perth, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "General" ] } , { name = "ng-conf" , link = "http://www.ng-conf.org/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 6 ) , location = "Salt Lake City, UT" , cfpStartDate = Just ( 2016, Jan, 13 ) , cfpEndDate = Just ( 2016, Feb, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS" ] } , { name = "AWS Summit Stockholm" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 4 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "AWS", Tag "DevOps" ] } , { name = "RailsConf" , link = "http://railsconf.com/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 6 ) , location = "Kansas City, MO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby", Tag "Rails" ] } , { name = "Typelevel Summit" , link = "http://typelevel.org/event/2016-05-summit-oslo/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 4 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 3 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Scala", Tag "Functional Programming", Tag "Java" ] } , { name = "AWS Summit Manila" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 5 ) , endDate = ( 2016, May, 5 ) , location = "Manila, Philippines" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Philippines", Tag "AWS", Tag "DevOps" ] } , { name = "CocoaConf Seattle" , link = "http://cocoaconf.com/seattle-2016/home" , startDate = ( 2016, May, 6 ) , endDate = ( 2016, May, 7 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Cocoa" ] } , { name = "SyntaxCon" , link = "http://2016.syntaxcon.com/" , startDate = ( 2016, May, 6 ) , endDate = ( 2016, May, 7 ) , location = "Charleston, SC" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "!!Con" , link = "http://bangbangcon.com/" , startDate = ( 2016, May, 7 ) , endDate = ( 2016, May, 8 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "9th European Lisp Symposium" , link = "http://www.european-lisp-symposium.org/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 10 ) , location = "Krakow, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 19 ) , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Lisp", Tag "Clojure" ] } , { name = "Apache: Big Data North America" , link = "http://www.apachecon.com/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "Vancouver, BC, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Big Data" ] } , { name = "Beyond Tellerrand" , link = "http://beyondtellerrand.com/events/duesseldorf-2016" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "Düsseldorf, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Germany", Tag "UX", Tag "General" ] } , { name = "C++Now" , link = "http://cppnow.org/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 14 ) , location = "Aspen, CO" , cfpStartDate = Just ( 2015, Nov, 17 ) , cfpEndDate = Just ( 2016, Jan, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "C++" ] } , { name = "ChefConf" , link = "https://www.chef.io/chefconf/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Chef", Tag "DevOps" ] } , { name = "DrupalCon New Orleans" , link = "https://events.drupal.org/neworleans2016/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 13 ) , location = "New Orleans, LA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Drupal", Tag "PHP" ] } , { name = "Scala Days New York" , link = "http://event.scaladays.org/scaladays-nyc-2016" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Scala" ] } , { name = "Codemotion Amsterdam" , link = "http://amsterdam2016.codemotionworld.com/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 12 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "CSSConf Budapest" , link = "http://cssconfbp.rocks/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 11 ) , location = "Budapest, Hungary" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Hungary", Tag "CSS" ] } , { name = "ElixirConf EU" , link = "http://www.elixirconf.eu/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 12 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Elixir", Tag "Functional Programming", Tag "Erlang" ] } , { name = "jsDay" , link = "http://2016.jsday.it/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 12 ) , location = "Verona, Italy" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "JavaScript" ] } , { name = "React Remote Conf" , link = "https://allremoteconfs.com/react-2016" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 13 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 9 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript", Tag "React" ] } , { name = "UX Alive" , link = "http://www.uxalive.com/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 13 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Turkey", Tag "UX" ] } , { name = "ApacheCon Core North America" , link = "http://www.apachecon.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Vancouver, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Open Source" ] } , { name = "Front Conference" , link = "http://www.frontutah.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "JSConf Budapest" , link = "http://jsconfbp.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Budapest, Hungary" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Hungary", Tag "JavaScript" ] } , { name = "An Event Apart Boston" , link = "http://aneventapart.com/event/boston-2016" , startDate = ( 2016, May, 16 ) , endDate = ( 2016, May, 18 ) , location = "Boston, MA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Open Source Convention Tutorials" , link = "http://conferences.oreilly.com/oscon/open-source" , startDate = ( 2016, May, 16 ) , endDate = ( 2016, May, 17 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source" ] } , { name = "AWS Summit Seoul" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 17 ) , endDate = ( 2016, May, 17 ) , location = "Seoul, South Korea" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "South Korea", Tag "AWS", Tag "DevOps" ] } , { name = "Front-Trends" , link = "http://2016.front-trends.com/" , startDate = ( 2016, May, 18 ) , endDate = ( 2016, May, 20 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 4 ) , tags = [ Tag "English", Tag "Designers", Tag "Poland", Tag "UX" ] } , { name = "Open Source Convention" , link = "http://conferences.oreilly.com/oscon/open-source" , startDate = ( 2016, May, 18 ) , endDate = ( 2016, May, 19 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source" ] } , { name = "UX London" , link = "http://2016.uxlondon.com/" , startDate = ( 2016, May, 18 ) , endDate = ( 2016, May, 20 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "UX" ] } , { name = "droidcon Montreal" , link = "http://www.droidcon.ca/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 20 ) , location = "Montreal, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 4 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Android", Tag "Mobile" ] } , { name = "PhoneGap Day EU" , link = "http://pgday.phonegap.com/eu2016/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 20 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "PhoneGap", Tag "Mobile" ] } , { name = "Valio Con" , link = "http://valiocon.com/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 22 ) , location = "San Diego, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "AWS Summit Taipei" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 20 ) , endDate = ( 2016, May, 20 ) , location = "Taipei, Taiwan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Taiwan", Tag "AWS", Tag "DevOps" ] } , { name = "self.conference" , link = "http://selfconference.org/" , startDate = ( 2016, May, 20 ) , endDate = ( 2016, May, 21 ) , location = "Detroit, MI" , cfpStartDate = Just ( 2016, Jan, 18 ) , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "General", Tag "Soft Skills" ] } , { name = "EmpEx" , link = "http://empex.co/" , startDate = ( 2016, May, 21 ) , endDate = ( 2016, May, 21 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Mar, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Elixir", Tag "Functional Programming" ] } , { name = "UIKonf" , link = "http://www.uikonf.com/" , startDate = ( 2016, May, 22 ) , endDate = ( 2016, May, 25 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "IOS" ] } , { name = "GOTO Chicago Workshops" , link = "http://gotocon.com/chicago-2016" , startDate = ( 2016, May, 23 ) , endDate = ( 2016, May, 23 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "php[tek]" , link = "https://tek.phparch.com/" , startDate = ( 2016, May, 23 ) , endDate = ( 2016, May, 27 ) , location = "St. Louis, MO" , cfpStartDate = Just ( 2015, Dec, 14 ) , cfpEndDate = Just ( 2016, Jan, 16 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP" ] } , { name = "AWS Summit Netherlands" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 24 ) , location = "Nieuwegein, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "AWS", Tag "DevOps" ] } , { name = "GOTO Chicago" , link = "http://gotocon.com/chicago-2016" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 25 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "AWS Summit Mumbai" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "Mumbai, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "AWS", Tag "DevOps" ] } , { name = "HBaseCon" , link = "http://www.hbasecon.com/" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Hadoop", Tag "Big Data", Tag "Cloud" ] } , { name = "SIGNAL 2016" , link = "https://www.twilio.com/signal" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 25 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Communications" ] } , { name = "UXLx" , link = "https://www.ux-lx.com/" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 27 ) , location = "Lisbon, Portugal" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Portugal", Tag "UX" ] } , { name = "GlueCon" , link = "http://gluecon.com/" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 26 ) , location = "Broomfield, CO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General", Tag "DevOps", Tag "Big Data" ] } , { name = "PrlConf" , link = "http://www.jonprl.org/prlconf" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "Boulder, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming" ] } , { name = "PureScript Conf" , link = "https://github.com/purescript/purescript/wiki/PureScript-Conf-2016" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "Boulder, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming", Tag "PureScript" ] } , { name = "AWS Summit Mexico City" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 26 ) , location = "Mexico City, Mexico" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Mexico", Tag "AWS", Tag "DevOps" ] } , { name = "DevSum" , link = "http://www.devsum.se/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 27 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag ".Net" ] } , { name = "GOTO Chicago Workshops" , link = "http://gotocon.com/chicago-2016" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 26 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "iOSCon" , link = "https://skillsmatter.com/conferences/7598-ioscon-2016-the-conference-for-ios-and-swift-developers" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 27 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "IOS" ] } , { name = "LambdaConf" , link = "http://lambdaconf.us/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 29 ) , location = "Boulder, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming", Tag "Haskell", Tag "Scala", Tag "PureScript" ] } , { name = "Frontend United" , link = "http://frontendunited.org/" , startDate = ( 2016, May, 27 ) , endDate = ( 2016, May, 28 ) , location = "Ghent, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Belgium", Tag "UX", Tag "Drupal", Tag "PHP" ] } , { name = "PyCon Tutorials" , link = "https://us.pycon.org/2016/" , startDate = ( 2016, May, 28 ) , endDate = ( 2016, May, 29 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Python" ] } , { name = "PyCon" , link = "https://us.pycon.org/2016/" , startDate = ( 2016, May, 30 ) , endDate = ( 2016, Jun, 1 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Python" ] } , { name = "AWS Summit Paris" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 31 ) , endDate = ( 2016, May, 31 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Tokyo" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 3 ) , location = "Tokyo, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "AWS", Tag "DevOps" ] } , { name = "CSSConf Nordic" , link = "http://cssconf.no/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 1 ) , location = "Oslo, Norway" , cfpStartDate = Just ( 2015, Dec, 23 ) , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Norway", Tag "UX", Tag "CSS" ] } , { name = "Git Remote Conf" , link = "https://allremoteconfs.com/git-2016" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 3 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 6 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Remote", Tag "Git" ] } , { name = "MagmaConf" , link = "http://www.magmaconf.com/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 3 ) , location = "Manzanillo, Mexico" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Mexico", Tag "Ruby" ] } , { name = "ScotlandCSS" , link = "http://scotlandcss.launchrock.com/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 1 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Scotland", Tag "CSS" ] } , { name = "AWS Summit Madrid" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 2 ) , location = "Madrid, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Sao Paulo" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 2 ) , location = "Sao Paulo, Brazil" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Brazil", Tag "AWS", Tag "DevOps" ] } , { name = "GR8Conf EU" , link = "http://gr8conf.eu/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 4 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Denmark", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "PyCon Sprints" , link = "https://us.pycon.org/2016/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 5 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Python" ] } , { name = "ReactEurope" , link = "https://www.react-europe.org/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 3 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "React", Tag "JavaScript" ] } , { name = "Scotland JS" , link = "http://scotlandjs.com/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 3 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Scotland", Tag "JavaScript" ] } , { name = "SoCraTes England" , link = "http://socratesuk.org/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 5 ) , location = "Dorking, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Software Craftsmanship" ] } , { name = "Web Rebels" , link = "https://www.webrebels.org/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 3 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "JavaScript" ] } , { name = "NodeConf Oslo" , link = "http://oslo.nodeconf.com/" , startDate = ( 2016, Jun, 4 ) , endDate = ( 2016, Jun, 4 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "NodeJS", Tag "JavaScript" ] } , { name = "Berlin Buzzwords" , link = "http://berlinbuzzwords.de/" , startDate = ( 2016, Jun, 5 ) , endDate = ( 2016, Jun, 7 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 7 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Big Data" ] } , { name = "NDC Oslo Workshops" , link = "http://ndcoslo.com/" , startDate = ( 2016, Jun, 6 ) , endDate = ( 2016, Jun, 7 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "Spark Summit" , link = "https://spark-summit.org/2016/" , startDate = ( 2016, Jun, 6 ) , endDate = ( 2016, Jun, 8 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data" ] } , { name = "NDC Oslo" , link = "http://ndcoslo.com/" , startDate = ( 2016, Jun, 8 ) , endDate = ( 2016, Jun, 10 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "UX Scotland" , link = "http://uxscotland.net/2016/" , startDate = ( 2016, Jun, 8 ) , endDate = ( 2016, Jun, 10 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Scotland", Tag "UX" ] } , { name = "NodeConf" , link = "http://nodeconf.com/" , startDate = ( 2016, Jun, 9 ) , endDate = ( 2016, Jun, 12 ) , location = "Petaluma, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "NodeJS", Tag "JavaScript" ] } , { name = "GOTO Amsterdam Workshops" , link = "http://gotocon.com/amsterdam-2016/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 13 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "QCon New York" , link = "https://qconnewyork.com/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 15 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "enterJS" , link = "https://www.enterjs.de/" , startDate = ( 2016, Jun, 14 ) , endDate = ( 2016, Jun, 16 ) , location = "Darmstadt, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "German", Tag "Developers", Tag "Germany", Tag "JavaScript" ] } , { name = "GOTO Amsterdam" , link = "http://gotocon.com/amsterdam-2016/" , startDate = ( 2016, Jun, 14 ) , endDate = ( 2016, Jun, 15 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Just ( 2016, Jan, 14 ) , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "droidcon Berlin" , link = "http://droidcon.de/" , startDate = ( 2016, Jun, 15 ) , endDate = ( 2016, Jun, 17 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Android", Tag "Mobile" ] } , { name = "Front End Design Conference" , link = "http://frontenddesignconference.com/" , startDate = ( 2016, Jun, 15 ) , endDate = ( 2016, Jun, 17 ) , location = "St. Petersburg, FL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Scala Days Berlin" , link = "http://event.scaladays.org/scaladays-berlin-2016" , startDate = ( 2016, May, 15 ) , endDate = ( 2016, May, 17 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Scala" ] } , { name = "AWS Summit Tel Aviv" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 16 ) , endDate = ( 2016, Jun, 16 ) , location = "Tel Aviv, Israel" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Israel", Tag "AWS", Tag "DevOps" ] } , { name = "CSS Day" , link = "http://cssday.nl/2016" , startDate = ( 2016, Jun, 16 ) , endDate = ( 2016, Jun, 17 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Netherlands", Tag "CSS" ] } , { name = "QCon New York Tutorials" , link = "https://qconnewyork.com/" , startDate = ( 2016, Jun, 16 ) , endDate = ( 2016, Jun, 17 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "Joy of Coding" , link = "http://joyofcoding.org/" , startDate = ( 2016, Jun, 17 ) , endDate = ( 2016, Jun, 17 ) , location = "Rotterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 17 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "Nordic Ruby" , link = "http://www.nordicruby.org/" , startDate = ( 2016, Jun, 17 ) , endDate = ( 2016, Jun, 19 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Ruby" ] } , { name = "DockerCon" , link = "http://2016.dockercon.com/" , startDate = ( 2016, Jun, 19 ) , endDate = ( 2016, Jun, 21 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Docker" ] } , { name = "Public Sector Summit" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 20 ) , endDate = ( 2016, Jun, 21 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "O'Reilly Velocity" , link = "http://conferences.oreilly.com/velocity/devops-web-performance-ca/" , startDate = ( 2016, Jun, 21 ) , endDate = ( 2016, Jun, 23 ) , location = "Santa Clara, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 11 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Scalability", Tag "DevOps" ] } , { name = "Codemotion Dublin" , link = "http://dublin2016.codemotionworld.com/" , startDate = ( 2016, Jun, 22 ) , endDate = ( 2016, Jun, 23 ) , location = "Dublin, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "General" ] } , { name = "RedDotRubyConf" , link = "http://www.reddotrubyconf.com/" , startDate = ( 2016, Jun, 23 ) , endDate = ( 2016, Jun, 24 ) , location = "Singapore" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "Ruby" ] } , { name = "Web Design Day" , link = "http://webdesignday.com/" , startDate = ( 2016, Jun, 23 ) , endDate = ( 2016, Jun, 24 ) , location = "Pittsburgh, PA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Dinosaur.js" , link = "http://dinosaurjs.org/" , startDate = ( 2016, Jun, 24 ) , endDate = ( 2016, Jun, 24 ) , location = "Denver, CO" , cfpStartDate = Just ( 2016, Feb, 1 ) , cfpEndDate = Just ( 2016, Mar, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "GIANT Conf" , link = "http://www.giantux.com/conf2016/" , startDate = ( 2016, Jun, 27 ) , endDate = ( 2016, Jun, 29 ) , location = "TBD" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "You Gotta Love Frontend" , link = "http://yougottalovefrontend.com/" , startDate = ( 2016, Jun, 27 ) , endDate = ( 2016, Jun, 28 ) , location = "Tel Aviv, Israel" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Israel", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "CSS", Tag "General" ] } , { name = "Hadoop Summit North America" , link = "http://2016.hadoopsummit.org/san-jose/" , startDate = ( 2016, Jun, 28 ) , endDate = ( 2016, Jun, 30 ) , location = "San Jose, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Hadoop", Tag "Big Data", Tag "Internet Of Things" ] } , { name = "MongoDB World 2016" , link = "https://www.mongodb.com/world16" , startDate = ( 2016, Jun, 28 ) , endDate = ( 2016, Jun, 29 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "MongoDB", Tag "Big Data" ] } , { name = "AWS Summit Auckland" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 29 ) , endDate = ( 2016, Jun, 29 ) , location = "Auckland, New Zealand" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "New Zealand", Tag "AWS", Tag "DevOps" ] } , { name = "PolyConf" , link = "http://polyconf.com/" , startDate = ( 2016, Jun, 30 ) , endDate = ( 2016, Jul, 2 ) , location = "Poznan, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "General" ] } , { name = "AWS Summit London" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jul, 6 ) , endDate = ( 2016, Jul, 7 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "AWS", Tag "DevOps" ] } , { name = "Brighton Ruby" , link = "http://brightonruby.com/" , startDate = ( 2016, Jul, 8 ) , endDate = ( 2016, Jul, 8 ) , location = "Brighton, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Ruby" ] } , { name = "Chef Conf" , link = "https://www.chef.io/chefconf/" , startDate = ( 2016, Jul, 11 ) , endDate = ( 2016, Jul, 13 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Chef", Tag "DevOps" ] } , { name = "GopherCon" , link = "https://www.gophercon.com/" , startDate = ( 2016, Jul, 11 ) , endDate = ( 2016, Jul, 13 ) , location = "Denver, CO" , cfpStartDate = Just ( 2016, Jan, 1 ) , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Go" ] } , { name = "AWS Summit Santa Clara" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jul, 12 ) , endDate = ( 2016, Jul, 13 ) , location = "Santa Clara, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "Newbie Remote Conf" , link = "https://allremoteconfs.com/newbie-2016" , startDate = ( 2016, Jul, 13 ) , endDate = ( 2016, Jul, 15 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 11 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Remote", Tag "General" ] } , { name = "Generate San Francisco" , link = "http://www.generateconf.com/san-francisco-2016/" , startDate = ( 2016, Jul, 15 ) , endDate = ( 2016, Jul, 15 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "EuroPython" , link = "http://ep2016.europython.eu/" , startDate = ( 2016, Jul, 17 ) , endDate = ( 2016, Jul, 24 ) , location = "Bilbao, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Python" ] } , { name = "php[cruise]" , link = "https://cruise.phparch.com/" , startDate = ( 2016, Jul, 17 ) , endDate = ( 2016, Jul, 24 ) , location = "Baltimore, MD" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP" ] } , { name = "Curry On" , link = "http://curry-on.org/2016/" , startDate = ( 2016, Jul, 18 ) , endDate = ( 2016, Jul, 19 ) , location = "Rome, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "General" ] } , { name = "UberConf" , link = "https://uberconf.com/conference/denver/2016/07/home" , startDate = ( 2016, Jul, 19 ) , endDate = ( 2016, Jul, 22 ) , location = "Denver, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Java", Tag "Agile", Tag "Cloud", Tag "Scala", Tag "Groovy" ] } , { name = "European Conference on Object-Oriented Programming" , link = "http://2016.ecoop.org/" , startDate = ( 2016, Jul, 20 ) , endDate = ( 2016, Jul, 22 ) , location = "Rome, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "General" ] } , { name = "An Event Apart DC" , link = "http://aneventapart.com/event/washington-dc-2016" , startDate = ( 2016, Jul, 25 ) , endDate = ( 2016, Jul, 27 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Mobile & Web CodeCamp" , link = "http://www.mobilewebcodecamp.com/" , startDate = ( 2016, Jul, 26 ) , endDate = ( 2016, Jul, 29 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Mobile", Tag "Android", Tag "IOS", Tag "JavaScript", Tag "PhoneGap" ] } , { name = "GR8Conf US" , link = "http://gr8conf.org/" , startDate = ( 2016, Jul, 27 ) , endDate = ( 2016, Jul, 29 ) , location = "Minneapolis, MN" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "Forward 5 Web Summit" , link = "http://forwardjs.com/" , startDate = ( 2016, Jul, 28 ) , endDate = ( 2016, Jul, 28 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "Forward Swift" , link = "http://forwardjs.com/" , startDate = ( 2016, Jul, 28 ) , endDate = ( 2016, Jul, 28 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Swift" ] } , { name = "NDC Sydney Workshops" , link = "http://ndcsydney.com/" , startDate = ( 2016, Aug, 1 ) , endDate = ( 2016, Aug, 2 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "AWS Summit Canberra" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Aug, 3 ) , endDate = ( 2016, Aug, 3 ) , location = "Canberra, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "AWS", Tag "DevOps" ] } , { name = "NDC Sydney" , link = "http://ndcsydney.com/" , startDate = ( 2016, Aug, 3 ) , endDate = ( 2016, Aug, 5 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "CSSconf Argentina" , link = "http://cssconfar.com/" , startDate = ( 2016, Aug, 7 ) , endDate = ( 2016, Aug, 7 ) , location = "Buenos Aires, Argentina" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Argentina", Tag "CSS" ] } , { name = "That Conference" , link = "https://www.thatconference.com/" , startDate = ( 2016, Aug, 8 ) , endDate = ( 2016, Aug, 10 ) , location = "Wisconsin Dells, WI" , cfpStartDate = Just ( 2016, Mar, 1 ) , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Mobile", Tag "Cloud" ] } , { name = "AWS Summit New York" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Aug, 10 ) , endDate = ( 2016, Aug, 11 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "Midwest JS" , link = "http://midwestjs.com/" , startDate = ( 2016, Aug, 10 ) , endDate = ( 2016, Aug, 12 ) , location = "Minneapolis, MN" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "NodeJS" ] } , { name = "Robots Remote Conf" , link = "https://allremoteconfs.com/robots-2016" , startDate = ( 2016, Aug, 10 ) , endDate = ( 2016, Aug, 12 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jul, 9 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Robotics" ] } , { name = "FP Conf" , link = "http://fpconf.org/" , startDate = ( 2016, Aug, 15 ) , endDate = ( 2016, Aug, 15 ) , location = "Moscow, Russia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Russian", Tag "Developers", Tag "Russia", Tag "Functional Programming", Tag "Erlang", Tag "Scala", Tag "Clojure", Tag "Haskell" ] } , { name = "Abstractions" , link = "http://abstractions.io/" , startDate = ( 2016, Aug, 18 ) , endDate = ( 2016, Aug, 20 ) , location = "Pittsburgh, PA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "HybridConf" , link = "https://hybridconf.net/" , startDate = ( 2016, Aug, 18 ) , endDate = ( 2016, Aug, 19 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Germany", Tag "General", Tag "UX" ] } , { name = "360|iDev" , link = "http://360idev.com/" , startDate = ( 2016, Aug, 21 ) , endDate = ( 2016, Aug, 24 ) , location = "Denver, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS" ] } , { name = "JSConf Iceland" , link = "http://2016.jsconf.is/" , startDate = ( 2016, Aug, 25 ) , endDate = ( 2016, Aug, 26 ) , location = "Reykjavik, Iceland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Iceland", Tag "JavaScript" ] } , { name = "React Rally" , link = "http://www.reactrally.com/" , startDate = ( 2016, Aug, 25 ) , endDate = ( 2016, Aug, 26 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "React", Tag "JavaScript" ] } , { name = "BrazilJS" , link = "https://braziljs.org/conf" , startDate = ( 2016, Aug, 26 ) , endDate = ( 2016, Aug, 27 ) , location = "Porto Alegre, Brazil" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 30 ) , tags = [ Tag "English", Tag "Spanish", Tag "Portuguese", Tag "Developers", Tag "Brazil", Tag "JavaScript" ] } , { name = "AlterConf South Africa" , link = "http://www.alterconf.com/sessions/cape-town-south-africa" , startDate = ( 2016, Aug, 27 ) , endDate = ( 2016, Aug, 27 ) , location = "Cape Town, South Africa" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 16 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "South Africa", Tag "Diversity", Tag "Soft Skills" ] } , { name = "An Event Apart Chicago" , link = "http://aneventapart.com/event/chicago-2016" , startDate = ( 2016, Aug, 29 ) , endDate = ( 2016, Aug, 31 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Agile on the Beach" , link = "http://agileonthebeach.com/2016-2/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 2 ) , location = "Falmouth, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile" ] } , { name = "ColdFront" , link = "https://2016.coldfrontconf.com/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 1 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Designers", Tag "Denmark", Tag "JavaScript", Tag "CSS", Tag "Mobile" ] } , { name = "Frontend Conference Zurich" , link = "https://frontendconf.ch/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 2 ) , location = "Zürich, Switzerland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Switzerland", Tag "UX" ] } , { name = "Full Stack Fest" , link = "http://2016.fullstackfest.com/" , startDate = ( 2016, Sep, 5 ) , endDate = ( 2016, Sep, 9 ) , location = "Barcelona, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Ruby", Tag "JavaScript", Tag "General" ] } , { name = "Generate Sydney" , link = "http://www.generateconf.com/" , startDate = ( 2016, Sep, 5 ) , endDate = ( 2016, Sep, 5 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "UX" ] } , { name = "iOSDevEngland" , link = "http://www.iosdevuk.com/" , startDate = ( 2016, Sep, 5 ) , endDate = ( 2016, Sep, 8 ) , location = "Aberystwyth, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "IOS", Tag "Swift" ] } , { name = "RubyKaigi" , link = "http://rubykaigi.org/2016" , startDate = ( 2016, Sep, 8 ) , endDate = ( 2016, Sep, 10 ) , location = "Kyoto, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "English", Tag "Japanese", Tag "Ruby" ] } , { name = "CocoaConf DC" , link = "http://cocoaconf.com/dc-2016/home" , startDate = ( 2016, Sep, 9 ) , endDate = ( 2016, Sep, 10 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "Agile Prague" , link = "http://agileprague.com/" , startDate = ( 2016, Sep, 12 ) , endDate = ( 2016, Sep, 13 ) , location = "Prague, Czech Republic" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "Czech Republic", Tag "Agile" ] } , { name = "SwanseaCon" , link = "http://swanseacon.co.uk/" , startDate = ( 2016, Sep, 12 ) , endDate = ( 2016, Sep, 13 ) , location = "Swansea, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile", Tag "Software Craftsmanship" ] } , { name = "Angular Remote Conf" , link = "https://allremoteconfs.com/angular-2016" , startDate = ( 2016, Sep, 14 ) , endDate = ( 2016, Sep, 16 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Aug, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript", Tag "AngularJS" ] } , { name = "From the Front" , link = "http://2016.fromthefront.it/" , startDate = ( 2016, Sep, 15 ) , endDate = ( 2016, Sep, 16 ) , location = "Bologna, Italy" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 15 ) , tags = [ Tag "English", Tag "Designers", Tag "Italy", Tag "UX" ] } , { name = "Strangeloop" , link = "http://thestrangeloop.com/" , startDate = ( 2016, Sep, 15 ) , endDate = ( 2016, Sep, 17 ) , location = "St. Louis, MO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 9 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General", Tag "Functional Programming" ] } , { name = "WindyCityRails" , link = "https://www.windycityrails.com/" , startDate = ( 2016, Sep, 15 ) , endDate = ( 2016, Sep, 16 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby", Tag "Rails" ] } , { name = "WindyCityThings" , link = "https://www.windycitythings.com/" , startDate = ( 2016, Jun, 23 ) , endDate = ( 2016, Jun, 24 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Internet Of Things", Tag "RaspberryPi", Tag "Arduino" ] } , { name = "CppCon" , link = "http://cppcon.org/" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 23 ) , location = "Bellevue, WA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 22 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "C++" ] } , { name = "International Conference on Functional Programming" , link = "http://conf.researchr.org/home/icfp-2016" , startDate = ( 2016, Sep, 19 ) , endDate = ( 2016, Sep, 21 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 16 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell" ] } , { name = "Commercial Users of Functional Programming" , link = "http://cufp.org/2016/" , startDate = ( 2016, Sep, 24 ) , endDate = ( 2016, Sep, 24 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 24 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell", Tag "OCaml", Tag "PureScript", Tag "Clojure" ] } , { name = "Haskell Implementors' Workshop" , link = "https://wiki.haskell.org/HaskellImplementorsWorkshop/2016" , startDate = ( 2016, Sep, 24 ) , endDate = ( 2016, Sep, 24 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell" ] } , { name = "Workshop on Functional Art, Music, Modeling and Design" , link = "http://functional-art.org/2016/" , startDate = ( 2016, Sep, 24 ) , endDate = ( 2016, Sep, 24 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 24 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Haskell Symposium" , link = "https://www.haskell.org/haskell-symposium/2016/index.html" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 23 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 6 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell" ] } , { name = "Workshop on ML" , link = "http://www.mlworkshop.org/ml2016" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 22 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "F#", Tag "OCaml" ] } , { name = "OCaml Users and Developers Workshop" , link = "http://www.mlworkshop.org/ml2016" , startDate = ( 2016, Sep, 23 ) , endDate = ( 2016, Sep, 23 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "OCaml" ] } , { name = "Workshop on Functional High-Performance Computing" , link = "https://sites.google.com/site/fhpcworkshops/" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 22 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Erlang Workshop" , link = "http://conf.researchr.org/track/icfp-2016/erlang-2016-papers" , startDate = ( 2016, Sep, 23 ) , endDate = ( 2016, Sep, 23 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 3 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Erlang" ] } , { name = "Workshop on Type-Driven Development" , link = "http://conf.researchr.org/track/icfp-2016/tyde-2016-papers" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Higher-Order Programming Effects Workshop" , link = "http://conf.researchr.org/track/icfp-2016/hope-2016-papers" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Scheme Workshop" , link = "http://scheme2016.snow-fort.org/" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 24 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Lisp", Tag "Clojure" ] } , { name = "Programming Languages Mentoring Workshop" , link = "http://conf.researchr.org/track/PLMW-ICFP-2016/PLMW-ICFP-2016" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "JavaOne" , link = "https://www.oracle.com/javaone/index.html" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 22 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Java" ] } , { name = "Generate London" , link = "http://www.generateconf.com/" , startDate = ( 2016, Sep, 21 ) , endDate = ( 2016, Sep, 23 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "UX" ] } , { name = "AWS Summit Rio de Janeiro" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 22 ) , location = "Rio de Janeiro, Brazil" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Brazil", Tag "AWS", Tag "DevOps" ] } , { name = "Functional Conf" , link = "http://functionalconf.com/" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 25 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Functional Programming" ] } , { name = "DrupalCon Dublin" , link = "https://events.drupal.org/dublin2016/" , startDate = ( 2016, Sep, 26 ) , endDate = ( 2016, Sep, 30 ) , location = "Dublin, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "Drupal", Tag "PHP" ] } , { name = "AngularConnect" , link = "http://angularconnect.com/" , startDate = ( 2016, Sep, 27 ) , endDate = ( 2016, Sep, 28 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "JavaScript", Tag "AngularJS" ] } , { name = "AWS Summit Lima" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Sep, 28 ) , endDate = ( 2016, Sep, 28 ) , location = "Lima, Peru" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Peru", Tag "AWS", Tag "DevOps" ] } , { name = "Jazoon TechDays" , link = "http://jazoon.com/" , startDate = ( 2016, Sep, 30 ) , endDate = ( 2016, Sep, 30 ) , location = "Zurich, Switzerland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Switzerland", Tag "JavaScript", Tag "AngularJS", Tag "Ember" ] } , { name = "An Event Apart Orlando" , link = "http://aneventapart.com/event/orlando-special-edition-2016" , startDate = ( 2016, Oct, 3 ) , endDate = ( 2016, Oct, 5 ) , location = "Orlando, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "GOTO Copenhagen" , link = "http://gotocon.com/cph-2015/" , startDate = ( 2016, Oct, 3 ) , endDate = ( 2016, Oct, 6 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Denmark", Tag "General" ] } , { name = "LoopConf" , link = "https://loopconf.com/" , startDate = ( 2016, Oct, 5 ) , endDate = ( 2016, Oct, 7 ) , location = "Fort Lauderdale, FL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP", Tag "WordPress" ] } , { name = "dotGo" , link = "http://2016.dotgo.eu/" , startDate = ( 2016, Oct, 10 ) , endDate = ( 2016, Oct, 10 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Go" ] } , { name = "GOTO London" , link = "http://gotocon.com/" , startDate = ( 2016, Oct, 12 ) , endDate = ( 2016, Oct, 14 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "Rails Remote Conf" , link = "https://allremoteconfs.com/rails-2016" , startDate = ( 2016, Oct, 12 ) , endDate = ( 2016, Oct, 14 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Sep, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Rails", Tag "Ruby" ] } , { name = "CocoaLove" , link = "http://cocoalove.org/" , startDate = ( 2016, Oct, 14 ) , endDate = ( 2016, Oct, 16 ) , location = "Philadelphia, PA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "CSS Dev Conf" , link = "http://2016.cssdevconf.com/" , startDate = ( 2016, Oct, 17 ) , endDate = ( 2016, Oct, 19 ) , location = "San Antonio, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "CSS" ] } , { name = "Full Stack Toronto" , link = "https://fsto.co/" , startDate = ( 2016, Oct, 17 ) , endDate = ( 2016, Oct, 18 ) , location = "Toronto, Canada" , cfpStartDate = Just ( 2016, Jan, 1 ) , cfpEndDate = Just ( 2016, Jul, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Canada", Tag "General" ] } , { name = "ConnectJS" , link = "http://connect-js.com/" , startDate = ( 2016, Oct, 21 ) , endDate = ( 2016, Oct, 22 ) , location = "Atlanta, GA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "Codemotion Berlin" , link = "http://berlin2015.codemotionworld.com/" , startDate = ( 2016, Oct, 24 ) , endDate = ( 2016, Oct, 25 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "General" ] } , { name = "ng-europe" , link = "https://ngeurope.org/" , startDate = ( 2016, Oct, 25 ) , endDate = ( 2016, Oct, 26 ) , location = "Paris, France" , cfpStartDate = Just ( 2016, Feb, 17 ) , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "JavaScript", Tag "AngularJS" ] } , { name = "Smashing Conf Barcelona" , link = "http://smashingconf.com/" , startDate = ( 2016, Oct, 25 ) , endDate = ( 2016, Oct, 26 ) , location = "Barcelona, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Spain", Tag "UX" ] } , { name = "Spark Summit Europe" , link = "https://spark-summit.org/" , startDate = ( 2016, Oct, 25 ) , endDate = ( 2016, Oct, 27 ) , location = "Brussels, Belgium" , cfpStartDate = Just ( 2016, Jun, 1 ) , cfpEndDate = Just ( 2016, Jul, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "Big Data" ] } , { name = "An Event Apart San Francisco" , link = "http://aneventapart.com/event/san-francisco-2016" , startDate = ( 2016, Oct, 31 ) , endDate = ( 2016, Nov, 2 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "CocoaConf San Jose" , link = "http://cocoaconf.com/sanjose-2016/home" , startDate = ( 2016, Nov, 4 ) , endDate = ( 2016, Nov, 5 ) , location = "San Jose, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Cocoa" ] } , { name = "Beyond Tellerrand" , link = "http://beyondtellerrand.com/events/berlin-2016" , startDate = ( 2016, Nov, 7 ) , endDate = ( 2016, Nov, 9 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Germany", Tag "UX", Tag "General" ] } , { name = "Devops Remote Conf" , link = "https://allremoteconfs.com/devops-2016" , startDate = ( 2016, Nov, 9 ) , endDate = ( 2016, Nov, 11 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Oct, 8 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "DevOps" ] } , { name = "droidconIN" , link = "https://droidcon.in/2016/" , startDate = ( 2016, Nov, 10 ) , endDate = ( 2016, Nov, 11 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Aug, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Android", Tag "Mobile" ] } , { name = "RubyConf" , link = "http://rubyconf.org/" , startDate = ( 2016, Nov, 10 ) , endDate = ( 2016, Nov, 12 ) , location = "Cincinnati, OH" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "BuildStuff" , link = "http://buildstuff.lt/" , startDate = ( 2016, Nov, 16 ) , endDate = ( 2016, Nov, 20 ) , location = "Vilnius, Lithuania" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Lithuania", Tag "General" ] } , { name = "Frontier Conf" , link = "https://www.frontierconf.com/" , startDate = ( 2016, Nov, 16 ) , endDate = ( 2016, Nov, 16 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "CSS", Tag "UX" ] } , { name = "Generate Bangalore" , link = "http://www.generateconf.com/" , startDate = ( 2016, Nov, 25 ) , endDate = ( 2016, Nov, 25 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "India", Tag "UX" ] } , { name = "AWS re:Invent" , link = "https://reinvent.awsevents.com/" , startDate = ( 2016, Nov, 28 ) , endDate = ( 2016, Dec, 2 ) , location = "Las Vegas, NV" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "Cloud" ] } , { name = "JS Kongress Munich" , link = "http://js-kongress.de/" , startDate = ( 2016, Nov, 28 ) , endDate = ( 2016, Nov, 29 ) , location = "Munich, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "JavaScript" ] } , { name = "CSSConf AU" , link = "http://2016.cssconf.com.au/" , startDate = ( 2016, Nov, 30 ) , endDate = ( 2016, Nov, 30 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "CSS" ] } , { name = "JSConf AU" , link = "http://jsconfau.com/" , startDate = ( 2016, Dec, 1 ) , endDate = ( 2016, Dec, 1 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "JavaScript" ] } , { name = "Clojure eXchange" , link = "https://skillsmatter.com/conferences/7430-clojure-exchange-2016" , startDate = ( 2016, Dec, 1 ) , endDate = ( 2016, Dec, 2 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Clojure", Tag "Functional Programming" ] } , { name = "Decompress" , link = "http://2016.cssconf.com.au/" , startDate = ( 2016, Dec, 2 ) , endDate = ( 2016, Dec, 2 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Australia", Tag "General" ] } , { name = "dotCSS" , link = "http://www.dotcss.io/" , startDate = ( 2016, Dec, 2 ) , endDate = ( 2016, Dec, 2 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "France", Tag "CSS" ] } , { name = "dotJS" , link = "http://www.dotjs.io/" , startDate = ( 2016, Dec, 5 ) , endDate = ( 2016, Dec, 5 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "JavaScript" ] } , { name = "NoSQL Remote Conf" , link = "https://allremoteconfs.com/nosql-2016" , startDate = ( 2016, Dec, 7 ) , endDate = ( 2016, Dec, 9 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Nov, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "NoSQL" ] } , { name = "Midwest.io" , link = "http://www.midwest.io/" , startDate = ( 2016, Aug, 22 ) , endDate = ( 2016, Aug, 23 ) , location = "Kansas City, MO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "ServerlessConf" , link = "http://serverlessconf.io/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 27 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 26 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General", Tag "AWS", Tag "Cloud", Tag "Scalability" ] } , { name = "AgileIndy" , link = "http://agileindy.org/" , startDate = ( 2016, Apr, 12 ) , endDate = ( 2016, Apr, 12 ) , location = "Indianapolis, IN" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Agile" ] } , { name = "RSJS" , link = "http://rsjs.org/2016/" , startDate = ( 2016, Apr, 23 ) , endDate = ( 2016, Apr, 23 ) , location = "Porto Alegre, Brazil" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "Portuguese", Tag "Developers", Tag "Brazil", Tag "JavaScript" ] } , { name = "Frontinsampa" , link = "http://frontinsampa.com.br/" , startDate = ( 2016, Jul, 2 ) , endDate = ( 2016, Jul, 2 ) , location = "Sao Paulo, Brazil" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Portuguese", Tag "Developers", Tag "Brazil", Tag "JavaScript" ] } , { name = ".NET Fringe" , link = "http://dotnetfringe.org/" , startDate = ( 2016, Jul, 10 ) , endDate = ( 2016, Jul, 12 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source", Tag ".Net" ] } , { name = "Úll" , link = "http://2016.ull.ie/" , startDate = ( 2016, Nov, 1 ) , endDate = ( 2016, Nov, 2 ) , location = "Killarney, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "IOS" ] } , { name = "Nantes FP Day" , link = "http://fpday.org/" , startDate = ( 2016, Mar, 26 ) , endDate = ( 2016, Mar, 26 ) , location = "Nantes, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "French", Tag "Developers", Tag "France", Tag "Functional Programming" ] } , { name = "HalfStack" , link = "http://halfstackconf.com/" , startDate = ( 2016, Nov, 18 ) , endDate = ( 2016, Nov, 18 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Oct, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "JavaScript" ] } , { name = "Front Conference" , link = "https://frontutah.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Port80" , link = "http://port80events.co.uk/" , startDate = ( 2016, May, 20 ) , endDate = ( 2016, May, 20 ) , location = "Newport, Wales" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Wales", Tag "UX", Tag "Web" ] } , { name = "Code 2016 Sydney" , link = "http://www.webdirections.org/code16/" , startDate = ( 2016, Jul, 28 ) , endDate = ( 2016, Jul, 29 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "JavaScript" ] } , { name = "Code 2016 Melbourne" , link = "http://www.webdirections.org/code16/" , startDate = ( 2016, Aug, 1 ) , endDate = ( 2016, Aug, 2 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "JavaScript" ] } , { name = "CascadiaFest" , link = "http://2016.cascadiafest.org/" , startDate = ( 2016, Aug, 3 ) , endDate = ( 2016, Aug, 5 ) , location = "Semiahmoo, WA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 11 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "CSS", Tag "JavaScript", Tag "Web", Tag "NodeJS" ] } , { name = "React Amsterdam" , link = "http://react-amsterdam.com/" , startDate = ( 2016, Apr, 16 ) , endDate = ( 2016, Apr, 16 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "JavaScript", Tag "React" ] } , { name = "NSSpain" , link = "http://nsspain.com/" , startDate = ( 2016, Sep, 14 ) , endDate = ( 2016, Sep, 16 ) , location = "La Rioja, Spain" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "IOS" ] } , { name = "try! Swift NYC" , link = "http://www.tryswiftnyc.com/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 2 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Swift", Tag "IOS" ] } , { name = "FrenchKit" , link = "http://frenchkit.fr/" , startDate = ( 2016, Sep, 23 ) , endDate = ( 2016, Sep, 24 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "IOS", Tag "Cocoa" ] } , { name = "AltConf" , link = "http://altconf.com/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 16 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "WWDC" , link = "https://developer.apple.com/wwdc/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 17 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Designers", Tag "USA", Tag "IOS" ] } , { name = "Thunder Plains" , link = "http://thunderplainsconf.com/" , startDate = ( 2016, Nov, 3 ) , endDate = ( 2016, Nov, 3 ) , location = "Oklahoma City, OK" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "CSS", Tag "Mobile", Tag "Web" ] } , { name = "Scala Up North" , link = "http://scalaupnorth.com/" , startDate = ( 2016, Aug, 5 ) , endDate = ( 2016, Aug, 6 ) , location = "Montreal, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Scala" ] } , { name = "XP 2016" , link = "http://conf.xp2016.org/" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 27 ) , location = "Edinbrugh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Scotland", Tag "Agile" ] } , { name = "Valio Con" , link = "http://valiocon.com/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 22 ) , location = "San Diego, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "JailbreakCon" , link = "http://www.jailbreakcon.com/" , startDate = ( 2016, Jun, 20 ) , endDate = ( 2016, Jun, 21 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS" ] } , { name = "#Pragma Conference" , link = "http://pragmaconference.com/" , startDate = ( 2016, Oct, 12 ) , endDate = ( 2016, Oct, 14 ) , location = "Verona, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "IOS" ] } , { name = "DEF CON" , link = "https://www.defcon.org/" , startDate = ( 2016, Aug, 4 ) , endDate = ( 2016, Aug, 7 ) , location = "Las Vegas, NV" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 2 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "DerbyCon" , link = "https://www.derbycon.com/" , startDate = ( 2016, Aug, 23 ) , endDate = ( 2016, Aug, 25 ) , location = "Louisville, KY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Aug, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "Black Hat" , link = "https://www.blackhat.com/us-16/" , startDate = ( 2016, Jul, 30 ) , endDate = ( 2016, Aug, 4 ) , location = "Las Vegas, NV" , cfpStartDate = Just ( 2016, Feb, 9 ) , cfpEndDate = Just ( 2016, Apr, 11 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "RSA Conference USA" , link = "http://www.rsaconference.com/events/us16" , startDate = ( 2016, Feb, 29 ) , endDate = ( 2016, Mar, 4 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "RSA Conference Asia Pacific & Japan" , link = "http://www.rsaconference.com/events/ap16" , startDate = ( 2016, Jul, 20 ) , endDate = ( 2016, Jul, 22 ) , location = "Singapore" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "Security" ] } , { name = "RSA Conference Abu Dhabi" , link = "http://www.rsaconference.com/events/ad16" , startDate = ( 2016, Nov, 15 ) , endDate = ( 2016, Nov, 16 ) , location = "Abu Dhabi, UAE" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "Security" ] } , { name = "CanSecWest" , link = "https://cansecwest.com/" , startDate = ( 2016, Mar, 16 ) , endDate = ( 2016, Mar, 18 ) , location = "Vancouver, Canada" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Security" ] } , { name = "PanSec" , link = "https://pacsec.jp/" , startDate = ( 2016, Oct, 26 ) , endDate = ( 2016, Oct, 27 ) , location = "Tokyo, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Security" ] } , { name = "EUSecWest" , link = "https://eusecwest.com/" , startDate = ( 2016, Sep, 19 ) , endDate = ( 2016, Sep, 20 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "Security" ] } , { name = "CarolinaCon" , link = "http://www.carolinacon.org/" , startDate = ( 2016, Mar, 4 ) , endDate = ( 2016, Mar, 4 ) , location = "Raleigh, North Carolina" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "THOTCON" , link = "http://thotcon.org/" , startDate = ( 2016, May, 5 ) , endDate = ( 2016, May, 6 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } ] , currentDate = ( 2016, Jan, 1 ) , tags = [ { sectionName = "Conference Language" , tags = [ FilteredTag.init (Tag "English") , FilteredTag.init (Tag "French") , FilteredTag.init (Tag "German") , FilteredTag.init (Tag "Italian") , FilteredTag.init (Tag "Japanese") , FilteredTag.init (Tag "Norwegian") , FilteredTag.init (Tag "Polish") , FilteredTag.init (Tag "Portuguese") , FilteredTag.init (Tag "Russian") , FilteredTag.init (Tag "Spanish") , FilteredTag.init (Tag "Turkish") ] } , { sectionName = "Audience" , tags = [ FilteredTag.init (Tag "Designers") , FilteredTag.init (Tag "Developers") ] } , { sectionName = "Programming Languages/Technologies" , tags = [ FilteredTag.init (Tag "Android") , FilteredTag.init (Tag "AngularJS") , FilteredTag.init (Tag "Arduino") , FilteredTag.init (Tag "AWS") , FilteredTag.init (Tag "C++") , FilteredTag.init (Tag "CSS") , FilteredTag.init (Tag "Chef") , FilteredTag.init (Tag "Clojure") , FilteredTag.init (Tag "Cocoa") , FilteredTag.init (Tag "CycleJS") , FilteredTag.init (Tag "Docker") , FilteredTag.init (Tag "Drupal") , FilteredTag.init (Tag ".Net") , FilteredTag.init (Tag "Elasticsearch") , FilteredTag.init (Tag "Elixir") , FilteredTag.init (Tag "Ember") , FilteredTag.init (Tag "Erlang") , FilteredTag.init (Tag "F#") , FilteredTag.init (Tag "Git") , FilteredTag.init (Tag "Go") , FilteredTag.init (Tag "Gradle") , FilteredTag.init (Tag "Grails") , FilteredTag.init (Tag "Groovy") , FilteredTag.init (Tag "Hadoop") , FilteredTag.init (Tag "Haskell") , FilteredTag.init (Tag "IOS") , FilteredTag.init (Tag "Java") , FilteredTag.init (Tag "JavaScript") , FilteredTag.init (Tag "Logstash") , FilteredTag.init (Tag "Lisp") , FilteredTag.init (Tag "MongoDB") , FilteredTag.init (Tag "NodeJS") , FilteredTag.init (Tag "OCaml") , FilteredTag.init (Tag "PhoneGap") , FilteredTag.init (Tag "PHP") , FilteredTag.init (Tag "PostgreSQL") , FilteredTag.init (Tag "PureScript") , FilteredTag.init (Tag "Python") , FilteredTag.init (Tag "Rails") , FilteredTag.init (Tag "RaspberryPi") , FilteredTag.init (Tag "React") , FilteredTag.init (Tag "Ruby") , FilteredTag.init (Tag "SML") , FilteredTag.init (Tag "Scala") , FilteredTag.init (Tag "SVG") , FilteredTag.init (Tag "Swift") , FilteredTag.init (Tag "WordPress") ] } , { sectionName = "Topics" , tags = [ FilteredTag.init (Tag "Agile") , FilteredTag.init (Tag "Big Data") , FilteredTag.init (Tag "Cloud") , FilteredTag.init (Tag "Communications") , FilteredTag.init (Tag "DataVisualization") , FilteredTag.init (Tag "DevOps") , FilteredTag.init (Tag "Diversity") , FilteredTag.init (Tag "Functional Programming") , FilteredTag.init (Tag "General") , FilteredTag.init (Tag "Internet Of Things") , FilteredTag.init (Tag "Microservices") , FilteredTag.init (Tag "Mobile") , FilteredTag.init (Tag "NoSQL") , FilteredTag.init (Tag "Open Source") , FilteredTag.init (Tag "Progressive Enhancement") , FilteredTag.init (Tag "Robotics") , FilteredTag.init (Tag "Scalability") , FilteredTag.init (Tag "Security") , FilteredTag.init (Tag "Soft Skills") , FilteredTag.init (Tag "Software Craftsmanship") , FilteredTag.init (Tag "Testing") , FilteredTag.init (Tag "UX") , FilteredTag.init (Tag "Web") ] } , { sectionName = "Locations" , tags = [ FilteredTag.init (Tag "Argentina") , FilteredTag.init (Tag "Australia") , FilteredTag.init (Tag "Belarus") , FilteredTag.init (Tag "Belgium") , FilteredTag.init (Tag "Brazil") , FilteredTag.init (Tag "Bulgaria") , FilteredTag.init (Tag "Canada") , FilteredTag.init (Tag "Chile") , FilteredTag.init (Tag "China") , FilteredTag.init (Tag "Colombia") , FilteredTag.init (Tag "Croatia") , FilteredTag.init (Tag "Czech Republic") , FilteredTag.init (Tag "Denmark") , FilteredTag.init (Tag "England") , FilteredTag.init (Tag "Finland") , FilteredTag.init (Tag "France") , FilteredTag.init (Tag "Germany") , FilteredTag.init (Tag "Hungary") , FilteredTag.init (Tag "Iceland") , FilteredTag.init (Tag "India") , FilteredTag.init (Tag "Ireland") , FilteredTag.init (Tag "Israel") , FilteredTag.init (Tag "Italy") , FilteredTag.init (Tag "Japan") , FilteredTag.init (Tag "Latvia") , FilteredTag.init (Tag "Lebanon") , FilteredTag.init (Tag "Lithuania") , FilteredTag.init (Tag "Malaysia") , FilteredTag.init (Tag "Mexico") , FilteredTag.init (Tag "Netherlands") , FilteredTag.init (Tag "New Zealand") , FilteredTag.init (Tag "Norway") , FilteredTag.init (Tag "Peru") , FilteredTag.init (Tag "Philippines") , FilteredTag.init (Tag "Poland") , FilteredTag.init (Tag "Portugal") , FilteredTag.init (Tag "Remote") , FilteredTag.init (Tag "Romania") , FilteredTag.init (Tag "Russia") , FilteredTag.init (Tag "Scotland") , FilteredTag.init (Tag "Singapore") , FilteredTag.init (Tag "South Africa") , FilteredTag.init (Tag "South Korea") , FilteredTag.init (Tag "Spain") , FilteredTag.init (Tag "Sweden") , FilteredTag.init (Tag "Switzerland") , FilteredTag.init (Tag "Taiwan") , FilteredTag.init (Tag "Tunisia") , FilteredTag.init (Tag "Turkey") , FilteredTag.init (Tag "UAE") , FilteredTag.init (Tag "USA") , FilteredTag.init (Tag "Ukraine") , FilteredTag.init (Tag "Uruguay") , FilteredTag.init (Tag "Wales") ] } ] , includePastEvents = False }
47894
module InitialData exposing (model) import Conference import Date exposing (Month(..)) import FilteredTag import GenericSet import Model import Tag exposing (Tag(..)) model : Model.Model model = { conferences = GenericSet.fromList Conference.compareConferences [ { name = "@Swift" , link = "http://atswift.io/index-en.html" , startDate = ( 2016, Jan, 10 ) , endDate = ( 2016, Jan, 10 ) , location = "Beijing, China" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "China", Tag "Swift", Tag "IOS" ] } , { name = "NDC London Workshops" , link = "http://ndc-london.com/" , startDate = ( 2016, Jan, 11 ) , endDate = ( 2016, Jan, 12 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "NDC London" , link = "http://ndc-london.com/" , startDate = ( 2016, Jan, 13 ) , endDate = ( 2016, Jan, 15 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "Internet of Things Milan" , link = "https://www.mongodb.com/events/internet-of-things-milan" , startDate = ( 2016, Jan, 14 ) , endDate = ( 2016, Jan, 14 ) , location = "Milan, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "MongoDB", Tag "Big Data", Tag "Internet Of Things" ] } , { name = "JS Remote Conf" , link = "https://allremoteconfs.com/js-2016" , startDate = ( 2016, Jan, 14 ) , endDate = ( 2016, Jan, 16 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript" ] } , { name = "GR8Conf IN" , link = "http://gr8conf.in/" , startDate = ( 2016, Jan, 16 ) , endDate = ( 2016, Jan, 16 ) , location = "New Delhi, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "O'Reilly Design Conference" , link = "http://conferences.oreilly.com/design/ux-interaction-iot-us" , startDate = ( 2016, Jan, 20 ) , endDate = ( 2016, Jan, 22 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "SVG Summit" , link = "http://environmentsforhumans.com/2016/svg-summit/" , startDate = ( 2016, Jan, 21 ) , endDate = ( 2016, Jan, 21 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Remote", Tag "SVG" ] } , { name = "/dev/winter" , link = "http://devcycles.net/2016/winter/" , startDate = ( 2016, Jan, 23 ) , endDate = ( 2016, Jan, 23 ) , location = "Cambridge, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "DevOps", Tag "NoSQL", Tag "Functional Programming" ] } , { name = "PhoneGap Day" , link = "http://pgday.phonegap.com/us2016/" , startDate = ( 2016, Jan, 28 ) , endDate = ( 2016, Jan, 28 ) , location = "Lehi, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PhoneGap", Tag "Mobile" ] } , { name = "dotSwift" , link = "http://www.dotswift.io/" , startDate = ( 2016, Jan, 29 ) , endDate = ( 2016, Jan, 29 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Swift" ] } , { name = "PHPBenelux" , link = "http://conference.phpbenelux.eu/2016/" , startDate = ( 2016, Jan, 29 ) , endDate = ( 2016, Jan, 30 ) , location = "Antwerp, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "PHP" ] } , { name = "AlterConf D.C." , link = "http://www.alterconf.com/sessions/washington-dc" , startDate = ( 2016, Jan, 30 ) , endDate = ( 2016, Jan, 30 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "Diversity", Tag "Soft Skills" ] } , { name = "FOSDEM" , link = "https://fosdem.org/2016/" , startDate = ( 2016, Jan, 30 ) , endDate = ( 2016, Jan, 31 ) , location = "Brussels, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "Open Source", Tag "General" ] } , { name = "PgConf.Russia" , link = "https://pgconf.ru/" , startDate = ( 2016, Feb, 3 ) , endDate = ( 2016, Feb, 5 ) , location = "Moscow, Russia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Russian", Tag "Developers", Tag "Russia", Tag "PostgreSQL" ] } , { name = "Compose 2016" , link = "http://www.composeconference.org/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 5 ) , location = "Brooklyn, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming", Tag "Haskell", Tag "F#", Tag "OCaml", Tag "SML" ] } , { name = "<NAME>" , link = "http://www.rubyfuza.org/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 5 ) , location = "Cape Town, South Africa" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "South Africa", Tag "Ruby" ] } , { name = "SunshinePHP" , link = "http://2016.sunshinephp.com/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 6 ) , location = "Miami, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP" ] } , { name = "The Microservices Conference" , link = "http://microxchg.io/2016/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 5 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Microservices" ] } , { name = "UX/DEV Summit" , link = "http://uxdsummit.com/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 6 ) , location = "Fort Lauderdale, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX", Tag "AngularJS", Tag "Ember", Tag "React" ] } , { name = "Forward JS Workshops" , link = "http://forwardjs.com/home" , startDate = ( 2016, Feb, 8 ) , endDate = ( 2016, Feb, 9 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "NodeJS" ] } , { name = "Jfokus" , link = "http://www.jfokus.se/jfokus/" , startDate = ( 2016, Feb, 8 ) , endDate = ( 2016, Feb, 10 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Java", Tag "General" ] } , { name = "Jfokus IoT" , link = "http://www.jfokus.se/iot/" , startDate = ( 2016, Feb, 8 ) , endDate = ( 2016, Feb, 10 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Internet Of Things" ] } , { name = "Webstock" , link = "http://www.webstock.org.nz/16/" , startDate = ( 2016, Feb, 9 ) , endDate = ( 2016, Feb, 12 ) , location = "Wellington, New Zealand" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "New Zealand", Tag "General" ] } , { name = "Forward JS" , link = "http://forwardjs.com/home" , startDate = ( 2016, Feb, 10 ) , endDate = ( 2016, Feb, 10 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "NodeJS" ] } , { name = "RubyConf Australia" , link = "http://www.rubyconf.org.au/2016" , startDate = ( 2016, Feb, 10 ) , endDate = ( 2016, Feb, 13 ) , location = "Gold Coast, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Ruby" ] } , { name = "Clojure Remote" , link = "http://clojureremote.com/" , startDate = ( 2016, Feb, 11 ) , endDate = ( 2016, Feb, 12 ) , location = "Remote" , cfpStartDate = Just ( 2015, Oct, 30 ) , cfpEndDate = Just ( 2015, Dec, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Clojure", Tag "Functional Programming" ] } , { name = "Forward JS Workshops" , link = "http://forwardjs.com/home" , startDate = ( 2016, Feb, 11 ) , endDate = ( 2016, Feb, 13 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "NodeJS" ] } , { name = "DeveloperWeek" , link = "http://www.developerweek.com/" , startDate = ( 2016, Feb, 12 ) , endDate = ( 2016, Feb, 18 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Nov, 23 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "NodeJS", Tag "Python", Tag "PHP", Tag "DevOps", Tag "Ruby", Tag "Mobile", Tag "NoSQL", Tag "General" ] } , { name = "DevNexus" , link = "http://devnexus.com/s/index" , startDate = ( 2016, Feb, 15 ) , endDate = ( 2016, Feb, 17 ) , location = "Atlanta, GA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Agile", Tag "Big Data", Tag "Java", Tag "JavaScript", Tag "General" ] } , { name = "Spark Summit East" , link = "https://spark-summit.org/east-2016/" , startDate = ( 2016, Feb, 16 ) , endDate = ( 2016, Feb, 18 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data" ] } , { name = "Elastic{ON}" , link = "https://www.elastic.co/elasticon" , startDate = ( 2016, Feb, 17 ) , endDate = ( 2016, Feb, 19 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Nov, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "MongoDB", Tag "Big Data", Tag "Elasticsearch", Tag "Logstash" ] } , { name = "DrupalCon Asia" , link = "https://events.drupal.org/asia2016" , startDate = ( 2016, Feb, 18 ) , endDate = ( 2016, Feb, 21 ) , location = "Mumbai, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Nov, 2 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Drupal", Tag "PHP" ] } , { name = "hello.<NAME>" , link = "http://hellojs.org/" , startDate = ( 2016, Feb, 18 ) , endDate = ( 2016, Feb, 19 ) , location = "Cluj-Napoca, Romania" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Romania", Tag "JavaScript" ] } , { name = "<NAME>" , link = "http://www.lambdadays.org/" , startDate = ( 2016, Feb, 18 ) , endDate = ( 2016, Feb, 19 ) , location = "Krakow, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Functional Programming", Tag "Erlang" ] } , { name = "<NAME>" , link = "http://bobkonf.de/2016/en/" , startDate = ( 2016, Feb, 19 ) , endDate = ( 2016, Feb, 19 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "German", Tag "Developers", Tag "Germany", Tag "Functional Programming", Tag "Clojure", Tag "Haskell", Tag "Scala", Tag "Erlang" ] } , { name = "GopherCon India" , link = "http://www.gophercon.in/" , startDate = ( 2016, Feb, 19 ) , endDate = ( 2016, Feb, 10 ) , location = "Bengaluru, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Go" ] } , { name = "Bulgaria Web Summit" , link = "http://bulgariawebsummit.com/" , startDate = ( 2016, Feb, 20 ) , endDate = ( 2016, Feb, 20 ) , location = "Sofia, Bulgaria" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Bulgaria", Tag "UX", Tag "JavaScript", Tag "General" ] } , { name = ":clojureD" , link = "http://www.clojured.de/" , startDate = ( 2016, Feb, 20 ) , endDate = ( 2016, Feb, 20 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Functional Programming", Tag "Clojure" ] } , { name = "The Rolling Scopes Conference" , link = "http://2016.conf.rollingscopes.com/" , startDate = ( 2016, Feb, 20 ) , endDate = ( 2016, Feb, 21 ) , location = "Minsk, Belarus" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Russian", Tag "Developers", Tag "Belarus", Tag "CSS", Tag "NodeJS", Tag "JavaScript" ] } , { name = "How.Camp" , link = "http://how.camp/" , startDate = ( 2016, Feb, 21 ) , endDate = ( 2016, Feb, 21 ) , location = "Sofia, Bulgaria" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Bulgaria", Tag "UX", Tag "JavaScript" ] } , { name = "React.js Conf" , link = "http://conf.reactjs.com/" , startDate = ( 2016, Feb, 22 ) , endDate = ( 2016, Feb, 23 ) , location = "San Francisco, CA" , cfpStartDate = Just ( 2015, Nov, 25 ) , cfpEndDate = Just ( 2015, Dec, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "React", Tag "JavaScript" ] } , { name = "<NAME>" , link = "http://www.gophercon.ae/" , startDate = ( 2016, Feb, 23 ) , endDate = ( 2016, Feb, 23 ) , location = "Dubai, UAE" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "Go" ] } , { name = "JavaScript Summit" , link = "http://environmentsforhumans.com/2016/javascript-summit/" , startDate = ( 2016, Feb, 23 ) , endDate = ( 2016, Feb, 23 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript" ] } , { name = "UXistanbul" , link = "http://uxistanbul.org/" , startDate = ( 2016, Feb, 23 ) , endDate = ( 2016, Feb, 23 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Turkey", Tag "UX" ] } , { name = "<NAME>" , link = "http://confoo.ca/en" , startDate = ( 2016, Feb, 24 ) , endDate = ( 2016, Feb, 26 ) , location = "Montreal, QC, Canada" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "French", Tag "Developers", Tag "Canada", Tag "General" ] } , { name = "Freelance Remote Conf" , link = "https://allremoteconfs.com/freelance-2016" , startDate = ( 2016, Feb, 24 ) , endDate = ( 2016, Feb, 26 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Designers", Tag "Remote", Tag "General", Tag "Soft Skills" ] } , { name = "UX Riga" , link = "http://www.uxriga.lv/" , startDate = ( 2016, Feb, 25 ) , endDate = ( 2016, Feb, 25 ) , location = "Riga, Latvia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Latvia", Tag "UX" ] } , { name = "Interaction 16" , link = "http://interaction16.ixda.org/" , startDate = ( 2016, Mar, 1 ) , endDate = ( 2016, Mar, 4 ) , location = "Helsinki, Finland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Finland", Tag "UX" ] } , { name = "try! Swift" , link = "http://www.tryswiftconf.com/en" , startDate = ( 2016, Mar, 2 ) , endDate = ( 2016, Mar, 4 ) , location = "Tokyo, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Swift", Tag "IOS" ] } , { name = "EnhanceConf" , link = "http://enhanceconf.com/" , startDate = ( 2016, Mar, 3 ) , endDate = ( 2016, Mar, 4 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "CSS", Tag "JavaScript", Tag "Progressive Enhancement" ] } , { name = "fsharpConf" , link = "http://fsharpconf.com/" , startDate = ( 2016, Mar, 4 ) , endDate = ( 2016, Mar, 4 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "F#", Tag ".Net", Tag "Functional Programming" ] } , { name = "<NAME>" , link = "http://chamberconf.pl/" , startDate = ( 2016, Mar, 5 ) , endDate = ( 2016, Mar, 6 ) , location = "Moszna, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Polish", Tag "Developers", Tag "Poland", Tag "General" ] } , { name = "<NAME>" , link = "http://www.droidcon.tn/" , startDate = ( 2016, Mar, 5 ) , endDate = ( 2016, Mar, 6 ) , location = "Hammamet, Tunisia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Tunisia", Tag "Android", Tag "Mobile" ] } , { name = "Frontend Conference" , link = "http://kfug.jp/frontconf2016/" , startDate = ( 2016, Mar, 5 ) , endDate = ( 2016, Mar, 5 ) , location = "Osaka, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Japanese", Tag "Designers", Tag "Developers", Tag "Japan", Tag "UX", Tag "JavaScript", Tag "CSS", Tag "AngularJS" ] } , { name = "Big Data Paris" , link = "http://www.bigdataparis.com/" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 8 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "French", Tag "Developers", Tag "France", Tag "MongoDB", Tag "Big Data" ] } , { name = "Erlang Factory SF Workshops" , link = "http://www.erlang-factory.com/sfbay2016/home" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 9 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Erlang" ] } , { name = "Fluent Conf Trainings" , link = "http://conferences.oreilly.com/fluent/javascript-html-us" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 8 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "CSS", Tag "JavaScript", Tag "UX", Tag "React", Tag "AngularJS", Tag "Docker" ] } , { name = "QCon London" , link = "http://qconlondon.com/" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 9 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "Fluent Conf" , link = "http://conferences.oreilly.com/fluent/javascript-html-us" , startDate = ( 2016, Mar, 8 ) , endDate = ( 2016, Mar, 10 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "CSS", Tag "JavaScript", Tag "UX", Tag "React", Tag "AngularJS", Tag "Docker" ] } , { name = "jDays" , link = "http://www.jdays.se/" , startDate = ( 2016, Mar, 8 ) , endDate = ( 2016, Mar, 9 ) , location = "Gothenburg, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Java" ] } , { name = "Apache Geode Summit" , link = "http://geodesummit.com/" , startDate = ( 2016, Mar, 9 ) , endDate = ( 2016, Mar, 9 ) , location = "Palo Alto, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data", Tag "Cloud" ] } , { name = "Erlang Factory SF" , link = "http://www.erlang-factory.com/sfbay2016/home" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 11 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Erlang" ] } , { name = "ScaleConf" , link = "http://scaleconf.org/" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 11 ) , location = "Cape Town, South Africa" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "South Africa", Tag "Scalability" ] } , { name = "SoCraTes ES" , link = "http://www.socrates-conference.es/doku.php" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 13 ) , location = "Gran Canaria, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Software Craftsmanship" ] } , { name = "QCon London Tutorials" , link = "http://qconlondon.com/" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 11 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "<NAME>" , link = "http://bathruby.us1.list-manage1.com/subscribe?u=f18bb7508370614edaffb50dd&id=73743da027" , startDate = ( 2016, Mar, 11 ) , endDate = ( 2016, Mar, 11 ) , location = "Bath, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Ruby" ] } , { name = "RWDevCon 2016" , link = "http://rwdevcon.com/" , startDate = ( 2016, Mar, 11 ) , endDate = ( 2016, Mar, 12 ) , location = "Alexandria, VA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Swift" ] } , { name = "wroc_love.rb" , link = "http://www.wrocloverb.com/" , startDate = ( 2016, Mar, 11 ) , endDate = ( 2016, Mar, 13 ) , location = "Wroclaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Ruby" ] } , { name = "<NAME>" , link = "http://www.jsconfbeirut.com/" , startDate = ( 2016, Mar, 12 ) , endDate = ( 2016, Mar, 13 ) , location = "Beirut, Lebanon" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Lebanon", Tag "JavaScript" ] } , { name = "An Event Apart Nashville" , link = "http://aneventapart.com/event/nashville-2016" , startDate = ( 2016, Mar, 14 ) , endDate = ( 2016, Mar, 16 ) , location = "Nashville, TN" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "<NAME>ose<NAME>" , link = "http://cocoaconf.com/yosem<NAME>" , startDate = ( 2016, Mar, 14 ) , endDate = ( 2016, Mar, 17 ) , location = "National Park, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Cocoa" ] } , { name = "Erlang Factory SF Workshops" , link = "http://www.erlang-factory.com/sfbay2016/home" , startDate = ( 2016, Mar, 14 ) , endDate = ( 2016, Mar, 16 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Erlang" ] } , { name = "<NAME>" , link = "http://smashingconf.com/" , startDate = ( 2016, Mar, 15 ) , endDate = ( 2016, Mar, 16 ) , location = "Oxford, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "UX" ] } , { name = "<NAME>" , link = "http://dibiconference.com/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 18 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Scotland", Tag "UX" ] } , { name = "<NAME> San Francisco" , link = "http://sf.droidcon.com/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 18 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Android", Tag "Mobile" ] } , { name = "mdevcon" , link = "http://mdevcon.com/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 18 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Just ( 2015, Nov, 8 ) , cfpEndDate = Just ( 2015, Dec, 23 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "Mobile", Tag "IOS", Tag "Android" ] } , { name = "<NAME>" , link = "http://2016.nordicpgday.org/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 17 ) , location = "Helsinki, Finland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Finland", Tag "PostgreSQL" ] } , { name = "pgDay Asia" , link = "http://2016.pgday.asia/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 19 ) , location = "Singapore" , cfpStartDate = Just ( 2015, Nov, 26 ) , cfpEndDate = Just ( 2016, Jan, 22 ) , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "PostgreSQL" ] } , { name = "Codemotion Rome" , link = "http://rome2016.codemotionworld.com/" , startDate = ( 2016, Mar, 18 ) , endDate = ( 2016, Mar, 19 ) , location = "Rome, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "General" ] } , { name = "Scale Summit" , link = "http://www.scalesummit.org/" , startDate = ( 2016, Mar, 18 ) , endDate = ( 2016, Mar, 18 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Scalability" ] } , { name = "Dutch Clojure Days" , link = "http://clojure.org/events/2016/dutch_clojure_days" , startDate = ( 2016, Mar, 19 ) , endDate = ( 2016, Mar, 19 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 23 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "Clojure", Tag "Functional Programming" ] } , { name = "GR8Day Warsaw" , link = "http://warsaw.gr8days.pl/" , startDate = ( 2016, Mar, 19 ) , endDate = ( 2016, Mar, 19 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "RubyConf India" , link = "http://rubyconfindia.org/" , startDate = ( 2016, Mar, 19 ) , endDate = ( 2016, Mar, 20 ) , location = "Kochi, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Ruby" ] } , { name = "<NAME>" , link = "https://attending.io/events/swiftaveiro" , startDate = ( 2016, Mar, 20 ) , endDate = ( 2016, Mar, 20 ) , location = "Aveiro, Portugal" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Portugal", Tag "IOS", Tag "Swift" ] } , { name = "MountainWest RubyConf" , link = "http://mtnwestrubyconf.org/2016/" , startDate = ( 2016, Mar, 21 ) , endDate = ( 2016, Mar, 22 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "PIPELINE" , link = "http://web.pipelineconf.info/" , startDate = ( 2016, Mar, 23 ) , endDate = ( 2016, Mar, 23 ) , location = "London, England" , cfpStartDate = Just ( 2015, Oct, 19 ) , cfpEndDate = Just ( 2015, Dec, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile" ] } , { name = "Ruby Remote Conf" , link = "https://allremoteconfs.com/ruby-2016" , startDate = ( 2016, Mar, 23 ) , endDate = ( 2016, Mar, 25 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Ruby" ] } , { name = "CocoaConf Chicago" , link = "http://cocoaconf.com/chicago-2016/home" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 26 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "CSS Day" , link = "http://2016.cssday.it/" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 25 ) , location = "Faenza, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Italian", Tag "Designers", Tag "Italy", Tag "CSS" ] } , { name = "Dev<NAME>" , link = "http://devexperience.ro/" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 25 ) , location = "Lasi, Romania" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Romania", Tag "General" ] } , { name = "<NAME>" , link = "http://droidcon.ae/" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 26 ) , location = "Dubai, UAE" , cfpStartDate = Just ( 2015, Oct, 27 ) , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "Android", Tag "Mobile" ] } , { name = "Space City JS" , link = "http://spacecity.codes/" , startDate = ( 2016, Mar, 26 ) , endDate = ( 2016, Mar, 26 ) , location = "Houston, TX" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "EmberConf" , link = "http://emberconf.com/" , startDate = ( 2016, Mar, 29 ) , endDate = ( 2016, Mar, 30 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ember" ] } , { name = "RWD Summit" , link = "http://environmentsforhumans.com/2016/responsive-web-design-summit/" , startDate = ( 2016, Mar, 29 ) , endDate = ( 2016, Mar, 31 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Remote", Tag "CSS", Tag "UX" ] } , { name = "<NAME>" , link = "http://clarityconf.com/" , startDate = ( 2016, Mar, 31 ) , endDate = ( 2016, Apr, 1 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "<NAME>" , link = "https://ruby.onales.com/" , startDate = ( 2016, Mar, 31 ) , endDate = ( 2016, Apr, 1 ) , location = "Bend, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "<NAME>" , link = "http://rome2016.codemotionworld.com/" , startDate = ( 2016, Apr, 1 ) , endDate = ( 2016, Apr, 2 ) , location = "Dubai, UAE" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "General" ] } , { name = "F<NAME>ish<NAME>!" , link = "http://flourishconf.com/2016/" , startDate = ( 2016, Apr, 1 ) , endDate = ( 2016, Apr, 2 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source" ] } , { name = "Front<NAME>ers Spring <NAME>" , link = "https://fronteers.nl/spring" , startDate = ( 2016, Apr, 1 ) , endDate = ( 2016, Apr, 1 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "JavaScript" ] } , { name = "An Event Apart Seattle" , link = "http://aneventapart.com/event/seattle-2016" , startDate = ( 2016, Apr, 4 ) , endDate = ( 2016, Apr, 6 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Istanbul Tech Talks" , link = "http://www.istanbultechtalks.com/" , startDate = ( 2016, Apr, 5 ) , endDate = ( 2016, Apr, 5 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Turkey", Tag "General" ] } , { name = "Smashing Conf SF" , link = "http://smashingconf.com/sf-2016/" , startDate = ( 2016, Apr, 5 ) , endDate = ( 2016, Apr, 6 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Ancient City Ruby" , link = "http://www.ancientcityruby.com/" , startDate = ( 2016, Apr, 6 ) , endDate = ( 2016, Apr, 8 ) , location = "St. Augustine, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "AWS Summit Bogotá" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 6 ) , endDate = ( 2016, Apr, 6 ) , location = "Bogotá, Colombia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Colombia", Tag "AWS", Tag "DevOps" ] } , { name = "droidcon Italy" , link = "http://it.droidcon.com/2016/" , startDate = ( 2016, Apr, 7 ) , endDate = ( 2016, Apr, 8 ) , location = "Turin, Italy" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "Android", Tag "Mobile" ] } , { name = "Respond 2016 Sydney" , link = "http://www.webdirections.org/respond16/" , startDate = ( 2016, Apr, 7 ) , endDate = ( 2016, Apr, 8 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "CSS", Tag "UX" ] } , { name = "<NAME>" , link = "http://rubyconf.ph/" , startDate = ( 2016, Apr, 7 ) , endDate = ( 2016, Apr, 9 ) , location = "Taguig, Philippines" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Philippines", Tag "Ruby" ] } , { name = "<NAME>" , link = "http://greachconf.com/" , startDate = ( 2016, Apr, 8 ) , endDate = ( 2016, Apr, 9 ) , location = "Madrid, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "<NAME>" , link = "http://jazoon.com/" , startDate = ( 2016, Apr, 8 ) , endDate = ( 2016, Apr, 8 ) , location = "Bern, Switzerland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Switzerland", Tag "JavaScript", Tag "AngularJS", Tag "Ember" ] } , { name = "<NAME>" , link = "http://www.alterconf.com/sessions/minneapolis-mn" , startDate = ( 2016, Apr, 9 ) , endDate = ( 2016, Apr, 9 ) , location = "Minneapolis, MN" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 1 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "Diversity", Tag "Soft Skills" ] } , { name = "<NAME>" , link = "http://mobcon.com/mobcon-europe/" , startDate = ( 2016, Apr, 10 ) , endDate = ( 2016, Apr, 10 ) , location = "Sofia, Bulgaria" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "Bulgaria", Tag "Mobile", Tag "IOS", Tag "Android" ] } , { name = "<NAME>16" , link = "http://www.webdirections.org/respond16/" , startDate = ( 2016, Apr, 11 ) , endDate = ( 2016, Apr, 12 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "CSS", Tag "UX" ] } , { name = "<NAME>" , link = "http://yggdrasilkonferansen.no/" , startDate = ( 2016, Apr, 11 ) , endDate = ( 2016, Apr, 12 ) , location = "Sandefjord, Norway" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Norwegian", Tag "Designers", Tag "Norway", Tag "UX" ] } , { name = "AWS Summit Berlin" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 12 ) , endDate = ( 2016, Apr, 12 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "AWS", Tag "DevOps" ] } , { name = "Converge SE" , link = "http://convergese.com/" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 15 ) , location = "Columbia, SC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "Hadoop Summit Europe" , link = "http://2016.hadoopsummit.org/dublin/" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 14 ) , location = "Dublin, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "Hadoop", Tag "Big Data", Tag "Internet Of Things" ] } , { name = "iOS Remote Conf" , link = "https://allremoteconfs.com/ios-2016" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 15 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "IOS" ] } , { name = "Peers Conference" , link = "http://peersconf.com/" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 15 ) , location = "St. Petersburg, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "Soft Skills" ] } , { name = "ACE! Conference" , link = "http://aceconf.com/" , startDate = ( 2016, Apr, 14 ) , endDate = ( 2016, Apr, 15 ) , location = "Krakow, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Agile", Tag "Software Craftsmanship" ] } , { name = "AWS Summit Milan" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 14 ) , endDate = ( 2016, Apr, 14 ) , location = "Milan, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "AWS", Tag "DevOps" ] } , { name = "Rootconf" , link = "https://rootconf.in/2016/" , startDate = ( 2016, Apr, 14 ) , endDate = ( 2016, Apr, 15 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "DevOps", Tag "Cloud" ] } , { name = "Clojure/west" , link = "http://clojurewest.org/" , startDate = ( 2016, Apr, 15 ) , endDate = ( 2016, Apr, 16 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Clojure", Tag "Functional Programming" ] } , { name = "<NAME>" , link = "http://cocoaconf.com/austin-2016/home" , startDate = ( 2016, Apr, 15 ) , endDate = ( 2016, Apr, 16 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "JSConf Uruguay" , link = "https://jsconf.uy/" , startDate = ( 2016, Apr, 15 ) , endDate = ( 2016, Apr, 16 ) , location = "Montevideo, Uruguay" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Uruguay", Tag "JavaScript" ] } , { name = "Scalar" , link = "http://scalar-conf.com/" , startDate = ( 2016, Apr, 16 ) , endDate = ( 2016, Apr, 16 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Scala" ] } , { name = "JavaScript Frameworks Day" , link = "http://frameworksdays.com/event/js-frameworks-day-2016" , startDate = ( 2016, Apr, 17 ) , endDate = ( 2016, Apr, 17 ) , location = "Kiev, Ukraine" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Russian", Tag "Developers", Tag "Ukraine", Tag "JavaScript" ] } , { name = "AWS Summit Chicago" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 18 ) , endDate = ( 2016, Apr, 19 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "PGConf US" , link = "http://www.pgconf.us/2016/" , startDate = ( 2016, Apr, 18 ) , endDate = ( 2016, Apr, 20 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PostgreSQL" ] } , { name = "ACCU" , link = "http://accu.org/index.php/conferences/accu_conference_2016" , startDate = ( 2016, Apr, 19 ) , endDate = ( 2016, Apr, 23 ) , location = "Bristol, England" , cfpStartDate = Just ( 2015, Oct, 12 ) , cfpEndDate = Just ( 2015, Nov, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General", Tag "C++" ] } , { name = "Industry Conf" , link = "http://2016.industryconf.com/" , startDate = ( 2016, Apr, 20 ) , endDate = ( 2016, Apr, 20 ) , location = "Newcastle, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "CycleConf" , link = "http://cycleconf.com/" , startDate = ( 2016, Apr, 21 ) , endDate = ( 2016, Apr, 24 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Denmark", Tag "CycleJS", Tag "JavaScript" ] } , { name = "MCE" , link = "http://mceconf.com/" , startDate = ( 2016, Apr, 21 ) , endDate = ( 2016, Apr, 22 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Poland", Tag "Mobile", Tag "UX" ] } , { name = "Render Conf" , link = "http://2016.render-conf.com/" , startDate = ( 2016, Apr, 21 ) , endDate = ( 2016, Apr, 22 ) , location = "Oxford, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "England", Tag "CSS", Tag "JavaScript", Tag "UX" ] } , { name = "dotSecurity" , link = "http://www.dotsecurity.io/" , startDate = ( 2016, Apr, 22 ) , endDate = ( 2016, Apr, 22 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Security" ] } , { name = "Generate NY" , link = "http://generateconf.com/new-york-2016" , startDate = ( 2016, Apr, 22 ) , endDate = ( 2016, Apr, 22 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "ProgSCon" , link = "http://progscon.co.uk/" , startDate = ( 2016, Apr, 22 ) , endDate = ( 2016, Apr, 22 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 21 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "Xamarin <NAME>" , link = "https://evolve.xamarin.com/" , startDate = ( 2016, Apr, 24 ) , endDate = ( 2016, Apr, 28 ) , location = "Orlando, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Mobile", Tag "IOS", Tag "Android", Tag ".Net" ] } , { name = "dotScale" , link = "http://www.dotscale.io/" , startDate = ( 2016, Apr, 25 ) , endDate = ( 2016, Apr, 25 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Scalability" ] } , { name = "OpenVis Conf" , link = "https://openvisconf.com/" , startDate = ( 2016, Apr, 25 ) , endDate = ( 2016, Apr, 26 ) , location = "Boston, MA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "DataVisualization" ] } , { name = "AWS Summit Kuala Lumpur" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 26 ) , location = "Kuala Lumpur, Malaysia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Malaysia", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Sydney" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 28 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "AWS", Tag "DevOps" ] } , { name = "Craft Conf" , link = "http://craft-conf.com/2016" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 29 ) , location = "Budapest, Hungary" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Hungary", Tag "Software Craftsmanship" ] } , { name = "Kafka Summit" , link = "http://kafka-summit.org/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 26 ) , location = "San Francisco, CA" , cfpStartDate = Just ( 2015, Sep, 29 ) , cfpEndDate = Just ( 2016, Jan, 11 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data" ] } , { name = "<NAME>" , link = "http://testistanbul.org/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 26 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Turkish", Tag "Developers", Tag "Turkey", Tag "Testing" ] } , { name = "<NAME>" , link = "http://droidcon.hr/en/" , startDate = ( 2016, Apr, 27 ) , endDate = ( 2016, Apr, 29 ) , location = "Zagreb, Croatia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Croatia", Tag "Android", Tag "Mobile" ] } , { name = "Squares <NAME>" , link = "http://squaresconference.com/" , startDate = ( 2016, Apr, 27 ) , endDate = ( 2016, Apr, 29 ) , location = "Grapevine, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "University of Illinois WebCon" , link = "http://webcon.illinois.edu/" , startDate = ( 2016, Apr, 27 ) , endDate = ( 2016, Apr, 28 ) , location = "Champaign, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "AWS Summit Buenos Aires" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 28 ) , location = "Buenos Aires, Argentina" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Argentina", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Singapore" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 28 ) , location = "Singapore" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "AWS", Tag "DevOps" ] } , { name = "<NAME>North" , link = "http://nsnorth.ca/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 30 ) , location = "Toronto, Ontario, Canada" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "IOS" ] } , { name = "<NAME>" , link = "http://lambdajam.yowconference.com.au/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 29 ) , location = "Brisbane, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Functional Programming" ] } , { name = "<NAME>SDayES" , link = "http://jsday.es/" , startDate = ( 2016, Apr, 29 ) , endDate = ( 2016, Apr, 30 ) , location = "Madrid, Spain" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "Spanish", Tag "Developers", Tag "Spain", Tag "JavaScript", Tag "NodeJS", Tag "AngularJS" ] } , { name = "Chicago Code Camp" , link = "http://www.chicagocodecamp.com/" , startDate = ( 2016, Apr, 30 ) , endDate = ( 2016, Apr, 30 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "flatMap(Oslo)" , link = "http://2016.flatmap.no/" , startDate = ( 2016, May, 2 ) , endDate = ( 2016, May, 3 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 3 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Scala", Tag "Functional Programming", Tag "Java" ] } , { name = "AWS Summit Santiago" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 3 ) , location = "Santiago, Chile" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Chile", Tag "AWS", Tag "DevOps" ] } , { name = "Continuous Lifecycle London" , link = "http://continuouslifecycle.london/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 5 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "DevOps" ] } , { name = "JSConf Belgium" , link = "https://jsconf.be/nl/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 3 ) , location = "Brugge, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "JavaScript" ] } , { name = "YOW! West" , link = "http://west.yowconference.com.au/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 4 ) , location = "Perth, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "General" ] } , { name = "ng-conf" , link = "http://www.ng-conf.org/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 6 ) , location = "Salt Lake City, UT" , cfpStartDate = Just ( 2016, Jan, 13 ) , cfpEndDate = Just ( 2016, Feb, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS" ] } , { name = "AWS Summit Stockholm" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 4 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "AWS", Tag "DevOps" ] } , { name = "RailsConf" , link = "http://railsconf.com/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 6 ) , location = "Kansas City, MO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby", Tag "Rails" ] } , { name = "Typelevel Summit" , link = "http://typelevel.org/event/2016-05-summit-oslo/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 4 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 3 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Scala", Tag "Functional Programming", Tag "Java" ] } , { name = "AWS Summit Manila" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 5 ) , endDate = ( 2016, May, 5 ) , location = "Manila, Philippines" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Philippines", Tag "AWS", Tag "DevOps" ] } , { name = "CocoaConf Seattle" , link = "http://cocoaconf.com/seattle-2016/home" , startDate = ( 2016, May, 6 ) , endDate = ( 2016, May, 7 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Cocoa" ] } , { name = "<NAME>" , link = "http://2016.syntaxcon.com/" , startDate = ( 2016, May, 6 ) , endDate = ( 2016, May, 7 ) , location = "Charleston, SC" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "!!<NAME>" , link = "http://bangbangcon.com/" , startDate = ( 2016, May, 7 ) , endDate = ( 2016, May, 8 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "9th European Lisp Symposium" , link = "http://www.european-lisp-symposium.org/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 10 ) , location = "Krakow, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 19 ) , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Lisp", Tag "Clojure" ] } , { name = "Apache: Big Data North America" , link = "http://www.apachecon.com/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "Vancouver, BC, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Big Data" ] } , { name = "<NAME>" , link = "http://beyondtellerrand.com/events/duesseldorf-2016" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "Düsseldorf, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Germany", Tag "UX", Tag "General" ] } , { name = "C++Now" , link = "http://cppnow.org/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 14 ) , location = "Aspen, CO" , cfpStartDate = Just ( 2015, Nov, 17 ) , cfpEndDate = Just ( 2016, Jan, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "C++" ] } , { name = "ChefConf" , link = "https://www.chef.io/chefconf/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Chef", Tag "DevOps" ] } , { name = "DrupalCon New Orleans" , link = "https://events.drupal.org/neworleans2016/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 13 ) , location = "New Orleans, LA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Drupal", Tag "PHP" ] } , { name = "Scala Days New York" , link = "http://event.scaladays.org/scaladays-nyc-2016" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Scala" ] } , { name = "Codemotion Amsterdam" , link = "http://amsterdam2016.codemotionworld.com/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 12 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "CSSConf Budapest" , link = "http://cssconfbp.rocks/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 11 ) , location = "Budapest, Hungary" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Hungary", Tag "CSS" ] } , { name = "ElixirConf EU" , link = "http://www.elixirconf.eu/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 12 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Elixir", Tag "Functional Programming", Tag "Erlang" ] } , { name = "jsDay" , link = "http://2016.jsday.it/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 12 ) , location = "Verona, Italy" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "JavaScript" ] } , { name = "React Remote Conf" , link = "https://allremoteconfs.com/react-2016" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 13 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 9 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript", Tag "React" ] } , { name = "UX Alive" , link = "http://www.uxalive.com/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 13 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Turkey", Tag "UX" ] } , { name = "ApacheCon Core North America" , link = "http://www.apachecon.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Vancouver, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Open Source" ] } , { name = "Front Conference" , link = "http://www.frontutah.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "JSConf Budapest" , link = "http://jsconfbp.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Budapest, Hungary" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Hungary", Tag "JavaScript" ] } , { name = "An Event Apart Boston" , link = "http://aneventapart.com/event/boston-2016" , startDate = ( 2016, May, 16 ) , endDate = ( 2016, May, 18 ) , location = "Boston, MA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Open Source Convention Tutorials" , link = "http://conferences.oreilly.com/oscon/open-source" , startDate = ( 2016, May, 16 ) , endDate = ( 2016, May, 17 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source" ] } , { name = "AWS Summit Seoul" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 17 ) , endDate = ( 2016, May, 17 ) , location = "Seoul, South Korea" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "South Korea", Tag "AWS", Tag "DevOps" ] } , { name = "Front-Trends" , link = "http://2016.front-trends.com/" , startDate = ( 2016, May, 18 ) , endDate = ( 2016, May, 20 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 4 ) , tags = [ Tag "English", Tag "Designers", Tag "Poland", Tag "UX" ] } , { name = "Open Source Convention" , link = "http://conferences.oreilly.com/oscon/open-source" , startDate = ( 2016, May, 18 ) , endDate = ( 2016, May, 19 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source" ] } , { name = "UX London" , link = "http://2016.uxlondon.com/" , startDate = ( 2016, May, 18 ) , endDate = ( 2016, May, 20 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "UX" ] } , { name = "<NAME>" , link = "http://www.droidcon.ca/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 20 ) , location = "Montreal, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 4 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Android", Tag "Mobile" ] } , { name = "PhoneGap Day EU" , link = "http://pgday.phonegap.com/eu2016/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 20 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "PhoneGap", Tag "Mobile" ] } , { name = "<NAME>" , link = "http://valiocon.com/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 22 ) , location = "San Diego, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "AWS Summit Taipei" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 20 ) , endDate = ( 2016, May, 20 ) , location = "Taipei, Taiwan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Taiwan", Tag "AWS", Tag "DevOps" ] } , { name = "self.conference" , link = "http://selfconference.org/" , startDate = ( 2016, May, 20 ) , endDate = ( 2016, May, 21 ) , location = "Detroit, MI" , cfpStartDate = Just ( 2016, Jan, 18 ) , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "General", Tag "Soft Skills" ] } , { name = "EmpEx" , link = "http://empex.co/" , startDate = ( 2016, May, 21 ) , endDate = ( 2016, May, 21 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Mar, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Elixir", Tag "Functional Programming" ] } , { name = "UIKonf" , link = "http://www.uikonf.com/" , startDate = ( 2016, May, 22 ) , endDate = ( 2016, May, 25 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "IOS" ] } , { name = "GOTO Chicago Workshops" , link = "http://gotocon.com/chicago-2016" , startDate = ( 2016, May, 23 ) , endDate = ( 2016, May, 23 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "php[tek]" , link = "https://tek.phparch.com/" , startDate = ( 2016, May, 23 ) , endDate = ( 2016, May, 27 ) , location = "St. Louis, MO" , cfpStartDate = Just ( 2015, Dec, 14 ) , cfpEndDate = Just ( 2016, Jan, 16 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP" ] } , { name = "AWS Summit Netherlands" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 24 ) , location = "Nieuwegein, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "AWS", Tag "DevOps" ] } , { name = "GOTO Chicago" , link = "http://gotocon.com/chicago-2016" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 25 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "AWS Summit Mumbai" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "Mumbai, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "AWS", Tag "DevOps" ] } , { name = "HBaseCon" , link = "http://www.hbasecon.com/" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Hadoop", Tag "Big Data", Tag "Cloud" ] } , { name = "SIGNAL 2016" , link = "https://www.twilio.com/signal" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 25 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Communications" ] } , { name = "UXLx" , link = "https://www.ux-lx.com/" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 27 ) , location = "Lisbon, Portugal" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Portugal", Tag "UX" ] } , { name = "GlueCon" , link = "http://gluecon.com/" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 26 ) , location = "Broomfield, CO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General", Tag "DevOps", Tag "Big Data" ] } , { name = "PrlConf" , link = "http://www.jonprl.org/prlconf" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "Boulder, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming" ] } , { name = "PureScript Conf" , link = "https://github.com/purescript/purescript/wiki/PureScript-Conf-2016" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "Boulder, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming", Tag "PureScript" ] } , { name = "AWS Summit Mexico City" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 26 ) , location = "Mexico City, Mexico" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Mexico", Tag "AWS", Tag "DevOps" ] } , { name = "DevSum" , link = "http://www.devsum.se/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 27 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag ".Net" ] } , { name = "GOTO Chicago Workshops" , link = "http://gotocon.com/chicago-2016" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 26 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "iOSCon" , link = "https://skillsmatter.com/conferences/7598-ioscon-2016-the-conference-for-ios-and-swift-developers" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 27 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "IOS" ] } , { name = "<NAME>" , link = "http://lambdaconf.us/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 29 ) , location = "Boulder, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming", Tag "Haskell", Tag "Scala", Tag "PureScript" ] } , { name = "Frontend United" , link = "http://frontendunited.org/" , startDate = ( 2016, May, 27 ) , endDate = ( 2016, May, 28 ) , location = "Ghent, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Belgium", Tag "UX", Tag "Drupal", Tag "PHP" ] } , { name = "<NAME>Con Tutorials" , link = "https://us.pycon.org/2016/" , startDate = ( 2016, May, 28 ) , endDate = ( 2016, May, 29 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Python" ] } , { name = "<NAME>" , link = "https://us.pycon.org/2016/" , startDate = ( 2016, May, 30 ) , endDate = ( 2016, Jun, 1 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Python" ] } , { name = "AWS Summit Paris" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 31 ) , endDate = ( 2016, May, 31 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Tokyo" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 3 ) , location = "Tokyo, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "AWS", Tag "DevOps" ] } , { name = "CSSConf Nordic" , link = "http://cssconf.no/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 1 ) , location = "Oslo, Norway" , cfpStartDate = Just ( 2015, Dec, 23 ) , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Norway", Tag "UX", Tag "CSS" ] } , { name = "Git Remote Conf" , link = "https://allremoteconfs.com/git-2016" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 3 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 6 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Remote", Tag "Git" ] } , { name = "<NAME>agmaConf" , link = "http://www.magmaconf.com/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 3 ) , location = "Manzanillo, Mexico" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Mexico", Tag "Ruby" ] } , { name = "ScotlandCSS" , link = "http://scotlandcss.launchrock.com/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 1 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Scotland", Tag "CSS" ] } , { name = "AWS Summit Madrid" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 2 ) , location = "Madrid, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Sao Paulo" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 2 ) , location = "Sao Paulo, Brazil" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Brazil", Tag "AWS", Tag "DevOps" ] } , { name = "GR8Conf EU" , link = "http://gr8conf.eu/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 4 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Denmark", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "PyCon Sprints" , link = "https://us.pycon.org/2016/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 5 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Python" ] } , { name = "ReactEurope" , link = "https://www.react-europe.org/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 3 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "React", Tag "JavaScript" ] } , { name = "Scotland JS" , link = "http://scotlandjs.com/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 3 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Scotland", Tag "JavaScript" ] } , { name = "SoCraTes England" , link = "http://socratesuk.org/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 5 ) , location = "Dorking, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Software Craftsmanship" ] } , { name = "<NAME>" , link = "https://www.webrebels.org/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 3 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "JavaScript" ] } , { name = "NodeConf Oslo" , link = "http://oslo.nodeconf.com/" , startDate = ( 2016, Jun, 4 ) , endDate = ( 2016, Jun, 4 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "NodeJS", Tag "JavaScript" ] } , { name = "<NAME>" , link = "http://berlinbuzzwords.de/" , startDate = ( 2016, Jun, 5 ) , endDate = ( 2016, Jun, 7 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 7 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Big Data" ] } , { name = "NDC Oslo Workshops" , link = "http://ndcoslo.com/" , startDate = ( 2016, Jun, 6 ) , endDate = ( 2016, Jun, 7 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "Spark Summit" , link = "https://spark-summit.org/2016/" , startDate = ( 2016, Jun, 6 ) , endDate = ( 2016, Jun, 8 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data" ] } , { name = "NDC Oslo" , link = "http://ndcoslo.com/" , startDate = ( 2016, Jun, 8 ) , endDate = ( 2016, Jun, 10 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "UX Scotland" , link = "http://uxscotland.net/2016/" , startDate = ( 2016, Jun, 8 ) , endDate = ( 2016, Jun, 10 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Scotland", Tag "UX" ] } , { name = "NodeConf" , link = "http://nodeconf.com/" , startDate = ( 2016, Jun, 9 ) , endDate = ( 2016, Jun, 12 ) , location = "Petaluma, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "NodeJS", Tag "JavaScript" ] } , { name = "GOTO Amsterdam Workshops" , link = "http://gotocon.com/amsterdam-2016/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 13 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "QCon New York" , link = "https://qconnewyork.com/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 15 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "enterJS" , link = "https://www.enterjs.de/" , startDate = ( 2016, Jun, 14 ) , endDate = ( 2016, Jun, 16 ) , location = "Darmstadt, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "German", Tag "Developers", Tag "Germany", Tag "JavaScript" ] } , { name = "GOTO Amsterdam" , link = "http://gotocon.com/amsterdam-2016/" , startDate = ( 2016, Jun, 14 ) , endDate = ( 2016, Jun, 15 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Just ( 2016, Jan, 14 ) , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "<NAME>" , link = "http://droidcon.de/" , startDate = ( 2016, Jun, 15 ) , endDate = ( 2016, Jun, 17 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Android", Tag "Mobile" ] } , { name = "Front End Design Conference" , link = "http://frontenddesignconference.com/" , startDate = ( 2016, Jun, 15 ) , endDate = ( 2016, Jun, 17 ) , location = "St. Petersburg, FL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Scala Days Berlin" , link = "http://event.scaladays.org/scaladays-berlin-2016" , startDate = ( 2016, May, 15 ) , endDate = ( 2016, May, 17 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Scala" ] } , { name = "AWS Summit Tel Aviv" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 16 ) , endDate = ( 2016, Jun, 16 ) , location = "Tel Aviv, Israel" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Israel", Tag "AWS", Tag "DevOps" ] } , { name = "CSS Day" , link = "http://cssday.nl/2016" , startDate = ( 2016, Jun, 16 ) , endDate = ( 2016, Jun, 17 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Netherlands", Tag "CSS" ] } , { name = "QCon New York Tutorials" , link = "https://qconnewyork.com/" , startDate = ( 2016, Jun, 16 ) , endDate = ( 2016, Jun, 17 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "Joy of Coding" , link = "http://joyofcoding.org/" , startDate = ( 2016, Jun, 17 ) , endDate = ( 2016, Jun, 17 ) , location = "Rotterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 17 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "<NAME>" , link = "http://www.nordicruby.org/" , startDate = ( 2016, Jun, 17 ) , endDate = ( 2016, Jun, 19 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Ruby" ] } , { name = "DockerCon" , link = "http://2016.dockercon.com/" , startDate = ( 2016, Jun, 19 ) , endDate = ( 2016, Jun, 21 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Docker" ] } , { name = "Public Sector Summit" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 20 ) , endDate = ( 2016, Jun, 21 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "O'Reilly Velocity" , link = "http://conferences.oreilly.com/velocity/devops-web-performance-ca/" , startDate = ( 2016, Jun, 21 ) , endDate = ( 2016, Jun, 23 ) , location = "Santa Clara, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 11 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Scalability", Tag "DevOps" ] } , { name = "Code<NAME>" , link = "http://dublin2016.codemotionworld.com/" , startDate = ( 2016, Jun, 22 ) , endDate = ( 2016, Jun, 23 ) , location = "Dublin, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "General" ] } , { name = "RedDotRubyConf" , link = "http://www.reddotrubyconf.com/" , startDate = ( 2016, Jun, 23 ) , endDate = ( 2016, Jun, 24 ) , location = "Singapore" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "Ruby" ] } , { name = "Web <NAME>" , link = "http://webdesignday.com/" , startDate = ( 2016, Jun, 23 ) , endDate = ( 2016, Jun, 24 ) , location = "Pittsburgh, PA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Dinos<NAME>.js" , link = "http://dinosaurjs.org/" , startDate = ( 2016, Jun, 24 ) , endDate = ( 2016, Jun, 24 ) , location = "Denver, CO" , cfpStartDate = Just ( 2016, Feb, 1 ) , cfpEndDate = Just ( 2016, Mar, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "<NAME>" , link = "http://www.giantux.com/conf2016/" , startDate = ( 2016, Jun, 27 ) , endDate = ( 2016, Jun, 29 ) , location = "TBD" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "<NAME>ta Love Frontend" , link = "http://yougottalovefrontend.com/" , startDate = ( 2016, Jun, 27 ) , endDate = ( 2016, Jun, 28 ) , location = "Tel Aviv, Israel" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Israel", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "CSS", Tag "General" ] } , { name = "Hadoop Summit North America" , link = "http://2016.hadoopsummit.org/san-jose/" , startDate = ( 2016, Jun, 28 ) , endDate = ( 2016, Jun, 30 ) , location = "San Jose, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Hadoop", Tag "Big Data", Tag "Internet Of Things" ] } , { name = "MongoDB World 2016" , link = "https://www.mongodb.com/world16" , startDate = ( 2016, Jun, 28 ) , endDate = ( 2016, Jun, 29 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "MongoDB", Tag "Big Data" ] } , { name = "AWS Summit Auckland" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 29 ) , endDate = ( 2016, Jun, 29 ) , location = "Auckland, New Zealand" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "New Zealand", Tag "AWS", Tag "DevOps" ] } , { name = "PolyConf" , link = "http://polyconf.com/" , startDate = ( 2016, Jun, 30 ) , endDate = ( 2016, Jul, 2 ) , location = "Poznan, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "General" ] } , { name = "AWS Summit London" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jul, 6 ) , endDate = ( 2016, Jul, 7 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "AWS", Tag "DevOps" ] } , { name = "<NAME>" , link = "http://brightonruby.com/" , startDate = ( 2016, Jul, 8 ) , endDate = ( 2016, Jul, 8 ) , location = "Brighton, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Ruby" ] } , { name = "<NAME>" , link = "https://www.chef.io/chefconf/" , startDate = ( 2016, Jul, 11 ) , endDate = ( 2016, Jul, 13 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Chef", Tag "DevOps" ] } , { name = "<NAME>" , link = "https://www.gophercon.com/" , startDate = ( 2016, Jul, 11 ) , endDate = ( 2016, Jul, 13 ) , location = "Denver, CO" , cfpStartDate = Just ( 2016, Jan, 1 ) , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Go" ] } , { name = "AWS Summit Santa Clara" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jul, 12 ) , endDate = ( 2016, Jul, 13 ) , location = "Santa Clara, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "Newbie Remote Conf" , link = "https://allremoteconfs.com/newbie-2016" , startDate = ( 2016, Jul, 13 ) , endDate = ( 2016, Jul, 15 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 11 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Remote", Tag "General" ] } , { name = "Generate San Francisco" , link = "http://www.generateconf.com/san-francisco-2016/" , startDate = ( 2016, Jul, 15 ) , endDate = ( 2016, Jul, 15 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "EuroPython" , link = "http://ep2016.europython.eu/" , startDate = ( 2016, Jul, 17 ) , endDate = ( 2016, Jul, 24 ) , location = "Bilbao, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Python" ] } , { name = "php[cruise]" , link = "https://cruise.phparch.com/" , startDate = ( 2016, Jul, 17 ) , endDate = ( 2016, Jul, 24 ) , location = "Baltimore, MD" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP" ] } , { name = "<NAME>" , link = "http://curry-on.org/2016/" , startDate = ( 2016, Jul, 18 ) , endDate = ( 2016, Jul, 19 ) , location = "Rome, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "General" ] } , { name = "U<NAME>" , link = "https://uberconf.com/conference/denver/2016/07/home" , startDate = ( 2016, Jul, 19 ) , endDate = ( 2016, Jul, 22 ) , location = "Denver, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Java", Tag "Agile", Tag "Cloud", Tag "Scala", Tag "Groovy" ] } , { name = "European Conference on Object-Oriented Programming" , link = "http://2016.ecoop.org/" , startDate = ( 2016, Jul, 20 ) , endDate = ( 2016, Jul, 22 ) , location = "Rome, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "General" ] } , { name = "An Event Apart DC" , link = "http://aneventapart.com/event/washington-dc-2016" , startDate = ( 2016, Jul, 25 ) , endDate = ( 2016, Jul, 27 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Mobile & Web CodeCamp" , link = "http://www.mobilewebcodecamp.com/" , startDate = ( 2016, Jul, 26 ) , endDate = ( 2016, Jul, 29 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Mobile", Tag "Android", Tag "IOS", Tag "JavaScript", Tag "PhoneGap" ] } , { name = "GR8Conf US" , link = "http://gr8conf.org/" , startDate = ( 2016, Jul, 27 ) , endDate = ( 2016, Jul, 29 ) , location = "Minneapolis, MN" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "Forward 5 Web Summit" , link = "http://forwardjs.com/" , startDate = ( 2016, Jul, 28 ) , endDate = ( 2016, Jul, 28 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "Forward Swift" , link = "http://forwardjs.com/" , startDate = ( 2016, Jul, 28 ) , endDate = ( 2016, Jul, 28 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Swift" ] } , { name = "NDC Sydney Workshops" , link = "http://ndcsydney.com/" , startDate = ( 2016, Aug, 1 ) , endDate = ( 2016, Aug, 2 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "AWS Summit Canberra" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Aug, 3 ) , endDate = ( 2016, Aug, 3 ) , location = "Canberra, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "AWS", Tag "DevOps" ] } , { name = "NDC Sydney" , link = "http://ndcsydney.com/" , startDate = ( 2016, Aug, 3 ) , endDate = ( 2016, Aug, 5 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "CSSconf Argentina" , link = "http://cssconfar.com/" , startDate = ( 2016, Aug, 7 ) , endDate = ( 2016, Aug, 7 ) , location = "Buenos Aires, Argentina" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Argentina", Tag "CSS" ] } , { name = "That Conference" , link = "https://www.thatconference.com/" , startDate = ( 2016, Aug, 8 ) , endDate = ( 2016, Aug, 10 ) , location = "Wisconsin Dells, WI" , cfpStartDate = Just ( 2016, Mar, 1 ) , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Mobile", Tag "Cloud" ] } , { name = "AWS Summit New York" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Aug, 10 ) , endDate = ( 2016, Aug, 11 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "Mid<NAME> JS" , link = "http://midwestjs.com/" , startDate = ( 2016, Aug, 10 ) , endDate = ( 2016, Aug, 12 ) , location = "Minneapolis, MN" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "NodeJS" ] } , { name = "Robots Remote Conf" , link = "https://allremoteconfs.com/robots-2016" , startDate = ( 2016, Aug, 10 ) , endDate = ( 2016, Aug, 12 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jul, 9 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Robotics" ] } , { name = "<NAME>" , link = "http://fpconf.org/" , startDate = ( 2016, Aug, 15 ) , endDate = ( 2016, Aug, 15 ) , location = "Moscow, Russia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Russian", Tag "Developers", Tag "Russia", Tag "Functional Programming", Tag "Erlang", Tag "Scala", Tag "Clojure", Tag "Haskell" ] } , { name = "Abstractions" , link = "http://abstractions.io/" , startDate = ( 2016, Aug, 18 ) , endDate = ( 2016, Aug, 20 ) , location = "Pittsburgh, PA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "HybridConf" , link = "https://hybridconf.net/" , startDate = ( 2016, Aug, 18 ) , endDate = ( 2016, Aug, 19 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Germany", Tag "General", Tag "UX" ] } , { name = "360|iDev" , link = "http://360idev.com/" , startDate = ( 2016, Aug, 21 ) , endDate = ( 2016, Aug, 24 ) , location = "Denver, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS" ] } , { name = "JSConf Iceland" , link = "http://2016.jsconf.is/" , startDate = ( 2016, Aug, 25 ) , endDate = ( 2016, Aug, 26 ) , location = "Reykjavik, Iceland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Iceland", Tag "JavaScript" ] } , { name = "<NAME>" , link = "http://www.reactrally.com/" , startDate = ( 2016, Aug, 25 ) , endDate = ( 2016, Aug, 26 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "React", Tag "JavaScript" ] } , { name = "BrazilJS" , link = "https://braziljs.org/conf" , startDate = ( 2016, Aug, 26 ) , endDate = ( 2016, Aug, 27 ) , location = "Porto Alegre, Brazil" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 30 ) , tags = [ Tag "English", Tag "Spanish", Tag "Portuguese", Tag "Developers", Tag "Brazil", Tag "JavaScript" ] } , { name = "AlterConf South Africa" , link = "http://www.alterconf.com/sessions/cape-town-south-africa" , startDate = ( 2016, Aug, 27 ) , endDate = ( 2016, Aug, 27 ) , location = "Cape Town, South Africa" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 16 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "South Africa", Tag "Diversity", Tag "Soft Skills" ] } , { name = "An Event Apart Chicago" , link = "http://aneventapart.com/event/chicago-2016" , startDate = ( 2016, Aug, 29 ) , endDate = ( 2016, Aug, 31 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Agile on the Beach" , link = "http://agileonthebeach.com/2016-2/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 2 ) , location = "Falmouth, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile" ] } , { name = "<NAME>" , link = "https://2016.coldfrontconf.com/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 1 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Designers", Tag "Denmark", Tag "JavaScript", Tag "CSS", Tag "Mobile" ] } , { name = "Frontend Conference Zurich" , link = "https://frontendconf.ch/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 2 ) , location = "Zürich, Switzerland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Switzerland", Tag "UX" ] } , { name = "Full Stack Fest" , link = "http://2016.fullstackfest.com/" , startDate = ( 2016, Sep, 5 ) , endDate = ( 2016, Sep, 9 ) , location = "Barcelona, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Ruby", Tag "JavaScript", Tag "General" ] } , { name = "Generate Sydney" , link = "http://www.generateconf.com/" , startDate = ( 2016, Sep, 5 ) , endDate = ( 2016, Sep, 5 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "UX" ] } , { name = "iOSDevEngland" , link = "http://www.iosdevuk.com/" , startDate = ( 2016, Sep, 5 ) , endDate = ( 2016, Sep, 8 ) , location = "Aberystwyth, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "IOS", Tag "Swift" ] } , { name = "Ruby<NAME>" , link = "http://rubykaigi.org/2016" , startDate = ( 2016, Sep, 8 ) , endDate = ( 2016, Sep, 10 ) , location = "Kyoto, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "English", Tag "Japanese", Tag "Ruby" ] } , { name = "CocoaConf DC" , link = "http://cocoaconf.com/dc-2016/home" , startDate = ( 2016, Sep, 9 ) , endDate = ( 2016, Sep, 10 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "Ag<NAME>" , link = "http://agileprague.com/" , startDate = ( 2016, Sep, 12 ) , endDate = ( 2016, Sep, 13 ) , location = "Prague, Czech Republic" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "Czech Republic", Tag "Agile" ] } , { name = "<NAME>" , link = "http://swanseacon.co.uk/" , startDate = ( 2016, Sep, 12 ) , endDate = ( 2016, Sep, 13 ) , location = "Swansea, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile", Tag "Software Craftsmanship" ] } , { name = "Angular Remote Conf" , link = "https://allremoteconfs.com/angular-2016" , startDate = ( 2016, Sep, 14 ) , endDate = ( 2016, Sep, 16 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Aug, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript", Tag "AngularJS" ] } , { name = "From the Front" , link = "http://2016.fromthefront.it/" , startDate = ( 2016, Sep, 15 ) , endDate = ( 2016, Sep, 16 ) , location = "Bologna, Italy" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 15 ) , tags = [ Tag "English", Tag "Designers", Tag "Italy", Tag "UX" ] } , { name = "Strangeloop" , link = "http://thestrangeloop.com/" , startDate = ( 2016, Sep, 15 ) , endDate = ( 2016, Sep, 17 ) , location = "St. Louis, MO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 9 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General", Tag "Functional Programming" ] } , { name = "WindyCityRails" , link = "https://www.windycityrails.com/" , startDate = ( 2016, Sep, 15 ) , endDate = ( 2016, Sep, 16 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby", Tag "Rails" ] } , { name = "WindyCityThings" , link = "https://www.windycitythings.com/" , startDate = ( 2016, Jun, 23 ) , endDate = ( 2016, Jun, 24 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Internet Of Things", Tag "RaspberryPi", Tag "Arduino" ] } , { name = "CppCon" , link = "http://cppcon.org/" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 23 ) , location = "Bellevue, WA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 22 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "C++" ] } , { name = "International Conference on Functional Programming" , link = "http://conf.researchr.org/home/icfp-2016" , startDate = ( 2016, Sep, 19 ) , endDate = ( 2016, Sep, 21 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 16 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell" ] } , { name = "Commercial Users of Functional Programming" , link = "http://cufp.org/2016/" , startDate = ( 2016, Sep, 24 ) , endDate = ( 2016, Sep, 24 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 24 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell", Tag "OCaml", Tag "PureScript", Tag "Clojure" ] } , { name = "Haskell Implementors' Workshop" , link = "https://wiki.haskell.org/HaskellImplementorsWorkshop/2016" , startDate = ( 2016, Sep, 24 ) , endDate = ( 2016, Sep, 24 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell" ] } , { name = "Workshop on Functional Art, Music, Modeling and Design" , link = "http://functional-art.org/2016/" , startDate = ( 2016, Sep, 24 ) , endDate = ( 2016, Sep, 24 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 24 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Haskell Symposium" , link = "https://www.haskell.org/haskell-symposium/2016/index.html" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 23 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 6 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell" ] } , { name = "Workshop on ML" , link = "http://www.mlworkshop.org/ml2016" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 22 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "F#", Tag "OCaml" ] } , { name = "OCaml Users and Developers Workshop" , link = "http://www.mlworkshop.org/ml2016" , startDate = ( 2016, Sep, 23 ) , endDate = ( 2016, Sep, 23 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "OCaml" ] } , { name = "Workshop on Functional High-Performance Computing" , link = "https://sites.google.com/site/fhpcworkshops/" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 22 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Erlang Workshop" , link = "http://conf.researchr.org/track/icfp-2016/erlang-2016-papers" , startDate = ( 2016, Sep, 23 ) , endDate = ( 2016, Sep, 23 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 3 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Erlang" ] } , { name = "Workshop on Type-Driven Development" , link = "http://conf.researchr.org/track/icfp-2016/tyde-2016-papers" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Higher-Order Programming Effects Workshop" , link = "http://conf.researchr.org/track/icfp-2016/hope-2016-papers" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Scheme Workshop" , link = "http://scheme2016.snow-fort.org/" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 24 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Lisp", Tag "Clojure" ] } , { name = "Programming Languages Mentoring Workshop" , link = "http://conf.researchr.org/track/PLMW-ICFP-2016/PLMW-ICFP-2016" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "JavaOne" , link = "https://www.oracle.com/javaone/index.html" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 22 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Java" ] } , { name = "Generate London" , link = "http://www.generateconf.com/" , startDate = ( 2016, Sep, 21 ) , endDate = ( 2016, Sep, 23 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "UX" ] } , { name = "AWS Summit Rio de Janeiro" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 22 ) , location = "Rio de Janeiro, Brazil" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Brazil", Tag "AWS", Tag "DevOps" ] } , { name = "Functional Conf" , link = "http://functionalconf.com/" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 25 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Functional Programming" ] } , { name = "DrupalCon <NAME>" , link = "https://events.drupal.org/dublin2016/" , startDate = ( 2016, Sep, 26 ) , endDate = ( 2016, Sep, 30 ) , location = "Dublin, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "Drupal", Tag "PHP" ] } , { name = "AngularConnect" , link = "http://angularconnect.com/" , startDate = ( 2016, Sep, 27 ) , endDate = ( 2016, Sep, 28 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "JavaScript", Tag "AngularJS" ] } , { name = "AWS Summit Lima" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Sep, 28 ) , endDate = ( 2016, Sep, 28 ) , location = "Lima, Peru" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Peru", Tag "AWS", Tag "DevOps" ] } , { name = "<NAME>" , link = "http://jazoon.com/" , startDate = ( 2016, Sep, 30 ) , endDate = ( 2016, Sep, 30 ) , location = "Zurich, Switzerland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Switzerland", Tag "JavaScript", Tag "AngularJS", Tag "Ember" ] } , { name = "An Event Apart Orlando" , link = "http://aneventapart.com/event/orlando-special-edition-2016" , startDate = ( 2016, Oct, 3 ) , endDate = ( 2016, Oct, 5 ) , location = "Orlando, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "GOTO Copenhagen" , link = "http://gotocon.com/cph-2015/" , startDate = ( 2016, Oct, 3 ) , endDate = ( 2016, Oct, 6 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Denmark", Tag "General" ] } , { name = "LoopConf" , link = "https://loopconf.com/" , startDate = ( 2016, Oct, 5 ) , endDate = ( 2016, Oct, 7 ) , location = "Fort Lauderdale, FL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP", Tag "WordPress" ] } , { name = "dotGo" , link = "http://2016.dotgo.eu/" , startDate = ( 2016, Oct, 10 ) , endDate = ( 2016, Oct, 10 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Go" ] } , { name = "GOTO London" , link = "http://gotocon.com/" , startDate = ( 2016, Oct, 12 ) , endDate = ( 2016, Oct, 14 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "Rails Remote Conf" , link = "https://allremoteconfs.com/rails-2016" , startDate = ( 2016, Oct, 12 ) , endDate = ( 2016, Oct, 14 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Sep, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Rails", Tag "Ruby" ] } , { name = "CocoaLove" , link = "http://cocoalove.org/" , startDate = ( 2016, Oct, 14 ) , endDate = ( 2016, Oct, 16 ) , location = "Philadelphia, PA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "CSS Dev Conf" , link = "http://2016.cssdevconf.com/" , startDate = ( 2016, Oct, 17 ) , endDate = ( 2016, Oct, 19 ) , location = "San Antonio, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "CSS" ] } , { name = "Full Stack Toronto" , link = "https://fsto.co/" , startDate = ( 2016, Oct, 17 ) , endDate = ( 2016, Oct, 18 ) , location = "Toronto, Canada" , cfpStartDate = Just ( 2016, Jan, 1 ) , cfpEndDate = Just ( 2016, Jul, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Canada", Tag "General" ] } , { name = "ConnectJS" , link = "http://connect-js.com/" , startDate = ( 2016, Oct, 21 ) , endDate = ( 2016, Oct, 22 ) , location = "Atlanta, GA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "Codemotion Berlin" , link = "http://berlin2015.codemotionworld.com/" , startDate = ( 2016, Oct, 24 ) , endDate = ( 2016, Oct, 25 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "General" ] } , { name = "ng-europe" , link = "https://ngeurope.org/" , startDate = ( 2016, Oct, 25 ) , endDate = ( 2016, Oct, 26 ) , location = "Paris, France" , cfpStartDate = Just ( 2016, Feb, 17 ) , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "JavaScript", Tag "AngularJS" ] } , { name = "Smashing Conf Barcelona" , link = "http://smashingconf.com/" , startDate = ( 2016, Oct, 25 ) , endDate = ( 2016, Oct, 26 ) , location = "Barcelona, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Spain", Tag "UX" ] } , { name = "Spark Summit Europe" , link = "https://spark-summit.org/" , startDate = ( 2016, Oct, 25 ) , endDate = ( 2016, Oct, 27 ) , location = "Brussels, Belgium" , cfpStartDate = Just ( 2016, Jun, 1 ) , cfpEndDate = Just ( 2016, Jul, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "Big Data" ] } , { name = "An Event Apart San Francisco" , link = "http://aneventapart.com/event/san-francisco-2016" , startDate = ( 2016, Oct, 31 ) , endDate = ( 2016, Nov, 2 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "CocoaConf San Jose" , link = "http://cocoaconf.com/sanjose-2016/home" , startDate = ( 2016, Nov, 4 ) , endDate = ( 2016, Nov, 5 ) , location = "San Jose, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Cocoa" ] } , { name = "<NAME>" , link = "http://beyondtellerrand.com/events/berlin-2016" , startDate = ( 2016, Nov, 7 ) , endDate = ( 2016, Nov, 9 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Germany", Tag "UX", Tag "General" ] } , { name = "Devops Remote Conf" , link = "https://allremoteconfs.com/devops-2016" , startDate = ( 2016, Nov, 9 ) , endDate = ( 2016, Nov, 11 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Oct, 8 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "DevOps" ] } , { name = "droidconIN" , link = "https://droidcon.in/2016/" , startDate = ( 2016, Nov, 10 ) , endDate = ( 2016, Nov, 11 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Aug, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Android", Tag "Mobile" ] } , { name = "RubyConf" , link = "http://rubyconf.org/" , startDate = ( 2016, Nov, 10 ) , endDate = ( 2016, Nov, 12 ) , location = "Cincinnati, OH" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "BuildStuff" , link = "http://buildstuff.lt/" , startDate = ( 2016, Nov, 16 ) , endDate = ( 2016, Nov, 20 ) , location = "Vilnius, Lithuania" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Lithuania", Tag "General" ] } , { name = "Frontier Conf" , link = "https://www.frontierconf.com/" , startDate = ( 2016, Nov, 16 ) , endDate = ( 2016, Nov, 16 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "CSS", Tag "UX" ] } , { name = "Generate Bangalore" , link = "http://www.generateconf.com/" , startDate = ( 2016, Nov, 25 ) , endDate = ( 2016, Nov, 25 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "India", Tag "UX" ] } , { name = "AWS re:Invent" , link = "https://reinvent.awsevents.com/" , startDate = ( 2016, Nov, 28 ) , endDate = ( 2016, Dec, 2 ) , location = "Las Vegas, NV" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "Cloud" ] } , { name = "<NAME>" , link = "http://js-kongress.de/" , startDate = ( 2016, Nov, 28 ) , endDate = ( 2016, Nov, 29 ) , location = "Munich, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "JavaScript" ] } , { name = "CSSConf AU" , link = "http://2016.cssconf.com.au/" , startDate = ( 2016, Nov, 30 ) , endDate = ( 2016, Nov, 30 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "CSS" ] } , { name = "JSConf AU" , link = "http://jsconfau.com/" , startDate = ( 2016, Dec, 1 ) , endDate = ( 2016, Dec, 1 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "JavaScript" ] } , { name = "Clojure eXchange" , link = "https://skillsmatter.com/conferences/7430-clojure-exchange-2016" , startDate = ( 2016, Dec, 1 ) , endDate = ( 2016, Dec, 2 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Clojure", Tag "Functional Programming" ] } , { name = "Decompress" , link = "http://2016.cssconf.com.au/" , startDate = ( 2016, Dec, 2 ) , endDate = ( 2016, Dec, 2 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Australia", Tag "General" ] } , { name = "dotCSS" , link = "http://www.dotcss.io/" , startDate = ( 2016, Dec, 2 ) , endDate = ( 2016, Dec, 2 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "France", Tag "CSS" ] } , { name = "dotJS" , link = "http://www.dotjs.io/" , startDate = ( 2016, Dec, 5 ) , endDate = ( 2016, Dec, 5 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "JavaScript" ] } , { name = "NoSQL Remote Conf" , link = "https://allremoteconfs.com/nosql-2016" , startDate = ( 2016, Dec, 7 ) , endDate = ( 2016, Dec, 9 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Nov, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "NoSQL" ] } , { name = "Midwest.io" , link = "http://www.midwest.io/" , startDate = ( 2016, Aug, 22 ) , endDate = ( 2016, Aug, 23 ) , location = "Kansas City, MO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "ServerlessConf" , link = "http://serverlessconf.io/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 27 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 26 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General", Tag "AWS", Tag "Cloud", Tag "Scalability" ] } , { name = "AgileIndy" , link = "http://agileindy.org/" , startDate = ( 2016, Apr, 12 ) , endDate = ( 2016, Apr, 12 ) , location = "Indianapolis, IN" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Agile" ] } , { name = "RSJS" , link = "http://rsjs.org/2016/" , startDate = ( 2016, Apr, 23 ) , endDate = ( 2016, Apr, 23 ) , location = "Porto Alegre, Brazil" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "Portuguese", Tag "Developers", Tag "Brazil", Tag "JavaScript" ] } , { name = "Frontinsampa" , link = "http://frontinsampa.com.br/" , startDate = ( 2016, Jul, 2 ) , endDate = ( 2016, Jul, 2 ) , location = "Sao Paulo, Brazil" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Portuguese", Tag "Developers", Tag "Brazil", Tag "JavaScript" ] } , { name = ".NET Fringe" , link = "http://dotnetfringe.org/" , startDate = ( 2016, Jul, 10 ) , endDate = ( 2016, Jul, 12 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source", Tag ".Net" ] } , { name = "<NAME>" , link = "http://2016.ull.ie/" , startDate = ( 2016, Nov, 1 ) , endDate = ( 2016, Nov, 2 ) , location = "Killarney, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "IOS" ] } , { name = "<NAME>" , link = "http://fpday.org/" , startDate = ( 2016, Mar, 26 ) , endDate = ( 2016, Mar, 26 ) , location = "Nantes, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "French", Tag "Developers", Tag "France", Tag "Functional Programming" ] } , { name = "HalfStack" , link = "http://halfstackconf.com/" , startDate = ( 2016, Nov, 18 ) , endDate = ( 2016, Nov, 18 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Oct, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "JavaScript" ] } , { name = "Front Conference" , link = "https://frontutah.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Port80" , link = "http://port80events.co.uk/" , startDate = ( 2016, May, 20 ) , endDate = ( 2016, May, 20 ) , location = "Newport, Wales" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Wales", Tag "UX", Tag "Web" ] } , { name = "Code 2016 Sydney" , link = "http://www.webdirections.org/code16/" , startDate = ( 2016, Jul, 28 ) , endDate = ( 2016, Jul, 29 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "JavaScript" ] } , { name = "Code 2016 Melbourne" , link = "http://www.webdirections.org/code16/" , startDate = ( 2016, Aug, 1 ) , endDate = ( 2016, Aug, 2 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "JavaScript" ] } , { name = "<NAME>" , link = "http://2016.cascadiafest.org/" , startDate = ( 2016, Aug, 3 ) , endDate = ( 2016, Aug, 5 ) , location = "Semiahmoo, WA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 11 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "CSS", Tag "JavaScript", Tag "Web", Tag "NodeJS" ] } , { name = "React Amsterdam" , link = "http://react-amsterdam.com/" , startDate = ( 2016, Apr, 16 ) , endDate = ( 2016, Apr, 16 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "JavaScript", Tag "React" ] } , { name = "NSSpain" , link = "http://nsspain.com/" , startDate = ( 2016, Sep, 14 ) , endDate = ( 2016, Sep, 16 ) , location = "La Rioja, Spain" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "IOS" ] } , { name = "try! Swift NYC" , link = "http://www.tryswiftnyc.com/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 2 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Swift", Tag "IOS" ] } , { name = "FrenchKit" , link = "http://frenchkit.fr/" , startDate = ( 2016, Sep, 23 ) , endDate = ( 2016, Sep, 24 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "IOS", Tag "Cocoa" ] } , { name = "AltConf" , link = "http://altconf.com/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 16 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "WWDC" , link = "https://developer.apple.com/wwdc/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 17 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Designers", Tag "USA", Tag "IOS" ] } , { name = "Thunder Plains" , link = "http://thunderplainsconf.com/" , startDate = ( 2016, Nov, 3 ) , endDate = ( 2016, Nov, 3 ) , location = "Oklahoma City, OK" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "CSS", Tag "Mobile", Tag "Web" ] } , { name = "Scala Up North" , link = "http://scalaupnorth.com/" , startDate = ( 2016, Aug, 5 ) , endDate = ( 2016, Aug, 6 ) , location = "Montreal, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Scala" ] } , { name = "XP 2016" , link = "http://conf.xp2016.org/" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 27 ) , location = "Edinbrugh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Scotland", Tag "Agile" ] } , { name = "<NAME>" , link = "http://valiocon.com/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 22 ) , location = "San Diego, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "<NAME>" , link = "http://www.jailbreakcon.com/" , startDate = ( 2016, Jun, 20 ) , endDate = ( 2016, Jun, 21 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS" ] } , { name = "#Pragma Conference" , link = "http://pragmaconference.com/" , startDate = ( 2016, Oct, 12 ) , endDate = ( 2016, Oct, 14 ) , location = "Verona, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "IOS" ] } , { name = "<NAME>" , link = "https://www.defcon.org/" , startDate = ( 2016, Aug, 4 ) , endDate = ( 2016, Aug, 7 ) , location = "Las Vegas, NV" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 2 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "<NAME>" , link = "https://www.derbycon.com/" , startDate = ( 2016, Aug, 23 ) , endDate = ( 2016, Aug, 25 ) , location = "Louisville, KY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Aug, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "Black Hat" , link = "https://www.blackhat.com/us-16/" , startDate = ( 2016, Jul, 30 ) , endDate = ( 2016, Aug, 4 ) , location = "Las Vegas, NV" , cfpStartDate = Just ( 2016, Feb, 9 ) , cfpEndDate = Just ( 2016, Apr, 11 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "RSA Conference USA" , link = "http://www.rsaconference.com/events/us16" , startDate = ( 2016, Feb, 29 ) , endDate = ( 2016, Mar, 4 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "RSA Conference Asia Pacific & Japan" , link = "http://www.rsaconference.com/events/ap16" , startDate = ( 2016, Jul, 20 ) , endDate = ( 2016, Jul, 22 ) , location = "Singapore" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "Security" ] } , { name = "RSA Conference Abu Dhabi" , link = "http://www.rsaconference.com/events/ad16" , startDate = ( 2016, Nov, 15 ) , endDate = ( 2016, Nov, 16 ) , location = "Abu Dhabi, UAE" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "Security" ] } , { name = "CanSecWest" , link = "https://cansecwest.com/" , startDate = ( 2016, Mar, 16 ) , endDate = ( 2016, Mar, 18 ) , location = "Vancouver, Canada" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Security" ] } , { name = "PanSec" , link = "https://pacsec.jp/" , startDate = ( 2016, Oct, 26 ) , endDate = ( 2016, Oct, 27 ) , location = "Tokyo, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Security" ] } , { name = "EUSecWest" , link = "https://eusecwest.com/" , startDate = ( 2016, Sep, 19 ) , endDate = ( 2016, Sep, 20 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "Security" ] } , { name = "<NAME>" , link = "http://www.carolinacon.org/" , startDate = ( 2016, Mar, 4 ) , endDate = ( 2016, Mar, 4 ) , location = "Raleigh, North Carolina" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "<NAME>" , link = "http://thotcon.org/" , startDate = ( 2016, May, 5 ) , endDate = ( 2016, May, 6 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } ] , currentDate = ( 2016, Jan, 1 ) , tags = [ { sectionName = "Conference Language" , tags = [ FilteredTag.init (Tag "English") , FilteredTag.init (Tag "French") , FilteredTag.init (Tag "German") , FilteredTag.init (Tag "Italian") , FilteredTag.init (Tag "Japanese") , FilteredTag.init (Tag "Norwegian") , FilteredTag.init (Tag "Polish") , FilteredTag.init (Tag "Portuguese") , FilteredTag.init (Tag "Russian") , FilteredTag.init (Tag "Spanish") , FilteredTag.init (Tag "Turkish") ] } , { sectionName = "Audience" , tags = [ FilteredTag.init (Tag "Designers") , FilteredTag.init (Tag "Developers") ] } , { sectionName = "Programming Languages/Technologies" , tags = [ FilteredTag.init (Tag "Android") , FilteredTag.init (Tag "AngularJS") , FilteredTag.init (Tag "Arduino") , FilteredTag.init (Tag "AWS") , FilteredTag.init (Tag "C++") , FilteredTag.init (Tag "CSS") , FilteredTag.init (Tag "Chef") , FilteredTag.init (Tag "Clojure") , FilteredTag.init (Tag "Cocoa") , FilteredTag.init (Tag "CycleJS") , FilteredTag.init (Tag "Docker") , FilteredTag.init (Tag "Drupal") , FilteredTag.init (Tag ".Net") , FilteredTag.init (Tag "Elasticsearch") , FilteredTag.init (Tag "Elixir") , FilteredTag.init (Tag "Ember") , FilteredTag.init (Tag "Erlang") , FilteredTag.init (Tag "F#") , FilteredTag.init (Tag "Git") , FilteredTag.init (Tag "Go") , FilteredTag.init (Tag "Gradle") , FilteredTag.init (Tag "Grails") , FilteredTag.init (Tag "Groovy") , FilteredTag.init (Tag "Hadoop") , FilteredTag.init (Tag "Haskell") , FilteredTag.init (Tag "IOS") , FilteredTag.init (Tag "Java") , FilteredTag.init (Tag "JavaScript") , FilteredTag.init (Tag "Logstash") , FilteredTag.init (Tag "Lisp") , FilteredTag.init (Tag "MongoDB") , FilteredTag.init (Tag "NodeJS") , FilteredTag.init (Tag "OCaml") , FilteredTag.init (Tag "PhoneGap") , FilteredTag.init (Tag "PHP") , FilteredTag.init (Tag "PostgreSQL") , FilteredTag.init (Tag "PureScript") , FilteredTag.init (Tag "Python") , FilteredTag.init (Tag "Rails") , FilteredTag.init (Tag "RaspberryPi") , FilteredTag.init (Tag "React") , FilteredTag.init (Tag "Ruby") , FilteredTag.init (Tag "SML") , FilteredTag.init (Tag "Scala") , FilteredTag.init (Tag "SVG") , FilteredTag.init (Tag "Swift") , FilteredTag.init (Tag "WordPress") ] } , { sectionName = "Topics" , tags = [ FilteredTag.init (Tag "Agile") , FilteredTag.init (Tag "Big Data") , FilteredTag.init (Tag "Cloud") , FilteredTag.init (Tag "Communications") , FilteredTag.init (Tag "DataVisualization") , FilteredTag.init (Tag "DevOps") , FilteredTag.init (Tag "Diversity") , FilteredTag.init (Tag "Functional Programming") , FilteredTag.init (Tag "General") , FilteredTag.init (Tag "Internet Of Things") , FilteredTag.init (Tag "Microservices") , FilteredTag.init (Tag "Mobile") , FilteredTag.init (Tag "NoSQL") , FilteredTag.init (Tag "Open Source") , FilteredTag.init (Tag "Progressive Enhancement") , FilteredTag.init (Tag "Robotics") , FilteredTag.init (Tag "Scalability") , FilteredTag.init (Tag "Security") , FilteredTag.init (Tag "Soft Skills") , FilteredTag.init (Tag "Software Craftsmanship") , FilteredTag.init (Tag "Testing") , FilteredTag.init (Tag "UX") , FilteredTag.init (Tag "Web") ] } , { sectionName = "Locations" , tags = [ FilteredTag.init (Tag "Argentina") , FilteredTag.init (Tag "Australia") , FilteredTag.init (Tag "Belarus") , FilteredTag.init (Tag "Belgium") , FilteredTag.init (Tag "Brazil") , FilteredTag.init (Tag "Bulgaria") , FilteredTag.init (Tag "Canada") , FilteredTag.init (Tag "Chile") , FilteredTag.init (Tag "China") , FilteredTag.init (Tag "Colombia") , FilteredTag.init (Tag "Croatia") , FilteredTag.init (Tag "Czech Republic") , FilteredTag.init (Tag "Denmark") , FilteredTag.init (Tag "England") , FilteredTag.init (Tag "Finland") , FilteredTag.init (Tag "France") , FilteredTag.init (Tag "Germany") , FilteredTag.init (Tag "Hungary") , FilteredTag.init (Tag "Iceland") , FilteredTag.init (Tag "India") , FilteredTag.init (Tag "Ireland") , FilteredTag.init (Tag "Israel") , FilteredTag.init (Tag "Italy") , FilteredTag.init (Tag "Japan") , FilteredTag.init (Tag "Latvia") , FilteredTag.init (Tag "Lebanon") , FilteredTag.init (Tag "Lithuania") , FilteredTag.init (Tag "Malaysia") , FilteredTag.init (Tag "Mexico") , FilteredTag.init (Tag "Netherlands") , FilteredTag.init (Tag "New Zealand") , FilteredTag.init (Tag "Norway") , FilteredTag.init (Tag "Peru") , FilteredTag.init (Tag "Philippines") , FilteredTag.init (Tag "Poland") , FilteredTag.init (Tag "Portugal") , FilteredTag.init (Tag "Remote") , FilteredTag.init (Tag "Romania") , FilteredTag.init (Tag "Russia") , FilteredTag.init (Tag "Scotland") , FilteredTag.init (Tag "Singapore") , FilteredTag.init (Tag "South Africa") , FilteredTag.init (Tag "South Korea") , FilteredTag.init (Tag "Spain") , FilteredTag.init (Tag "Sweden") , FilteredTag.init (Tag "Switzerland") , FilteredTag.init (Tag "Taiwan") , FilteredTag.init (Tag "Tunisia") , FilteredTag.init (Tag "Turkey") , FilteredTag.init (Tag "UAE") , FilteredTag.init (Tag "USA") , FilteredTag.init (Tag "Ukraine") , FilteredTag.init (Tag "Uruguay") , FilteredTag.init (Tag "Wales") ] } ] , includePastEvents = False }
true
module InitialData exposing (model) import Conference import Date exposing (Month(..)) import FilteredTag import GenericSet import Model import Tag exposing (Tag(..)) model : Model.Model model = { conferences = GenericSet.fromList Conference.compareConferences [ { name = "@Swift" , link = "http://atswift.io/index-en.html" , startDate = ( 2016, Jan, 10 ) , endDate = ( 2016, Jan, 10 ) , location = "Beijing, China" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "China", Tag "Swift", Tag "IOS" ] } , { name = "NDC London Workshops" , link = "http://ndc-london.com/" , startDate = ( 2016, Jan, 11 ) , endDate = ( 2016, Jan, 12 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "NDC London" , link = "http://ndc-london.com/" , startDate = ( 2016, Jan, 13 ) , endDate = ( 2016, Jan, 15 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "Internet of Things Milan" , link = "https://www.mongodb.com/events/internet-of-things-milan" , startDate = ( 2016, Jan, 14 ) , endDate = ( 2016, Jan, 14 ) , location = "Milan, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "MongoDB", Tag "Big Data", Tag "Internet Of Things" ] } , { name = "JS Remote Conf" , link = "https://allremoteconfs.com/js-2016" , startDate = ( 2016, Jan, 14 ) , endDate = ( 2016, Jan, 16 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript" ] } , { name = "GR8Conf IN" , link = "http://gr8conf.in/" , startDate = ( 2016, Jan, 16 ) , endDate = ( 2016, Jan, 16 ) , location = "New Delhi, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "O'Reilly Design Conference" , link = "http://conferences.oreilly.com/design/ux-interaction-iot-us" , startDate = ( 2016, Jan, 20 ) , endDate = ( 2016, Jan, 22 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "SVG Summit" , link = "http://environmentsforhumans.com/2016/svg-summit/" , startDate = ( 2016, Jan, 21 ) , endDate = ( 2016, Jan, 21 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Remote", Tag "SVG" ] } , { name = "/dev/winter" , link = "http://devcycles.net/2016/winter/" , startDate = ( 2016, Jan, 23 ) , endDate = ( 2016, Jan, 23 ) , location = "Cambridge, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "DevOps", Tag "NoSQL", Tag "Functional Programming" ] } , { name = "PhoneGap Day" , link = "http://pgday.phonegap.com/us2016/" , startDate = ( 2016, Jan, 28 ) , endDate = ( 2016, Jan, 28 ) , location = "Lehi, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PhoneGap", Tag "Mobile" ] } , { name = "dotSwift" , link = "http://www.dotswift.io/" , startDate = ( 2016, Jan, 29 ) , endDate = ( 2016, Jan, 29 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Swift" ] } , { name = "PHPBenelux" , link = "http://conference.phpbenelux.eu/2016/" , startDate = ( 2016, Jan, 29 ) , endDate = ( 2016, Jan, 30 ) , location = "Antwerp, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "PHP" ] } , { name = "AlterConf D.C." , link = "http://www.alterconf.com/sessions/washington-dc" , startDate = ( 2016, Jan, 30 ) , endDate = ( 2016, Jan, 30 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "Diversity", Tag "Soft Skills" ] } , { name = "FOSDEM" , link = "https://fosdem.org/2016/" , startDate = ( 2016, Jan, 30 ) , endDate = ( 2016, Jan, 31 ) , location = "Brussels, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "Open Source", Tag "General" ] } , { name = "PgConf.Russia" , link = "https://pgconf.ru/" , startDate = ( 2016, Feb, 3 ) , endDate = ( 2016, Feb, 5 ) , location = "Moscow, Russia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Russian", Tag "Developers", Tag "Russia", Tag "PostgreSQL" ] } , { name = "Compose 2016" , link = "http://www.composeconference.org/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 5 ) , location = "Brooklyn, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming", Tag "Haskell", Tag "F#", Tag "OCaml", Tag "SML" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.rubyfuza.org/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 5 ) , location = "Cape Town, South Africa" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "South Africa", Tag "Ruby" ] } , { name = "SunshinePHP" , link = "http://2016.sunshinephp.com/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 6 ) , location = "Miami, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP" ] } , { name = "The Microservices Conference" , link = "http://microxchg.io/2016/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 5 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Microservices" ] } , { name = "UX/DEV Summit" , link = "http://uxdsummit.com/" , startDate = ( 2016, Feb, 4 ) , endDate = ( 2016, Feb, 6 ) , location = "Fort Lauderdale, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX", Tag "AngularJS", Tag "Ember", Tag "React" ] } , { name = "Forward JS Workshops" , link = "http://forwardjs.com/home" , startDate = ( 2016, Feb, 8 ) , endDate = ( 2016, Feb, 9 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "NodeJS" ] } , { name = "Jfokus" , link = "http://www.jfokus.se/jfokus/" , startDate = ( 2016, Feb, 8 ) , endDate = ( 2016, Feb, 10 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Java", Tag "General" ] } , { name = "Jfokus IoT" , link = "http://www.jfokus.se/iot/" , startDate = ( 2016, Feb, 8 ) , endDate = ( 2016, Feb, 10 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Internet Of Things" ] } , { name = "Webstock" , link = "http://www.webstock.org.nz/16/" , startDate = ( 2016, Feb, 9 ) , endDate = ( 2016, Feb, 12 ) , location = "Wellington, New Zealand" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "New Zealand", Tag "General" ] } , { name = "Forward JS" , link = "http://forwardjs.com/home" , startDate = ( 2016, Feb, 10 ) , endDate = ( 2016, Feb, 10 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "NodeJS" ] } , { name = "RubyConf Australia" , link = "http://www.rubyconf.org.au/2016" , startDate = ( 2016, Feb, 10 ) , endDate = ( 2016, Feb, 13 ) , location = "Gold Coast, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Ruby" ] } , { name = "Clojure Remote" , link = "http://clojureremote.com/" , startDate = ( 2016, Feb, 11 ) , endDate = ( 2016, Feb, 12 ) , location = "Remote" , cfpStartDate = Just ( 2015, Oct, 30 ) , cfpEndDate = Just ( 2015, Dec, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Clojure", Tag "Functional Programming" ] } , { name = "Forward JS Workshops" , link = "http://forwardjs.com/home" , startDate = ( 2016, Feb, 11 ) , endDate = ( 2016, Feb, 13 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "NodeJS" ] } , { name = "DeveloperWeek" , link = "http://www.developerweek.com/" , startDate = ( 2016, Feb, 12 ) , endDate = ( 2016, Feb, 18 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Nov, 23 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "NodeJS", Tag "Python", Tag "PHP", Tag "DevOps", Tag "Ruby", Tag "Mobile", Tag "NoSQL", Tag "General" ] } , { name = "DevNexus" , link = "http://devnexus.com/s/index" , startDate = ( 2016, Feb, 15 ) , endDate = ( 2016, Feb, 17 ) , location = "Atlanta, GA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Agile", Tag "Big Data", Tag "Java", Tag "JavaScript", Tag "General" ] } , { name = "Spark Summit East" , link = "https://spark-summit.org/east-2016/" , startDate = ( 2016, Feb, 16 ) , endDate = ( 2016, Feb, 18 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data" ] } , { name = "Elastic{ON}" , link = "https://www.elastic.co/elasticon" , startDate = ( 2016, Feb, 17 ) , endDate = ( 2016, Feb, 19 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Nov, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "MongoDB", Tag "Big Data", Tag "Elasticsearch", Tag "Logstash" ] } , { name = "DrupalCon Asia" , link = "https://events.drupal.org/asia2016" , startDate = ( 2016, Feb, 18 ) , endDate = ( 2016, Feb, 21 ) , location = "Mumbai, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Nov, 2 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Drupal", Tag "PHP" ] } , { name = "hello.PI:NAME:<NAME>END_PI" , link = "http://hellojs.org/" , startDate = ( 2016, Feb, 18 ) , endDate = ( 2016, Feb, 19 ) , location = "Cluj-Napoca, Romania" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Romania", Tag "JavaScript" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.lambdadays.org/" , startDate = ( 2016, Feb, 18 ) , endDate = ( 2016, Feb, 19 ) , location = "Krakow, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Functional Programming", Tag "Erlang" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://bobkonf.de/2016/en/" , startDate = ( 2016, Feb, 19 ) , endDate = ( 2016, Feb, 19 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "German", Tag "Developers", Tag "Germany", Tag "Functional Programming", Tag "Clojure", Tag "Haskell", Tag "Scala", Tag "Erlang" ] } , { name = "GopherCon India" , link = "http://www.gophercon.in/" , startDate = ( 2016, Feb, 19 ) , endDate = ( 2016, Feb, 10 ) , location = "Bengaluru, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Go" ] } , { name = "Bulgaria Web Summit" , link = "http://bulgariawebsummit.com/" , startDate = ( 2016, Feb, 20 ) , endDate = ( 2016, Feb, 20 ) , location = "Sofia, Bulgaria" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Bulgaria", Tag "UX", Tag "JavaScript", Tag "General" ] } , { name = ":clojureD" , link = "http://www.clojured.de/" , startDate = ( 2016, Feb, 20 ) , endDate = ( 2016, Feb, 20 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Functional Programming", Tag "Clojure" ] } , { name = "The Rolling Scopes Conference" , link = "http://2016.conf.rollingscopes.com/" , startDate = ( 2016, Feb, 20 ) , endDate = ( 2016, Feb, 21 ) , location = "Minsk, Belarus" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Russian", Tag "Developers", Tag "Belarus", Tag "CSS", Tag "NodeJS", Tag "JavaScript" ] } , { name = "How.Camp" , link = "http://how.camp/" , startDate = ( 2016, Feb, 21 ) , endDate = ( 2016, Feb, 21 ) , location = "Sofia, Bulgaria" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Bulgaria", Tag "UX", Tag "JavaScript" ] } , { name = "React.js Conf" , link = "http://conf.reactjs.com/" , startDate = ( 2016, Feb, 22 ) , endDate = ( 2016, Feb, 23 ) , location = "San Francisco, CA" , cfpStartDate = Just ( 2015, Nov, 25 ) , cfpEndDate = Just ( 2015, Dec, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "React", Tag "JavaScript" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.gophercon.ae/" , startDate = ( 2016, Feb, 23 ) , endDate = ( 2016, Feb, 23 ) , location = "Dubai, UAE" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "Go" ] } , { name = "JavaScript Summit" , link = "http://environmentsforhumans.com/2016/javascript-summit/" , startDate = ( 2016, Feb, 23 ) , endDate = ( 2016, Feb, 23 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript" ] } , { name = "UXistanbul" , link = "http://uxistanbul.org/" , startDate = ( 2016, Feb, 23 ) , endDate = ( 2016, Feb, 23 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Turkey", Tag "UX" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://confoo.ca/en" , startDate = ( 2016, Feb, 24 ) , endDate = ( 2016, Feb, 26 ) , location = "Montreal, QC, Canada" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "French", Tag "Developers", Tag "Canada", Tag "General" ] } , { name = "Freelance Remote Conf" , link = "https://allremoteconfs.com/freelance-2016" , startDate = ( 2016, Feb, 24 ) , endDate = ( 2016, Feb, 26 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Designers", Tag "Remote", Tag "General", Tag "Soft Skills" ] } , { name = "UX Riga" , link = "http://www.uxriga.lv/" , startDate = ( 2016, Feb, 25 ) , endDate = ( 2016, Feb, 25 ) , location = "Riga, Latvia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Latvia", Tag "UX" ] } , { name = "Interaction 16" , link = "http://interaction16.ixda.org/" , startDate = ( 2016, Mar, 1 ) , endDate = ( 2016, Mar, 4 ) , location = "Helsinki, Finland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Finland", Tag "UX" ] } , { name = "try! Swift" , link = "http://www.tryswiftconf.com/en" , startDate = ( 2016, Mar, 2 ) , endDate = ( 2016, Mar, 4 ) , location = "Tokyo, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Swift", Tag "IOS" ] } , { name = "EnhanceConf" , link = "http://enhanceconf.com/" , startDate = ( 2016, Mar, 3 ) , endDate = ( 2016, Mar, 4 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "CSS", Tag "JavaScript", Tag "Progressive Enhancement" ] } , { name = "fsharpConf" , link = "http://fsharpconf.com/" , startDate = ( 2016, Mar, 4 ) , endDate = ( 2016, Mar, 4 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "F#", Tag ".Net", Tag "Functional Programming" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://chamberconf.pl/" , startDate = ( 2016, Mar, 5 ) , endDate = ( 2016, Mar, 6 ) , location = "Moszna, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Polish", Tag "Developers", Tag "Poland", Tag "General" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.droidcon.tn/" , startDate = ( 2016, Mar, 5 ) , endDate = ( 2016, Mar, 6 ) , location = "Hammamet, Tunisia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Tunisia", Tag "Android", Tag "Mobile" ] } , { name = "Frontend Conference" , link = "http://kfug.jp/frontconf2016/" , startDate = ( 2016, Mar, 5 ) , endDate = ( 2016, Mar, 5 ) , location = "Osaka, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Japanese", Tag "Designers", Tag "Developers", Tag "Japan", Tag "UX", Tag "JavaScript", Tag "CSS", Tag "AngularJS" ] } , { name = "Big Data Paris" , link = "http://www.bigdataparis.com/" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 8 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "French", Tag "Developers", Tag "France", Tag "MongoDB", Tag "Big Data" ] } , { name = "Erlang Factory SF Workshops" , link = "http://www.erlang-factory.com/sfbay2016/home" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 9 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Erlang" ] } , { name = "Fluent Conf Trainings" , link = "http://conferences.oreilly.com/fluent/javascript-html-us" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 8 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "CSS", Tag "JavaScript", Tag "UX", Tag "React", Tag "AngularJS", Tag "Docker" ] } , { name = "QCon London" , link = "http://qconlondon.com/" , startDate = ( 2016, Mar, 7 ) , endDate = ( 2016, Mar, 9 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "Fluent Conf" , link = "http://conferences.oreilly.com/fluent/javascript-html-us" , startDate = ( 2016, Mar, 8 ) , endDate = ( 2016, Mar, 10 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "CSS", Tag "JavaScript", Tag "UX", Tag "React", Tag "AngularJS", Tag "Docker" ] } , { name = "jDays" , link = "http://www.jdays.se/" , startDate = ( 2016, Mar, 8 ) , endDate = ( 2016, Mar, 9 ) , location = "Gothenburg, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Java" ] } , { name = "Apache Geode Summit" , link = "http://geodesummit.com/" , startDate = ( 2016, Mar, 9 ) , endDate = ( 2016, Mar, 9 ) , location = "Palo Alto, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data", Tag "Cloud" ] } , { name = "Erlang Factory SF" , link = "http://www.erlang-factory.com/sfbay2016/home" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 11 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Erlang" ] } , { name = "ScaleConf" , link = "http://scaleconf.org/" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 11 ) , location = "Cape Town, South Africa" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "South Africa", Tag "Scalability" ] } , { name = "SoCraTes ES" , link = "http://www.socrates-conference.es/doku.php" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 13 ) , location = "Gran Canaria, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Software Craftsmanship" ] } , { name = "QCon London Tutorials" , link = "http://qconlondon.com/" , startDate = ( 2016, Mar, 10 ) , endDate = ( 2016, Mar, 11 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://bathruby.us1.list-manage1.com/subscribe?u=f18bb7508370614edaffb50dd&id=73743da027" , startDate = ( 2016, Mar, 11 ) , endDate = ( 2016, Mar, 11 ) , location = "Bath, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Ruby" ] } , { name = "RWDevCon 2016" , link = "http://rwdevcon.com/" , startDate = ( 2016, Mar, 11 ) , endDate = ( 2016, Mar, 12 ) , location = "Alexandria, VA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Swift" ] } , { name = "wroc_love.rb" , link = "http://www.wrocloverb.com/" , startDate = ( 2016, Mar, 11 ) , endDate = ( 2016, Mar, 13 ) , location = "Wroclaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Ruby" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.jsconfbeirut.com/" , startDate = ( 2016, Mar, 12 ) , endDate = ( 2016, Mar, 13 ) , location = "Beirut, Lebanon" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Lebanon", Tag "JavaScript" ] } , { name = "An Event Apart Nashville" , link = "http://aneventapart.com/event/nashville-2016" , startDate = ( 2016, Mar, 14 ) , endDate = ( 2016, Mar, 16 ) , location = "Nashville, TN" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "PI:NAME:<NAME>END_PIosePI:NAME:<NAME>END_PI" , link = "http://cocoaconf.com/yosemPI:NAME:<NAME>END_PI" , startDate = ( 2016, Mar, 14 ) , endDate = ( 2016, Mar, 17 ) , location = "National Park, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Cocoa" ] } , { name = "Erlang Factory SF Workshops" , link = "http://www.erlang-factory.com/sfbay2016/home" , startDate = ( 2016, Mar, 14 ) , endDate = ( 2016, Mar, 16 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Erlang" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://smashingconf.com/" , startDate = ( 2016, Mar, 15 ) , endDate = ( 2016, Mar, 16 ) , location = "Oxford, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "UX" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://dibiconference.com/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 18 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Scotland", Tag "UX" ] } , { name = "PI:NAME:<NAME>END_PI San Francisco" , link = "http://sf.droidcon.com/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 18 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Android", Tag "Mobile" ] } , { name = "mdevcon" , link = "http://mdevcon.com/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 18 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Just ( 2015, Nov, 8 ) , cfpEndDate = Just ( 2015, Dec, 23 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "Mobile", Tag "IOS", Tag "Android" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://2016.nordicpgday.org/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 17 ) , location = "Helsinki, Finland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Finland", Tag "PostgreSQL" ] } , { name = "pgDay Asia" , link = "http://2016.pgday.asia/" , startDate = ( 2016, Mar, 17 ) , endDate = ( 2016, Mar, 19 ) , location = "Singapore" , cfpStartDate = Just ( 2015, Nov, 26 ) , cfpEndDate = Just ( 2016, Jan, 22 ) , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "PostgreSQL" ] } , { name = "Codemotion Rome" , link = "http://rome2016.codemotionworld.com/" , startDate = ( 2016, Mar, 18 ) , endDate = ( 2016, Mar, 19 ) , location = "Rome, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "General" ] } , { name = "Scale Summit" , link = "http://www.scalesummit.org/" , startDate = ( 2016, Mar, 18 ) , endDate = ( 2016, Mar, 18 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Scalability" ] } , { name = "Dutch Clojure Days" , link = "http://clojure.org/events/2016/dutch_clojure_days" , startDate = ( 2016, Mar, 19 ) , endDate = ( 2016, Mar, 19 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 23 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "Clojure", Tag "Functional Programming" ] } , { name = "GR8Day Warsaw" , link = "http://warsaw.gr8days.pl/" , startDate = ( 2016, Mar, 19 ) , endDate = ( 2016, Mar, 19 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "RubyConf India" , link = "http://rubyconfindia.org/" , startDate = ( 2016, Mar, 19 ) , endDate = ( 2016, Mar, 20 ) , location = "Kochi, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Ruby" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "https://attending.io/events/swiftaveiro" , startDate = ( 2016, Mar, 20 ) , endDate = ( 2016, Mar, 20 ) , location = "Aveiro, Portugal" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Portugal", Tag "IOS", Tag "Swift" ] } , { name = "MountainWest RubyConf" , link = "http://mtnwestrubyconf.org/2016/" , startDate = ( 2016, Mar, 21 ) , endDate = ( 2016, Mar, 22 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "PIPELINE" , link = "http://web.pipelineconf.info/" , startDate = ( 2016, Mar, 23 ) , endDate = ( 2016, Mar, 23 ) , location = "London, England" , cfpStartDate = Just ( 2015, Oct, 19 ) , cfpEndDate = Just ( 2015, Dec, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile" ] } , { name = "Ruby Remote Conf" , link = "https://allremoteconfs.com/ruby-2016" , startDate = ( 2016, Mar, 23 ) , endDate = ( 2016, Mar, 25 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Ruby" ] } , { name = "CocoaConf Chicago" , link = "http://cocoaconf.com/chicago-2016/home" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 26 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "CSS Day" , link = "http://2016.cssday.it/" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 25 ) , location = "Faenza, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Italian", Tag "Designers", Tag "Italy", Tag "CSS" ] } , { name = "DevPI:NAME:<NAME>END_PI" , link = "http://devexperience.ro/" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 25 ) , location = "Lasi, Romania" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Romania", Tag "General" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://droidcon.ae/" , startDate = ( 2016, Mar, 25 ) , endDate = ( 2016, Mar, 26 ) , location = "Dubai, UAE" , cfpStartDate = Just ( 2015, Oct, 27 ) , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "Android", Tag "Mobile" ] } , { name = "Space City JS" , link = "http://spacecity.codes/" , startDate = ( 2016, Mar, 26 ) , endDate = ( 2016, Mar, 26 ) , location = "Houston, TX" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "EmberConf" , link = "http://emberconf.com/" , startDate = ( 2016, Mar, 29 ) , endDate = ( 2016, Mar, 30 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ember" ] } , { name = "RWD Summit" , link = "http://environmentsforhumans.com/2016/responsive-web-design-summit/" , startDate = ( 2016, Mar, 29 ) , endDate = ( 2016, Mar, 31 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Remote", Tag "CSS", Tag "UX" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://clarityconf.com/" , startDate = ( 2016, Mar, 31 ) , endDate = ( 2016, Apr, 1 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "https://ruby.onales.com/" , startDate = ( 2016, Mar, 31 ) , endDate = ( 2016, Apr, 1 ) , location = "Bend, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://rome2016.codemotionworld.com/" , startDate = ( 2016, Apr, 1 ) , endDate = ( 2016, Apr, 2 ) , location = "Dubai, UAE" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "General" ] } , { name = "FPI:NAME:<NAME>END_PIishPI:NAME:<NAME>END_PI!" , link = "http://flourishconf.com/2016/" , startDate = ( 2016, Apr, 1 ) , endDate = ( 2016, Apr, 2 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source" ] } , { name = "FrontPI:NAME:<NAME>END_PIers Spring PI:NAME:<NAME>END_PI" , link = "https://fronteers.nl/spring" , startDate = ( 2016, Apr, 1 ) , endDate = ( 2016, Apr, 1 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "JavaScript" ] } , { name = "An Event Apart Seattle" , link = "http://aneventapart.com/event/seattle-2016" , startDate = ( 2016, Apr, 4 ) , endDate = ( 2016, Apr, 6 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Istanbul Tech Talks" , link = "http://www.istanbultechtalks.com/" , startDate = ( 2016, Apr, 5 ) , endDate = ( 2016, Apr, 5 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Turkey", Tag "General" ] } , { name = "Smashing Conf SF" , link = "http://smashingconf.com/sf-2016/" , startDate = ( 2016, Apr, 5 ) , endDate = ( 2016, Apr, 6 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Ancient City Ruby" , link = "http://www.ancientcityruby.com/" , startDate = ( 2016, Apr, 6 ) , endDate = ( 2016, Apr, 8 ) , location = "St. Augustine, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "AWS Summit Bogotá" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 6 ) , endDate = ( 2016, Apr, 6 ) , location = "Bogotá, Colombia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Colombia", Tag "AWS", Tag "DevOps" ] } , { name = "droidcon Italy" , link = "http://it.droidcon.com/2016/" , startDate = ( 2016, Apr, 7 ) , endDate = ( 2016, Apr, 8 ) , location = "Turin, Italy" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "Android", Tag "Mobile" ] } , { name = "Respond 2016 Sydney" , link = "http://www.webdirections.org/respond16/" , startDate = ( 2016, Apr, 7 ) , endDate = ( 2016, Apr, 8 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "CSS", Tag "UX" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://rubyconf.ph/" , startDate = ( 2016, Apr, 7 ) , endDate = ( 2016, Apr, 9 ) , location = "Taguig, Philippines" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Philippines", Tag "Ruby" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://greachconf.com/" , startDate = ( 2016, Apr, 8 ) , endDate = ( 2016, Apr, 9 ) , location = "Madrid, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://jazoon.com/" , startDate = ( 2016, Apr, 8 ) , endDate = ( 2016, Apr, 8 ) , location = "Bern, Switzerland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Switzerland", Tag "JavaScript", Tag "AngularJS", Tag "Ember" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.alterconf.com/sessions/minneapolis-mn" , startDate = ( 2016, Apr, 9 ) , endDate = ( 2016, Apr, 9 ) , location = "Minneapolis, MN" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 1 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "Diversity", Tag "Soft Skills" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://mobcon.com/mobcon-europe/" , startDate = ( 2016, Apr, 10 ) , endDate = ( 2016, Apr, 10 ) , location = "Sofia, Bulgaria" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "Bulgaria", Tag "Mobile", Tag "IOS", Tag "Android" ] } , { name = "PI:NAME:<NAME>END_PI16" , link = "http://www.webdirections.org/respond16/" , startDate = ( 2016, Apr, 11 ) , endDate = ( 2016, Apr, 12 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "CSS", Tag "UX" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://yggdrasilkonferansen.no/" , startDate = ( 2016, Apr, 11 ) , endDate = ( 2016, Apr, 12 ) , location = "Sandefjord, Norway" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Norwegian", Tag "Designers", Tag "Norway", Tag "UX" ] } , { name = "AWS Summit Berlin" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 12 ) , endDate = ( 2016, Apr, 12 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "AWS", Tag "DevOps" ] } , { name = "Converge SE" , link = "http://convergese.com/" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 15 ) , location = "Columbia, SC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "Hadoop Summit Europe" , link = "http://2016.hadoopsummit.org/dublin/" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 14 ) , location = "Dublin, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "Hadoop", Tag "Big Data", Tag "Internet Of Things" ] } , { name = "iOS Remote Conf" , link = "https://allremoteconfs.com/ios-2016" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 15 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "IOS" ] } , { name = "Peers Conference" , link = "http://peersconf.com/" , startDate = ( 2016, Apr, 13 ) , endDate = ( 2016, Apr, 15 ) , location = "St. Petersburg, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "Soft Skills" ] } , { name = "ACE! Conference" , link = "http://aceconf.com/" , startDate = ( 2016, Apr, 14 ) , endDate = ( 2016, Apr, 15 ) , location = "Krakow, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Agile", Tag "Software Craftsmanship" ] } , { name = "AWS Summit Milan" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 14 ) , endDate = ( 2016, Apr, 14 ) , location = "Milan, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "AWS", Tag "DevOps" ] } , { name = "Rootconf" , link = "https://rootconf.in/2016/" , startDate = ( 2016, Apr, 14 ) , endDate = ( 2016, Apr, 15 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "DevOps", Tag "Cloud" ] } , { name = "Clojure/west" , link = "http://clojurewest.org/" , startDate = ( 2016, Apr, 15 ) , endDate = ( 2016, Apr, 16 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Clojure", Tag "Functional Programming" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://cocoaconf.com/austin-2016/home" , startDate = ( 2016, Apr, 15 ) , endDate = ( 2016, Apr, 16 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "JSConf Uruguay" , link = "https://jsconf.uy/" , startDate = ( 2016, Apr, 15 ) , endDate = ( 2016, Apr, 16 ) , location = "Montevideo, Uruguay" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Uruguay", Tag "JavaScript" ] } , { name = "Scalar" , link = "http://scalar-conf.com/" , startDate = ( 2016, Apr, 16 ) , endDate = ( 2016, Apr, 16 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Scala" ] } , { name = "JavaScript Frameworks Day" , link = "http://frameworksdays.com/event/js-frameworks-day-2016" , startDate = ( 2016, Apr, 17 ) , endDate = ( 2016, Apr, 17 ) , location = "Kiev, Ukraine" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Russian", Tag "Developers", Tag "Ukraine", Tag "JavaScript" ] } , { name = "AWS Summit Chicago" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 18 ) , endDate = ( 2016, Apr, 19 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "PGConf US" , link = "http://www.pgconf.us/2016/" , startDate = ( 2016, Apr, 18 ) , endDate = ( 2016, Apr, 20 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PostgreSQL" ] } , { name = "ACCU" , link = "http://accu.org/index.php/conferences/accu_conference_2016" , startDate = ( 2016, Apr, 19 ) , endDate = ( 2016, Apr, 23 ) , location = "Bristol, England" , cfpStartDate = Just ( 2015, Oct, 12 ) , cfpEndDate = Just ( 2015, Nov, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General", Tag "C++" ] } , { name = "Industry Conf" , link = "http://2016.industryconf.com/" , startDate = ( 2016, Apr, 20 ) , endDate = ( 2016, Apr, 20 ) , location = "Newcastle, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "CycleConf" , link = "http://cycleconf.com/" , startDate = ( 2016, Apr, 21 ) , endDate = ( 2016, Apr, 24 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Denmark", Tag "CycleJS", Tag "JavaScript" ] } , { name = "MCE" , link = "http://mceconf.com/" , startDate = ( 2016, Apr, 21 ) , endDate = ( 2016, Apr, 22 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Poland", Tag "Mobile", Tag "UX" ] } , { name = "Render Conf" , link = "http://2016.render-conf.com/" , startDate = ( 2016, Apr, 21 ) , endDate = ( 2016, Apr, 22 ) , location = "Oxford, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "England", Tag "CSS", Tag "JavaScript", Tag "UX" ] } , { name = "dotSecurity" , link = "http://www.dotsecurity.io/" , startDate = ( 2016, Apr, 22 ) , endDate = ( 2016, Apr, 22 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Security" ] } , { name = "Generate NY" , link = "http://generateconf.com/new-york-2016" , startDate = ( 2016, Apr, 22 ) , endDate = ( 2016, Apr, 22 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "ProgSCon" , link = "http://progscon.co.uk/" , startDate = ( 2016, Apr, 22 ) , endDate = ( 2016, Apr, 22 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 21 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "Xamarin PI:NAME:<NAME>END_PI" , link = "https://evolve.xamarin.com/" , startDate = ( 2016, Apr, 24 ) , endDate = ( 2016, Apr, 28 ) , location = "Orlando, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Mobile", Tag "IOS", Tag "Android", Tag ".Net" ] } , { name = "dotScale" , link = "http://www.dotscale.io/" , startDate = ( 2016, Apr, 25 ) , endDate = ( 2016, Apr, 25 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Scalability" ] } , { name = "OpenVis Conf" , link = "https://openvisconf.com/" , startDate = ( 2016, Apr, 25 ) , endDate = ( 2016, Apr, 26 ) , location = "Boston, MA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "DataVisualization" ] } , { name = "AWS Summit Kuala Lumpur" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 26 ) , location = "Kuala Lumpur, Malaysia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Malaysia", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Sydney" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 28 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "AWS", Tag "DevOps" ] } , { name = "Craft Conf" , link = "http://craft-conf.com/2016" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 29 ) , location = "Budapest, Hungary" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Hungary", Tag "Software Craftsmanship" ] } , { name = "Kafka Summit" , link = "http://kafka-summit.org/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 26 ) , location = "San Francisco, CA" , cfpStartDate = Just ( 2015, Sep, 29 ) , cfpEndDate = Just ( 2016, Jan, 11 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://testistanbul.org/" , startDate = ( 2016, Apr, 26 ) , endDate = ( 2016, Apr, 26 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Turkish", Tag "Developers", Tag "Turkey", Tag "Testing" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://droidcon.hr/en/" , startDate = ( 2016, Apr, 27 ) , endDate = ( 2016, Apr, 29 ) , location = "Zagreb, Croatia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Croatia", Tag "Android", Tag "Mobile" ] } , { name = "Squares PI:NAME:<NAME>END_PI" , link = "http://squaresconference.com/" , startDate = ( 2016, Apr, 27 ) , endDate = ( 2016, Apr, 29 ) , location = "Grapevine, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "University of Illinois WebCon" , link = "http://webcon.illinois.edu/" , startDate = ( 2016, Apr, 27 ) , endDate = ( 2016, Apr, 28 ) , location = "Champaign, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "AWS Summit Buenos Aires" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 28 ) , location = "Buenos Aires, Argentina" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Argentina", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Singapore" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 28 ) , location = "Singapore" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "AWS", Tag "DevOps" ] } , { name = "PI:NAME:<NAME>END_PINorth" , link = "http://nsnorth.ca/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 30 ) , location = "Toronto, Ontario, Canada" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "IOS" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://lambdajam.yowconference.com.au/" , startDate = ( 2016, Apr, 28 ) , endDate = ( 2016, Apr, 29 ) , location = "Brisbane, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Functional Programming" ] } , { name = "PI:NAME:<NAME>END_PISDayES" , link = "http://jsday.es/" , startDate = ( 2016, Apr, 29 ) , endDate = ( 2016, Apr, 30 ) , location = "Madrid, Spain" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "Spanish", Tag "Developers", Tag "Spain", Tag "JavaScript", Tag "NodeJS", Tag "AngularJS" ] } , { name = "Chicago Code Camp" , link = "http://www.chicagocodecamp.com/" , startDate = ( 2016, Apr, 30 ) , endDate = ( 2016, Apr, 30 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "flatMap(Oslo)" , link = "http://2016.flatmap.no/" , startDate = ( 2016, May, 2 ) , endDate = ( 2016, May, 3 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 3 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Scala", Tag "Functional Programming", Tag "Java" ] } , { name = "AWS Summit Santiago" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 3 ) , location = "Santiago, Chile" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Chile", Tag "AWS", Tag "DevOps" ] } , { name = "Continuous Lifecycle London" , link = "http://continuouslifecycle.london/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 5 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "DevOps" ] } , { name = "JSConf Belgium" , link = "https://jsconf.be/nl/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 3 ) , location = "Brugge, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "JavaScript" ] } , { name = "YOW! West" , link = "http://west.yowconference.com.au/" , startDate = ( 2016, May, 3 ) , endDate = ( 2016, May, 4 ) , location = "Perth, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "General" ] } , { name = "ng-conf" , link = "http://www.ng-conf.org/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 6 ) , location = "Salt Lake City, UT" , cfpStartDate = Just ( 2016, Jan, 13 ) , cfpEndDate = Just ( 2016, Feb, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "AngularJS" ] } , { name = "AWS Summit Stockholm" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 4 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "AWS", Tag "DevOps" ] } , { name = "RailsConf" , link = "http://railsconf.com/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 6 ) , location = "Kansas City, MO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby", Tag "Rails" ] } , { name = "Typelevel Summit" , link = "http://typelevel.org/event/2016-05-summit-oslo/" , startDate = ( 2016, May, 4 ) , endDate = ( 2016, May, 4 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 3 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Scala", Tag "Functional Programming", Tag "Java" ] } , { name = "AWS Summit Manila" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 5 ) , endDate = ( 2016, May, 5 ) , location = "Manila, Philippines" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Philippines", Tag "AWS", Tag "DevOps" ] } , { name = "CocoaConf Seattle" , link = "http://cocoaconf.com/seattle-2016/home" , startDate = ( 2016, May, 6 ) , endDate = ( 2016, May, 7 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Cocoa" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://2016.syntaxcon.com/" , startDate = ( 2016, May, 6 ) , endDate = ( 2016, May, 7 ) , location = "Charleston, SC" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "!!PI:NAME:<NAME>END_PI" , link = "http://bangbangcon.com/" , startDate = ( 2016, May, 7 ) , endDate = ( 2016, May, 8 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "9th European Lisp Symposium" , link = "http://www.european-lisp-symposium.org/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 10 ) , location = "Krakow, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 19 ) , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "Lisp", Tag "Clojure" ] } , { name = "Apache: Big Data North America" , link = "http://www.apachecon.com/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "Vancouver, BC, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Big Data" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://beyondtellerrand.com/events/duesseldorf-2016" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "Düsseldorf, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Germany", Tag "UX", Tag "General" ] } , { name = "C++Now" , link = "http://cppnow.org/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 14 ) , location = "Aspen, CO" , cfpStartDate = Just ( 2015, Nov, 17 ) , cfpEndDate = Just ( 2016, Jan, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "C++" ] } , { name = "ChefConf" , link = "https://www.chef.io/chefconf/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Chef", Tag "DevOps" ] } , { name = "DrupalCon New Orleans" , link = "https://events.drupal.org/neworleans2016/" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 13 ) , location = "New Orleans, LA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Drupal", Tag "PHP" ] } , { name = "Scala Days New York" , link = "http://event.scaladays.org/scaladays-nyc-2016" , startDate = ( 2016, May, 9 ) , endDate = ( 2016, May, 11 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Scala" ] } , { name = "Codemotion Amsterdam" , link = "http://amsterdam2016.codemotionworld.com/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 12 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "CSSConf Budapest" , link = "http://cssconfbp.rocks/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 11 ) , location = "Budapest, Hungary" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Hungary", Tag "CSS" ] } , { name = "ElixirConf EU" , link = "http://www.elixirconf.eu/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 12 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Elixir", Tag "Functional Programming", Tag "Erlang" ] } , { name = "jsDay" , link = "http://2016.jsday.it/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 12 ) , location = "Verona, Italy" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "JavaScript" ] } , { name = "React Remote Conf" , link = "https://allremoteconfs.com/react-2016" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 13 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 9 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript", Tag "React" ] } , { name = "UX Alive" , link = "http://www.uxalive.com/" , startDate = ( 2016, May, 11 ) , endDate = ( 2016, May, 13 ) , location = "Istanbul, Turkey" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Turkey", Tag "UX" ] } , { name = "ApacheCon Core North America" , link = "http://www.apachecon.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Vancouver, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Open Source" ] } , { name = "Front Conference" , link = "http://www.frontutah.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "JSConf Budapest" , link = "http://jsconfbp.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Budapest, Hungary" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Hungary", Tag "JavaScript" ] } , { name = "An Event Apart Boston" , link = "http://aneventapart.com/event/boston-2016" , startDate = ( 2016, May, 16 ) , endDate = ( 2016, May, 18 ) , location = "Boston, MA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Open Source Convention Tutorials" , link = "http://conferences.oreilly.com/oscon/open-source" , startDate = ( 2016, May, 16 ) , endDate = ( 2016, May, 17 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source" ] } , { name = "AWS Summit Seoul" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 17 ) , endDate = ( 2016, May, 17 ) , location = "Seoul, South Korea" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "South Korea", Tag "AWS", Tag "DevOps" ] } , { name = "Front-Trends" , link = "http://2016.front-trends.com/" , startDate = ( 2016, May, 18 ) , endDate = ( 2016, May, 20 ) , location = "Warsaw, Poland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 4 ) , tags = [ Tag "English", Tag "Designers", Tag "Poland", Tag "UX" ] } , { name = "Open Source Convention" , link = "http://conferences.oreilly.com/oscon/open-source" , startDate = ( 2016, May, 18 ) , endDate = ( 2016, May, 19 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source" ] } , { name = "UX London" , link = "http://2016.uxlondon.com/" , startDate = ( 2016, May, 18 ) , endDate = ( 2016, May, 20 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "UX" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.droidcon.ca/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 20 ) , location = "Montreal, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 4 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Android", Tag "Mobile" ] } , { name = "PhoneGap Day EU" , link = "http://pgday.phonegap.com/eu2016/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 20 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "PhoneGap", Tag "Mobile" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://valiocon.com/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 22 ) , location = "San Diego, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "AWS Summit Taipei" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 20 ) , endDate = ( 2016, May, 20 ) , location = "Taipei, Taiwan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Taiwan", Tag "AWS", Tag "DevOps" ] } , { name = "self.conference" , link = "http://selfconference.org/" , startDate = ( 2016, May, 20 ) , endDate = ( 2016, May, 21 ) , location = "Detroit, MI" , cfpStartDate = Just ( 2016, Jan, 18 ) , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "General", Tag "Soft Skills" ] } , { name = "EmpEx" , link = "http://empex.co/" , startDate = ( 2016, May, 21 ) , endDate = ( 2016, May, 21 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2015, Mar, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Elixir", Tag "Functional Programming" ] } , { name = "UIKonf" , link = "http://www.uikonf.com/" , startDate = ( 2016, May, 22 ) , endDate = ( 2016, May, 25 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "IOS" ] } , { name = "GOTO Chicago Workshops" , link = "http://gotocon.com/chicago-2016" , startDate = ( 2016, May, 23 ) , endDate = ( 2016, May, 23 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "php[tek]" , link = "https://tek.phparch.com/" , startDate = ( 2016, May, 23 ) , endDate = ( 2016, May, 27 ) , location = "St. Louis, MO" , cfpStartDate = Just ( 2015, Dec, 14 ) , cfpEndDate = Just ( 2016, Jan, 16 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP" ] } , { name = "AWS Summit Netherlands" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 24 ) , location = "Nieuwegein, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "AWS", Tag "DevOps" ] } , { name = "GOTO Chicago" , link = "http://gotocon.com/chicago-2016" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 25 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "AWS Summit Mumbai" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "Mumbai, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "AWS", Tag "DevOps" ] } , { name = "HBaseCon" , link = "http://www.hbasecon.com/" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Hadoop", Tag "Big Data", Tag "Cloud" ] } , { name = "SIGNAL 2016" , link = "https://www.twilio.com/signal" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 25 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Communications" ] } , { name = "UXLx" , link = "https://www.ux-lx.com/" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 27 ) , location = "Lisbon, Portugal" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Portugal", Tag "UX" ] } , { name = "GlueCon" , link = "http://gluecon.com/" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 26 ) , location = "Broomfield, CO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General", Tag "DevOps", Tag "Big Data" ] } , { name = "PrlConf" , link = "http://www.jonprl.org/prlconf" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "Boulder, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming" ] } , { name = "PureScript Conf" , link = "https://github.com/purescript/purescript/wiki/PureScript-Conf-2016" , startDate = ( 2016, May, 25 ) , endDate = ( 2016, May, 25 ) , location = "Boulder, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming", Tag "PureScript" ] } , { name = "AWS Summit Mexico City" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 26 ) , location = "Mexico City, Mexico" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Mexico", Tag "AWS", Tag "DevOps" ] } , { name = "DevSum" , link = "http://www.devsum.se/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 27 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag ".Net" ] } , { name = "GOTO Chicago Workshops" , link = "http://gotocon.com/chicago-2016" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 26 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "iOSCon" , link = "https://skillsmatter.com/conferences/7598-ioscon-2016-the-conference-for-ios-and-swift-developers" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 27 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "IOS" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://lambdaconf.us/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 29 ) , location = "Boulder, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Functional Programming", Tag "Haskell", Tag "Scala", Tag "PureScript" ] } , { name = "Frontend United" , link = "http://frontendunited.org/" , startDate = ( 2016, May, 27 ) , endDate = ( 2016, May, 28 ) , location = "Ghent, Belgium" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Belgium", Tag "UX", Tag "Drupal", Tag "PHP" ] } , { name = "PI:NAME:<NAME>END_PICon Tutorials" , link = "https://us.pycon.org/2016/" , startDate = ( 2016, May, 28 ) , endDate = ( 2016, May, 29 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Python" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "https://us.pycon.org/2016/" , startDate = ( 2016, May, 30 ) , endDate = ( 2016, Jun, 1 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Python" ] } , { name = "AWS Summit Paris" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, May, 31 ) , endDate = ( 2016, May, 31 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Tokyo" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 3 ) , location = "Tokyo, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "AWS", Tag "DevOps" ] } , { name = "CSSConf Nordic" , link = "http://cssconf.no/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 1 ) , location = "Oslo, Norway" , cfpStartDate = Just ( 2015, Dec, 23 ) , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Norway", Tag "UX", Tag "CSS" ] } , { name = "Git Remote Conf" , link = "https://allremoteconfs.com/git-2016" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 3 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 6 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Remote", Tag "Git" ] } , { name = "PI:NAME:<NAME>END_PIagmaConf" , link = "http://www.magmaconf.com/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 3 ) , location = "Manzanillo, Mexico" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Mexico", Tag "Ruby" ] } , { name = "ScotlandCSS" , link = "http://scotlandcss.launchrock.com/" , startDate = ( 2016, Jun, 1 ) , endDate = ( 2016, Jun, 1 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Scotland", Tag "CSS" ] } , { name = "AWS Summit Madrid" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 2 ) , location = "Madrid, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "AWS", Tag "DevOps" ] } , { name = "AWS Summit Sao Paulo" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 2 ) , location = "Sao Paulo, Brazil" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Brazil", Tag "AWS", Tag "DevOps" ] } , { name = "GR8Conf EU" , link = "http://gr8conf.eu/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 4 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Denmark", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "PyCon Sprints" , link = "https://us.pycon.org/2016/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 5 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Python" ] } , { name = "ReactEurope" , link = "https://www.react-europe.org/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 3 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "React", Tag "JavaScript" ] } , { name = "Scotland JS" , link = "http://scotlandjs.com/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 3 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 12 ) , tags = [ Tag "English", Tag "Developers", Tag "Scotland", Tag "JavaScript" ] } , { name = "SoCraTes England" , link = "http://socratesuk.org/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 5 ) , location = "Dorking, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Software Craftsmanship" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "https://www.webrebels.org/" , startDate = ( 2016, Jun, 2 ) , endDate = ( 2016, Jun, 3 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "JavaScript" ] } , { name = "NodeConf Oslo" , link = "http://oslo.nodeconf.com/" , startDate = ( 2016, Jun, 4 ) , endDate = ( 2016, Jun, 4 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "NodeJS", Tag "JavaScript" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://berlinbuzzwords.de/" , startDate = ( 2016, Jun, 5 ) , endDate = ( 2016, Jun, 7 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 7 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Big Data" ] } , { name = "NDC Oslo Workshops" , link = "http://ndcoslo.com/" , startDate = ( 2016, Jun, 6 ) , endDate = ( 2016, Jun, 7 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "Spark Summit" , link = "https://spark-summit.org/2016/" , startDate = ( 2016, Jun, 6 ) , endDate = ( 2016, Jun, 8 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Big Data" ] } , { name = "NDC Oslo" , link = "http://ndcoslo.com/" , startDate = ( 2016, Jun, 8 ) , endDate = ( 2016, Jun, 10 ) , location = "Oslo, Norway" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Norway", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "UX Scotland" , link = "http://uxscotland.net/2016/" , startDate = ( 2016, Jun, 8 ) , endDate = ( 2016, Jun, 10 ) , location = "Edinburgh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Scotland", Tag "UX" ] } , { name = "NodeConf" , link = "http://nodeconf.com/" , startDate = ( 2016, Jun, 9 ) , endDate = ( 2016, Jun, 12 ) , location = "Petaluma, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "NodeJS", Tag "JavaScript" ] } , { name = "GOTO Amsterdam Workshops" , link = "http://gotocon.com/amsterdam-2016/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 13 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "QCon New York" , link = "https://qconnewyork.com/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 15 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "enterJS" , link = "https://www.enterjs.de/" , startDate = ( 2016, Jun, 14 ) , endDate = ( 2016, Jun, 16 ) , location = "Darmstadt, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "German", Tag "Developers", Tag "Germany", Tag "JavaScript" ] } , { name = "GOTO Amsterdam" , link = "http://gotocon.com/amsterdam-2016/" , startDate = ( 2016, Jun, 14 ) , endDate = ( 2016, Jun, 15 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Just ( 2016, Jan, 14 ) , cfpEndDate = Just ( 2016, Mar, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://droidcon.de/" , startDate = ( 2016, Jun, 15 ) , endDate = ( 2016, Jun, 17 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Android", Tag "Mobile" ] } , { name = "Front End Design Conference" , link = "http://frontenddesignconference.com/" , startDate = ( 2016, Jun, 15 ) , endDate = ( 2016, Jun, 17 ) , location = "St. Petersburg, FL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Scala Days Berlin" , link = "http://event.scaladays.org/scaladays-berlin-2016" , startDate = ( 2016, May, 15 ) , endDate = ( 2016, May, 17 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "Scala" ] } , { name = "AWS Summit Tel Aviv" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 16 ) , endDate = ( 2016, Jun, 16 ) , location = "Tel Aviv, Israel" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Israel", Tag "AWS", Tag "DevOps" ] } , { name = "CSS Day" , link = "http://cssday.nl/2016" , startDate = ( 2016, Jun, 16 ) , endDate = ( 2016, Jun, 17 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Netherlands", Tag "CSS" ] } , { name = "QCon New York Tutorials" , link = "https://qconnewyork.com/" , startDate = ( 2016, Jun, 16 ) , endDate = ( 2016, Jun, 17 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "Joy of Coding" , link = "http://joyofcoding.org/" , startDate = ( 2016, Jun, 17 ) , endDate = ( 2016, Jun, 17 ) , location = "Rotterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 17 ) , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "General" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.nordicruby.org/" , startDate = ( 2016, Jun, 17 ) , endDate = ( 2016, Jun, 19 ) , location = "Stockholm, Sweden" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Sweden", Tag "Ruby" ] } , { name = "DockerCon" , link = "http://2016.dockercon.com/" , startDate = ( 2016, Jun, 19 ) , endDate = ( 2016, Jun, 21 ) , location = "Seattle, WA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Docker" ] } , { name = "Public Sector Summit" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 20 ) , endDate = ( 2016, Jun, 21 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "O'Reilly Velocity" , link = "http://conferences.oreilly.com/velocity/devops-web-performance-ca/" , startDate = ( 2016, Jun, 21 ) , endDate = ( 2016, Jun, 23 ) , location = "Santa Clara, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jan, 11 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Scalability", Tag "DevOps" ] } , { name = "CodePI:NAME:<NAME>END_PI" , link = "http://dublin2016.codemotionworld.com/" , startDate = ( 2016, Jun, 22 ) , endDate = ( 2016, Jun, 23 ) , location = "Dublin, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "General" ] } , { name = "RedDotRubyConf" , link = "http://www.reddotrubyconf.com/" , startDate = ( 2016, Jun, 23 ) , endDate = ( 2016, Jun, 24 ) , location = "Singapore" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 28 ) , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "Ruby" ] } , { name = "Web PI:NAME:<NAME>END_PI" , link = "http://webdesignday.com/" , startDate = ( 2016, Jun, 23 ) , endDate = ( 2016, Jun, 24 ) , location = "Pittsburgh, PA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "DinosPI:NAME:<NAME>END_PI.js" , link = "http://dinosaurjs.org/" , startDate = ( 2016, Jun, 24 ) , endDate = ( 2016, Jun, 24 ) , location = "Denver, CO" , cfpStartDate = Just ( 2016, Feb, 1 ) , cfpEndDate = Just ( 2016, Mar, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.giantux.com/conf2016/" , startDate = ( 2016, Jun, 27 ) , endDate = ( 2016, Jun, 29 ) , location = "TBD" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "PI:NAME:<NAME>END_PIta Love Frontend" , link = "http://yougottalovefrontend.com/" , startDate = ( 2016, Jun, 27 ) , endDate = ( 2016, Jun, 28 ) , location = "Tel Aviv, Israel" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Israel", Tag "JavaScript", Tag "AngularJS", Tag "React", Tag "CSS", Tag "General" ] } , { name = "Hadoop Summit North America" , link = "http://2016.hadoopsummit.org/san-jose/" , startDate = ( 2016, Jun, 28 ) , endDate = ( 2016, Jun, 30 ) , location = "San Jose, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Hadoop", Tag "Big Data", Tag "Internet Of Things" ] } , { name = "MongoDB World 2016" , link = "https://www.mongodb.com/world16" , startDate = ( 2016, Jun, 28 ) , endDate = ( 2016, Jun, 29 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "MongoDB", Tag "Big Data" ] } , { name = "AWS Summit Auckland" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jun, 29 ) , endDate = ( 2016, Jun, 29 ) , location = "Auckland, New Zealand" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "New Zealand", Tag "AWS", Tag "DevOps" ] } , { name = "PolyConf" , link = "http://polyconf.com/" , startDate = ( 2016, Jun, 30 ) , endDate = ( 2016, Jul, 2 ) , location = "Poznan, Poland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Poland", Tag "General" ] } , { name = "AWS Summit London" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jul, 6 ) , endDate = ( 2016, Jul, 7 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "AWS", Tag "DevOps" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://brightonruby.com/" , startDate = ( 2016, Jul, 8 ) , endDate = ( 2016, Jul, 8 ) , location = "Brighton, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Ruby" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "https://www.chef.io/chefconf/" , startDate = ( 2016, Jul, 11 ) , endDate = ( 2016, Jul, 13 ) , location = "Austin, TX" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Chef", Tag "DevOps" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "https://www.gophercon.com/" , startDate = ( 2016, Jul, 11 ) , endDate = ( 2016, Jul, 13 ) , location = "Denver, CO" , cfpStartDate = Just ( 2016, Jan, 1 ) , cfpEndDate = Just ( 2016, Jan, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Go" ] } , { name = "AWS Summit Santa Clara" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Jul, 12 ) , endDate = ( 2016, Jul, 13 ) , location = "Santa Clara, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "Newbie Remote Conf" , link = "https://allremoteconfs.com/newbie-2016" , startDate = ( 2016, Jul, 13 ) , endDate = ( 2016, Jul, 15 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 11 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Remote", Tag "General" ] } , { name = "Generate San Francisco" , link = "http://www.generateconf.com/san-francisco-2016/" , startDate = ( 2016, Jul, 15 ) , endDate = ( 2016, Jul, 15 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "EuroPython" , link = "http://ep2016.europython.eu/" , startDate = ( 2016, Jul, 17 ) , endDate = ( 2016, Jul, 24 ) , location = "Bilbao, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Python" ] } , { name = "php[cruise]" , link = "https://cruise.phparch.com/" , startDate = ( 2016, Jul, 17 ) , endDate = ( 2016, Jul, 24 ) , location = "Baltimore, MD" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://curry-on.org/2016/" , startDate = ( 2016, Jul, 18 ) , endDate = ( 2016, Jul, 19 ) , location = "Rome, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "General" ] } , { name = "UPI:NAME:<NAME>END_PI" , link = "https://uberconf.com/conference/denver/2016/07/home" , startDate = ( 2016, Jul, 19 ) , endDate = ( 2016, Jul, 22 ) , location = "Denver, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Java", Tag "Agile", Tag "Cloud", Tag "Scala", Tag "Groovy" ] } , { name = "European Conference on Object-Oriented Programming" , link = "http://2016.ecoop.org/" , startDate = ( 2016, Jul, 20 ) , endDate = ( 2016, Jul, 22 ) , location = "Rome, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "General" ] } , { name = "An Event Apart DC" , link = "http://aneventapart.com/event/washington-dc-2016" , startDate = ( 2016, Jul, 25 ) , endDate = ( 2016, Jul, 27 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Mobile & Web CodeCamp" , link = "http://www.mobilewebcodecamp.com/" , startDate = ( 2016, Jul, 26 ) , endDate = ( 2016, Jul, 29 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Mobile", Tag "Android", Tag "IOS", Tag "JavaScript", Tag "PhoneGap" ] } , { name = "GR8Conf US" , link = "http://gr8conf.org/" , startDate = ( 2016, Jul, 27 ) , endDate = ( 2016, Jul, 29 ) , location = "Minneapolis, MN" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Java", Tag "Groovy", Tag "Grails", Tag "Gradle" ] } , { name = "Forward 5 Web Summit" , link = "http://forwardjs.com/" , startDate = ( 2016, Jul, 28 ) , endDate = ( 2016, Jul, 28 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "Forward Swift" , link = "http://forwardjs.com/" , startDate = ( 2016, Jul, 28 ) , endDate = ( 2016, Jul, 28 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Swift" ] } , { name = "NDC Sydney Workshops" , link = "http://ndcsydney.com/" , startDate = ( 2016, Aug, 1 ) , endDate = ( 2016, Aug, 2 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "AWS Summit Canberra" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Aug, 3 ) , endDate = ( 2016, Aug, 3 ) , location = "Canberra, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "AWS", Tag "DevOps" ] } , { name = "NDC Sydney" , link = "http://ndcsydney.com/" , startDate = ( 2016, Aug, 3 ) , endDate = ( 2016, Aug, 5 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "Agile", Tag ".Net", Tag "General" ] } , { name = "CSSconf Argentina" , link = "http://cssconfar.com/" , startDate = ( 2016, Aug, 7 ) , endDate = ( 2016, Aug, 7 ) , location = "Buenos Aires, Argentina" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Argentina", Tag "CSS" ] } , { name = "That Conference" , link = "https://www.thatconference.com/" , startDate = ( 2016, Aug, 8 ) , endDate = ( 2016, Aug, 10 ) , location = "Wisconsin Dells, WI" , cfpStartDate = Just ( 2016, Mar, 1 ) , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Mobile", Tag "Cloud" ] } , { name = "AWS Summit New York" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Aug, 10 ) , endDate = ( 2016, Aug, 11 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "DevOps" ] } , { name = "MidPI:NAME:<NAME>END_PI JS" , link = "http://midwestjs.com/" , startDate = ( 2016, Aug, 10 ) , endDate = ( 2016, Aug, 12 ) , location = "Minneapolis, MN" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "NodeJS" ] } , { name = "Robots Remote Conf" , link = "https://allremoteconfs.com/robots-2016" , startDate = ( 2016, Aug, 10 ) , endDate = ( 2016, Aug, 12 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jul, 9 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Robotics" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://fpconf.org/" , startDate = ( 2016, Aug, 15 ) , endDate = ( 2016, Aug, 15 ) , location = "Moscow, Russia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Russian", Tag "Developers", Tag "Russia", Tag "Functional Programming", Tag "Erlang", Tag "Scala", Tag "Clojure", Tag "Haskell" ] } , { name = "Abstractions" , link = "http://abstractions.io/" , startDate = ( 2016, Aug, 18 ) , endDate = ( 2016, Aug, 20 ) , location = "Pittsburgh, PA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "HybridConf" , link = "https://hybridconf.net/" , startDate = ( 2016, Aug, 18 ) , endDate = ( 2016, Aug, 19 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Germany", Tag "General", Tag "UX" ] } , { name = "360|iDev" , link = "http://360idev.com/" , startDate = ( 2016, Aug, 21 ) , endDate = ( 2016, Aug, 24 ) , location = "Denver, CO" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS" ] } , { name = "JSConf Iceland" , link = "http://2016.jsconf.is/" , startDate = ( 2016, Aug, 25 ) , endDate = ( 2016, Aug, 26 ) , location = "Reykjavik, Iceland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "Iceland", Tag "JavaScript" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.reactrally.com/" , startDate = ( 2016, Aug, 25 ) , endDate = ( 2016, Aug, 26 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "React", Tag "JavaScript" ] } , { name = "BrazilJS" , link = "https://braziljs.org/conf" , startDate = ( 2016, Aug, 26 ) , endDate = ( 2016, Aug, 27 ) , location = "Porto Alegre, Brazil" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 30 ) , tags = [ Tag "English", Tag "Spanish", Tag "Portuguese", Tag "Developers", Tag "Brazil", Tag "JavaScript" ] } , { name = "AlterConf South Africa" , link = "http://www.alterconf.com/sessions/cape-town-south-africa" , startDate = ( 2016, Aug, 27 ) , endDate = ( 2016, Aug, 27 ) , location = "Cape Town, South Africa" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 16 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "South Africa", Tag "Diversity", Tag "Soft Skills" ] } , { name = "An Event Apart Chicago" , link = "http://aneventapart.com/event/chicago-2016" , startDate = ( 2016, Aug, 29 ) , endDate = ( 2016, Aug, 31 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "Agile on the Beach" , link = "http://agileonthebeach.com/2016-2/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 2 ) , location = "Falmouth, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 29 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "https://2016.coldfrontconf.com/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 1 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Designers", Tag "Denmark", Tag "JavaScript", Tag "CSS", Tag "Mobile" ] } , { name = "Frontend Conference Zurich" , link = "https://frontendconf.ch/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 2 ) , location = "Zürich, Switzerland" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Switzerland", Tag "UX" ] } , { name = "Full Stack Fest" , link = "http://2016.fullstackfest.com/" , startDate = ( 2016, Sep, 5 ) , endDate = ( 2016, Sep, 9 ) , location = "Barcelona, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "Ruby", Tag "JavaScript", Tag "General" ] } , { name = "Generate Sydney" , link = "http://www.generateconf.com/" , startDate = ( 2016, Sep, 5 ) , endDate = ( 2016, Sep, 5 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "UX" ] } , { name = "iOSDevEngland" , link = "http://www.iosdevuk.com/" , startDate = ( 2016, Sep, 5 ) , endDate = ( 2016, Sep, 8 ) , location = "Aberystwyth, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "IOS", Tag "Swift" ] } , { name = "RubyPI:NAME:<NAME>END_PI" , link = "http://rubykaigi.org/2016" , startDate = ( 2016, Sep, 8 ) , endDate = ( 2016, Sep, 10 ) , location = "Kyoto, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "English", Tag "Japanese", Tag "Ruby" ] } , { name = "CocoaConf DC" , link = "http://cocoaconf.com/dc-2016/home" , startDate = ( 2016, Sep, 9 ) , endDate = ( 2016, Sep, 10 ) , location = "Washington, DC" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "AgPI:NAME:<NAME>END_PI" , link = "http://agileprague.com/" , startDate = ( 2016, Sep, 12 ) , endDate = ( 2016, Sep, 13 ) , location = "Prague, Czech Republic" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "Czech Republic", Tag "Agile" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://swanseacon.co.uk/" , startDate = ( 2016, Sep, 12 ) , endDate = ( 2016, Sep, 13 ) , location = "Swansea, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Feb, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Agile", Tag "Software Craftsmanship" ] } , { name = "Angular Remote Conf" , link = "https://allremoteconfs.com/angular-2016" , startDate = ( 2016, Sep, 14 ) , endDate = ( 2016, Sep, 16 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Aug, 13 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "JavaScript", Tag "AngularJS" ] } , { name = "From the Front" , link = "http://2016.fromthefront.it/" , startDate = ( 2016, Sep, 15 ) , endDate = ( 2016, Sep, 16 ) , location = "Bologna, Italy" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 15 ) , tags = [ Tag "English", Tag "Designers", Tag "Italy", Tag "UX" ] } , { name = "Strangeloop" , link = "http://thestrangeloop.com/" , startDate = ( 2016, Sep, 15 ) , endDate = ( 2016, Sep, 17 ) , location = "St. Louis, MO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 9 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General", Tag "Functional Programming" ] } , { name = "WindyCityRails" , link = "https://www.windycityrails.com/" , startDate = ( 2016, Sep, 15 ) , endDate = ( 2016, Sep, 16 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby", Tag "Rails" ] } , { name = "WindyCityThings" , link = "https://www.windycitythings.com/" , startDate = ( 2016, Jun, 23 ) , endDate = ( 2016, Jun, 24 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Internet Of Things", Tag "RaspberryPi", Tag "Arduino" ] } , { name = "CppCon" , link = "http://cppcon.org/" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 23 ) , location = "Bellevue, WA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 22 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "C++" ] } , { name = "International Conference on Functional Programming" , link = "http://conf.researchr.org/home/icfp-2016" , startDate = ( 2016, Sep, 19 ) , endDate = ( 2016, Sep, 21 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 16 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell" ] } , { name = "Commercial Users of Functional Programming" , link = "http://cufp.org/2016/" , startDate = ( 2016, Sep, 24 ) , endDate = ( 2016, Sep, 24 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 24 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell", Tag "OCaml", Tag "PureScript", Tag "Clojure" ] } , { name = "Haskell Implementors' Workshop" , link = "https://wiki.haskell.org/HaskellImplementorsWorkshop/2016" , startDate = ( 2016, Sep, 24 ) , endDate = ( 2016, Sep, 24 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell" ] } , { name = "Workshop on Functional Art, Music, Modeling and Design" , link = "http://functional-art.org/2016/" , startDate = ( 2016, Sep, 24 ) , endDate = ( 2016, Sep, 24 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 24 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Haskell Symposium" , link = "https://www.haskell.org/haskell-symposium/2016/index.html" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 23 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 6 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Haskell" ] } , { name = "Workshop on ML" , link = "http://www.mlworkshop.org/ml2016" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 22 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "F#", Tag "OCaml" ] } , { name = "OCaml Users and Developers Workshop" , link = "http://www.mlworkshop.org/ml2016" , startDate = ( 2016, Sep, 23 ) , endDate = ( 2016, Sep, 23 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "OCaml" ] } , { name = "Workshop on Functional High-Performance Computing" , link = "https://sites.google.com/site/fhpcworkshops/" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 22 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Erlang Workshop" , link = "http://conf.researchr.org/track/icfp-2016/erlang-2016-papers" , startDate = ( 2016, Sep, 23 ) , endDate = ( 2016, Sep, 23 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 3 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Erlang" ] } , { name = "Workshop on Type-Driven Development" , link = "http://conf.researchr.org/track/icfp-2016/tyde-2016-papers" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Higher-Order Programming Effects Workshop" , link = "http://conf.researchr.org/track/icfp-2016/hope-2016-papers" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "Scheme Workshop" , link = "http://scheme2016.snow-fort.org/" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 24 ) , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming", Tag "Lisp", Tag "Clojure" ] } , { name = "Programming Languages Mentoring Workshop" , link = "http://conf.researchr.org/track/PLMW-ICFP-2016/PLMW-ICFP-2016" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 18 ) , location = "Nara, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Functional Programming" ] } , { name = "JavaOne" , link = "https://www.oracle.com/javaone/index.html" , startDate = ( 2016, Sep, 18 ) , endDate = ( 2016, Sep, 22 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Java" ] } , { name = "Generate London" , link = "http://www.generateconf.com/" , startDate = ( 2016, Sep, 21 ) , endDate = ( 2016, Sep, 23 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "UX" ] } , { name = "AWS Summit Rio de Janeiro" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 22 ) , location = "Rio de Janeiro, Brazil" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Brazil", Tag "AWS", Tag "DevOps" ] } , { name = "Functional Conf" , link = "http://functionalconf.com/" , startDate = ( 2016, Sep, 22 ) , endDate = ( 2016, Sep, 25 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Functional Programming" ] } , { name = "DrupalCon PI:NAME:<NAME>END_PI" , link = "https://events.drupal.org/dublin2016/" , startDate = ( 2016, Sep, 26 ) , endDate = ( 2016, Sep, 30 ) , location = "Dublin, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "Drupal", Tag "PHP" ] } , { name = "AngularConnect" , link = "http://angularconnect.com/" , startDate = ( 2016, Sep, 27 ) , endDate = ( 2016, Sep, 28 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "JavaScript", Tag "AngularJS" ] } , { name = "AWS Summit Lima" , link = "https://aws.amazon.com/summits/" , startDate = ( 2016, Sep, 28 ) , endDate = ( 2016, Sep, 28 ) , location = "Lima, Peru" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Peru", Tag "AWS", Tag "DevOps" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://jazoon.com/" , startDate = ( 2016, Sep, 30 ) , endDate = ( 2016, Sep, 30 ) , location = "Zurich, Switzerland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Switzerland", Tag "JavaScript", Tag "AngularJS", Tag "Ember" ] } , { name = "An Event Apart Orlando" , link = "http://aneventapart.com/event/orlando-special-edition-2016" , startDate = ( 2016, Oct, 3 ) , endDate = ( 2016, Oct, 5 ) , location = "Orlando, FL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "GOTO Copenhagen" , link = "http://gotocon.com/cph-2015/" , startDate = ( 2016, Oct, 3 ) , endDate = ( 2016, Oct, 6 ) , location = "Copenhagen, Denmark" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Denmark", Tag "General" ] } , { name = "LoopConf" , link = "https://loopconf.com/" , startDate = ( 2016, Oct, 5 ) , endDate = ( 2016, Oct, 7 ) , location = "Fort Lauderdale, FL" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "PHP", Tag "WordPress" ] } , { name = "dotGo" , link = "http://2016.dotgo.eu/" , startDate = ( 2016, Oct, 10 ) , endDate = ( 2016, Oct, 10 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "Go" ] } , { name = "GOTO London" , link = "http://gotocon.com/" , startDate = ( 2016, Oct, 12 ) , endDate = ( 2016, Oct, 14 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "General" ] } , { name = "Rails Remote Conf" , link = "https://allremoteconfs.com/rails-2016" , startDate = ( 2016, Oct, 12 ) , endDate = ( 2016, Oct, 14 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Sep, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "Rails", Tag "Ruby" ] } , { name = "CocoaLove" , link = "http://cocoalove.org/" , startDate = ( 2016, Oct, 14 ) , endDate = ( 2016, Oct, 16 ) , location = "Philadelphia, PA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Cocoa", Tag "IOS" ] } , { name = "CSS Dev Conf" , link = "http://2016.cssdevconf.com/" , startDate = ( 2016, Oct, 17 ) , endDate = ( 2016, Oct, 19 ) , location = "San Antonio, TX" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "CSS" ] } , { name = "Full Stack Toronto" , link = "https://fsto.co/" , startDate = ( 2016, Oct, 17 ) , endDate = ( 2016, Oct, 18 ) , location = "Toronto, Canada" , cfpStartDate = Just ( 2016, Jan, 1 ) , cfpEndDate = Just ( 2016, Jul, 31 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Canada", Tag "General" ] } , { name = "ConnectJS" , link = "http://connect-js.com/" , startDate = ( 2016, Oct, 21 ) , endDate = ( 2016, Oct, 22 ) , location = "Atlanta, GA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "JavaScript" ] } , { name = "Codemotion Berlin" , link = "http://berlin2015.codemotionworld.com/" , startDate = ( 2016, Oct, 24 ) , endDate = ( 2016, Oct, 25 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "General" ] } , { name = "ng-europe" , link = "https://ngeurope.org/" , startDate = ( 2016, Oct, 25 ) , endDate = ( 2016, Oct, 26 ) , location = "Paris, France" , cfpStartDate = Just ( 2016, Feb, 17 ) , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "JavaScript", Tag "AngularJS" ] } , { name = "Smashing Conf Barcelona" , link = "http://smashingconf.com/" , startDate = ( 2016, Oct, 25 ) , endDate = ( 2016, Oct, 26 ) , location = "Barcelona, Spain" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Spain", Tag "UX" ] } , { name = "Spark Summit Europe" , link = "https://spark-summit.org/" , startDate = ( 2016, Oct, 25 ) , endDate = ( 2016, Oct, 27 ) , location = "Brussels, Belgium" , cfpStartDate = Just ( 2016, Jun, 1 ) , cfpEndDate = Just ( 2016, Jul, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "Belgium", Tag "Big Data" ] } , { name = "An Event Apart San Francisco" , link = "http://aneventapart.com/event/san-francisco-2016" , startDate = ( 2016, Oct, 31 ) , endDate = ( 2016, Nov, 2 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "UX" ] } , { name = "CocoaConf San Jose" , link = "http://cocoaconf.com/sanjose-2016/home" , startDate = ( 2016, Nov, 4 ) , endDate = ( 2016, Nov, 5 ) , location = "San Jose, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS", Tag "Cocoa" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://beyondtellerrand.com/events/berlin-2016" , startDate = ( 2016, Nov, 7 ) , endDate = ( 2016, Nov, 9 ) , location = "Berlin, Germany" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Germany", Tag "UX", Tag "General" ] } , { name = "Devops Remote Conf" , link = "https://allremoteconfs.com/devops-2016" , startDate = ( 2016, Nov, 9 ) , endDate = ( 2016, Nov, 11 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Oct, 8 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "DevOps" ] } , { name = "droidconIN" , link = "https://droidcon.in/2016/" , startDate = ( 2016, Nov, 10 ) , endDate = ( 2016, Nov, 11 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Aug, 10 ) , tags = [ Tag "English", Tag "Developers", Tag "India", Tag "Android", Tag "Mobile" ] } , { name = "RubyConf" , link = "http://rubyconf.org/" , startDate = ( 2016, Nov, 10 ) , endDate = ( 2016, Nov, 12 ) , location = "Cincinnati, OH" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Ruby" ] } , { name = "BuildStuff" , link = "http://buildstuff.lt/" , startDate = ( 2016, Nov, 16 ) , endDate = ( 2016, Nov, 20 ) , location = "Vilnius, Lithuania" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Lithuania", Tag "General" ] } , { name = "Frontier Conf" , link = "https://www.frontierconf.com/" , startDate = ( 2016, Nov, 16 ) , endDate = ( 2016, Nov, 16 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "England", Tag "CSS", Tag "UX" ] } , { name = "Generate Bangalore" , link = "http://www.generateconf.com/" , startDate = ( 2016, Nov, 25 ) , endDate = ( 2016, Nov, 25 ) , location = "Bangalore, India" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "India", Tag "UX" ] } , { name = "AWS re:Invent" , link = "https://reinvent.awsevents.com/" , startDate = ( 2016, Nov, 28 ) , endDate = ( 2016, Dec, 2 ) , location = "Las Vegas, NV" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "AWS", Tag "Cloud" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://js-kongress.de/" , startDate = ( 2016, Nov, 28 ) , endDate = ( 2016, Nov, 29 ) , location = "Munich, Germany" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 15 ) , tags = [ Tag "English", Tag "Developers", Tag "Germany", Tag "JavaScript" ] } , { name = "CSSConf AU" , link = "http://2016.cssconf.com.au/" , startDate = ( 2016, Nov, 30 ) , endDate = ( 2016, Nov, 30 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Australia", Tag "CSS" ] } , { name = "JSConf AU" , link = "http://jsconfau.com/" , startDate = ( 2016, Dec, 1 ) , endDate = ( 2016, Dec, 1 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "JavaScript" ] } , { name = "Clojure eXchange" , link = "https://skillsmatter.com/conferences/7430-clojure-exchange-2016" , startDate = ( 2016, Dec, 1 ) , endDate = ( 2016, Dec, 2 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "Clojure", Tag "Functional Programming" ] } , { name = "Decompress" , link = "http://2016.cssconf.com.au/" , startDate = ( 2016, Dec, 2 ) , endDate = ( 2016, Dec, 2 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Australia", Tag "General" ] } , { name = "dotCSS" , link = "http://www.dotcss.io/" , startDate = ( 2016, Dec, 2 ) , endDate = ( 2016, Dec, 2 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "France", Tag "CSS" ] } , { name = "dotJS" , link = "http://www.dotjs.io/" , startDate = ( 2016, Dec, 5 ) , endDate = ( 2016, Dec, 5 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "JavaScript" ] } , { name = "NoSQL Remote Conf" , link = "https://allremoteconfs.com/nosql-2016" , startDate = ( 2016, Dec, 7 ) , endDate = ( 2016, Dec, 9 ) , location = "Remote" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Nov, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "Remote", Tag "NoSQL" ] } , { name = "Midwest.io" , link = "http://www.midwest.io/" , startDate = ( 2016, Aug, 22 ) , endDate = ( 2016, Aug, 23 ) , location = "Kansas City, MO" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "ServerlessConf" , link = "http://serverlessconf.io/" , startDate = ( 2016, May, 26 ) , endDate = ( 2016, May, 27 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 26 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General", Tag "AWS", Tag "Cloud", Tag "Scalability" ] } , { name = "AgileIndy" , link = "http://agileindy.org/" , startDate = ( 2016, Apr, 12 ) , endDate = ( 2016, Apr, 12 ) , location = "Indianapolis, IN" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Agile" ] } , { name = "RSJS" , link = "http://rsjs.org/2016/" , startDate = ( 2016, Apr, 23 ) , endDate = ( 2016, Apr, 23 ) , location = "Porto Alegre, Brazil" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Mar, 31 ) , tags = [ Tag "Portuguese", Tag "Developers", Tag "Brazil", Tag "JavaScript" ] } , { name = "Frontinsampa" , link = "http://frontinsampa.com.br/" , startDate = ( 2016, Jul, 2 ) , endDate = ( 2016, Jul, 2 ) , location = "Sao Paulo, Brazil" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "Portuguese", Tag "Developers", Tag "Brazil", Tag "JavaScript" ] } , { name = ".NET Fringe" , link = "http://dotnetfringe.org/" , startDate = ( 2016, Jul, 10 ) , endDate = ( 2016, Jul, 12 ) , location = "Portland, OR" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 30 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Open Source", Tag ".Net" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://2016.ull.ie/" , startDate = ( 2016, Nov, 1 ) , endDate = ( 2016, Nov, 2 ) , location = "Killarney, Ireland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Ireland", Tag "IOS" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://fpday.org/" , startDate = ( 2016, Mar, 26 ) , endDate = ( 2016, Mar, 26 ) , location = "Nantes, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "French", Tag "Developers", Tag "France", Tag "Functional Programming" ] } , { name = "HalfStack" , link = "http://halfstackconf.com/" , startDate = ( 2016, Nov, 18 ) , endDate = ( 2016, Nov, 18 ) , location = "London, England" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Oct, 18 ) , tags = [ Tag "English", Tag "Developers", Tag "England", Tag "JavaScript" ] } , { name = "Front Conference" , link = "https://frontutah.com/" , startDate = ( 2016, May, 12 ) , endDate = ( 2016, May, 13 ) , location = "Salt Lake City, UT" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "Port80" , link = "http://port80events.co.uk/" , startDate = ( 2016, May, 20 ) , endDate = ( 2016, May, 20 ) , location = "Newport, Wales" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "Wales", Tag "UX", Tag "Web" ] } , { name = "Code 2016 Sydney" , link = "http://www.webdirections.org/code16/" , startDate = ( 2016, Jul, 28 ) , endDate = ( 2016, Jul, 29 ) , location = "Sydney, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "JavaScript" ] } , { name = "Code 2016 Melbourne" , link = "http://www.webdirections.org/code16/" , startDate = ( 2016, Aug, 1 ) , endDate = ( 2016, Aug, 2 ) , location = "Melbourne, Australia" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Australia", Tag "JavaScript" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://2016.cascadiafest.org/" , startDate = ( 2016, Aug, 3 ) , endDate = ( 2016, Aug, 5 ) , location = "Semiahmoo, WA" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Apr, 11 ) , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "CSS", Tag "JavaScript", Tag "Web", Tag "NodeJS" ] } , { name = "React Amsterdam" , link = "http://react-amsterdam.com/" , startDate = ( 2016, Apr, 16 ) , endDate = ( 2016, Apr, 16 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "JavaScript", Tag "React" ] } , { name = "NSSpain" , link = "http://nsspain.com/" , startDate = ( 2016, Sep, 14 ) , endDate = ( 2016, Sep, 16 ) , location = "La Rioja, Spain" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Jun, 5 ) , tags = [ Tag "English", Tag "Developers", Tag "Spain", Tag "IOS" ] } , { name = "try! Swift NYC" , link = "http://www.tryswiftnyc.com/" , startDate = ( 2016, Sep, 1 ) , endDate = ( 2016, Sep, 2 ) , location = "New York, NY" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Swift", Tag "IOS" ] } , { name = "FrenchKit" , link = "http://frenchkit.fr/" , startDate = ( 2016, Sep, 23 ) , endDate = ( 2016, Sep, 24 ) , location = "Paris, France" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "France", Tag "IOS", Tag "Cocoa" ] } , { name = "AltConf" , link = "http://altconf.com/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 16 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "General" ] } , { name = "WWDC" , link = "https://developer.apple.com/wwdc/" , startDate = ( 2016, Jun, 13 ) , endDate = ( 2016, Jun, 17 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Designers", Tag "USA", Tag "IOS" ] } , { name = "Thunder Plains" , link = "http://thunderplainsconf.com/" , startDate = ( 2016, Nov, 3 ) , endDate = ( 2016, Nov, 3 ) , location = "Oklahoma City, OK" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "Developers", Tag "USA", Tag "JavaScript", Tag "CSS", Tag "Mobile", Tag "Web" ] } , { name = "Scala Up North" , link = "http://scalaupnorth.com/" , startDate = ( 2016, Aug, 5 ) , endDate = ( 2016, Aug, 6 ) , location = "Montreal, Canada" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 14 ) , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Scala" ] } , { name = "XP 2016" , link = "http://conf.xp2016.org/" , startDate = ( 2016, May, 24 ) , endDate = ( 2016, May, 27 ) , location = "Edinbrugh, Scotland" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Scotland", Tag "Agile" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://valiocon.com/" , startDate = ( 2016, May, 19 ) , endDate = ( 2016, May, 22 ) , location = "San Diego, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Designers", Tag "USA", Tag "UX" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.jailbreakcon.com/" , startDate = ( 2016, Jun, 20 ) , endDate = ( 2016, Jun, 21 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "IOS" ] } , { name = "#Pragma Conference" , link = "http://pragmaconference.com/" , startDate = ( 2016, Oct, 12 ) , endDate = ( 2016, Oct, 14 ) , location = "Verona, Italy" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Italy", Tag "IOS" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "https://www.defcon.org/" , startDate = ( 2016, Aug, 4 ) , endDate = ( 2016, Aug, 7 ) , location = "Las Vegas, NV" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, May, 2 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "https://www.derbycon.com/" , startDate = ( 2016, Aug, 23 ) , endDate = ( 2016, Aug, 25 ) , location = "Louisville, KY" , cfpStartDate = Nothing , cfpEndDate = Just ( 2016, Aug, 1 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "Black Hat" , link = "https://www.blackhat.com/us-16/" , startDate = ( 2016, Jul, 30 ) , endDate = ( 2016, Aug, 4 ) , location = "Las Vegas, NV" , cfpStartDate = Just ( 2016, Feb, 9 ) , cfpEndDate = Just ( 2016, Apr, 11 ) , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "RSA Conference USA" , link = "http://www.rsaconference.com/events/us16" , startDate = ( 2016, Feb, 29 ) , endDate = ( 2016, Mar, 4 ) , location = "San Francisco, CA" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "RSA Conference Asia Pacific & Japan" , link = "http://www.rsaconference.com/events/ap16" , startDate = ( 2016, Jul, 20 ) , endDate = ( 2016, Jul, 22 ) , location = "Singapore" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Singapore", Tag "Security" ] } , { name = "RSA Conference Abu Dhabi" , link = "http://www.rsaconference.com/events/ad16" , startDate = ( 2016, Nov, 15 ) , endDate = ( 2016, Nov, 16 ) , location = "Abu Dhabi, UAE" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "UAE", Tag "Security" ] } , { name = "CanSecWest" , link = "https://cansecwest.com/" , startDate = ( 2016, Mar, 16 ) , endDate = ( 2016, Mar, 18 ) , location = "Vancouver, Canada" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Canada", Tag "Security" ] } , { name = "PanSec" , link = "https://pacsec.jp/" , startDate = ( 2016, Oct, 26 ) , endDate = ( 2016, Oct, 27 ) , location = "Tokyo, Japan" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Japan", Tag "Security" ] } , { name = "EUSecWest" , link = "https://eusecwest.com/" , startDate = ( 2016, Sep, 19 ) , endDate = ( 2016, Sep, 20 ) , location = "Amsterdam, Netherlands" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "Netherlands", Tag "Security" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://www.carolinacon.org/" , startDate = ( 2016, Mar, 4 ) , endDate = ( 2016, Mar, 4 ) , location = "Raleigh, North Carolina" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } , { name = "PI:NAME:<NAME>END_PI" , link = "http://thotcon.org/" , startDate = ( 2016, May, 5 ) , endDate = ( 2016, May, 6 ) , location = "Chicago, IL" , cfpStartDate = Nothing , cfpEndDate = Nothing , tags = [ Tag "English", Tag "Developers", Tag "USA", Tag "Security" ] } ] , currentDate = ( 2016, Jan, 1 ) , tags = [ { sectionName = "Conference Language" , tags = [ FilteredTag.init (Tag "English") , FilteredTag.init (Tag "French") , FilteredTag.init (Tag "German") , FilteredTag.init (Tag "Italian") , FilteredTag.init (Tag "Japanese") , FilteredTag.init (Tag "Norwegian") , FilteredTag.init (Tag "Polish") , FilteredTag.init (Tag "Portuguese") , FilteredTag.init (Tag "Russian") , FilteredTag.init (Tag "Spanish") , FilteredTag.init (Tag "Turkish") ] } , { sectionName = "Audience" , tags = [ FilteredTag.init (Tag "Designers") , FilteredTag.init (Tag "Developers") ] } , { sectionName = "Programming Languages/Technologies" , tags = [ FilteredTag.init (Tag "Android") , FilteredTag.init (Tag "AngularJS") , FilteredTag.init (Tag "Arduino") , FilteredTag.init (Tag "AWS") , FilteredTag.init (Tag "C++") , FilteredTag.init (Tag "CSS") , FilteredTag.init (Tag "Chef") , FilteredTag.init (Tag "Clojure") , FilteredTag.init (Tag "Cocoa") , FilteredTag.init (Tag "CycleJS") , FilteredTag.init (Tag "Docker") , FilteredTag.init (Tag "Drupal") , FilteredTag.init (Tag ".Net") , FilteredTag.init (Tag "Elasticsearch") , FilteredTag.init (Tag "Elixir") , FilteredTag.init (Tag "Ember") , FilteredTag.init (Tag "Erlang") , FilteredTag.init (Tag "F#") , FilteredTag.init (Tag "Git") , FilteredTag.init (Tag "Go") , FilteredTag.init (Tag "Gradle") , FilteredTag.init (Tag "Grails") , FilteredTag.init (Tag "Groovy") , FilteredTag.init (Tag "Hadoop") , FilteredTag.init (Tag "Haskell") , FilteredTag.init (Tag "IOS") , FilteredTag.init (Tag "Java") , FilteredTag.init (Tag "JavaScript") , FilteredTag.init (Tag "Logstash") , FilteredTag.init (Tag "Lisp") , FilteredTag.init (Tag "MongoDB") , FilteredTag.init (Tag "NodeJS") , FilteredTag.init (Tag "OCaml") , FilteredTag.init (Tag "PhoneGap") , FilteredTag.init (Tag "PHP") , FilteredTag.init (Tag "PostgreSQL") , FilteredTag.init (Tag "PureScript") , FilteredTag.init (Tag "Python") , FilteredTag.init (Tag "Rails") , FilteredTag.init (Tag "RaspberryPi") , FilteredTag.init (Tag "React") , FilteredTag.init (Tag "Ruby") , FilteredTag.init (Tag "SML") , FilteredTag.init (Tag "Scala") , FilteredTag.init (Tag "SVG") , FilteredTag.init (Tag "Swift") , FilteredTag.init (Tag "WordPress") ] } , { sectionName = "Topics" , tags = [ FilteredTag.init (Tag "Agile") , FilteredTag.init (Tag "Big Data") , FilteredTag.init (Tag "Cloud") , FilteredTag.init (Tag "Communications") , FilteredTag.init (Tag "DataVisualization") , FilteredTag.init (Tag "DevOps") , FilteredTag.init (Tag "Diversity") , FilteredTag.init (Tag "Functional Programming") , FilteredTag.init (Tag "General") , FilteredTag.init (Tag "Internet Of Things") , FilteredTag.init (Tag "Microservices") , FilteredTag.init (Tag "Mobile") , FilteredTag.init (Tag "NoSQL") , FilteredTag.init (Tag "Open Source") , FilteredTag.init (Tag "Progressive Enhancement") , FilteredTag.init (Tag "Robotics") , FilteredTag.init (Tag "Scalability") , FilteredTag.init (Tag "Security") , FilteredTag.init (Tag "Soft Skills") , FilteredTag.init (Tag "Software Craftsmanship") , FilteredTag.init (Tag "Testing") , FilteredTag.init (Tag "UX") , FilteredTag.init (Tag "Web") ] } , { sectionName = "Locations" , tags = [ FilteredTag.init (Tag "Argentina") , FilteredTag.init (Tag "Australia") , FilteredTag.init (Tag "Belarus") , FilteredTag.init (Tag "Belgium") , FilteredTag.init (Tag "Brazil") , FilteredTag.init (Tag "Bulgaria") , FilteredTag.init (Tag "Canada") , FilteredTag.init (Tag "Chile") , FilteredTag.init (Tag "China") , FilteredTag.init (Tag "Colombia") , FilteredTag.init (Tag "Croatia") , FilteredTag.init (Tag "Czech Republic") , FilteredTag.init (Tag "Denmark") , FilteredTag.init (Tag "England") , FilteredTag.init (Tag "Finland") , FilteredTag.init (Tag "France") , FilteredTag.init (Tag "Germany") , FilteredTag.init (Tag "Hungary") , FilteredTag.init (Tag "Iceland") , FilteredTag.init (Tag "India") , FilteredTag.init (Tag "Ireland") , FilteredTag.init (Tag "Israel") , FilteredTag.init (Tag "Italy") , FilteredTag.init (Tag "Japan") , FilteredTag.init (Tag "Latvia") , FilteredTag.init (Tag "Lebanon") , FilteredTag.init (Tag "Lithuania") , FilteredTag.init (Tag "Malaysia") , FilteredTag.init (Tag "Mexico") , FilteredTag.init (Tag "Netherlands") , FilteredTag.init (Tag "New Zealand") , FilteredTag.init (Tag "Norway") , FilteredTag.init (Tag "Peru") , FilteredTag.init (Tag "Philippines") , FilteredTag.init (Tag "Poland") , FilteredTag.init (Tag "Portugal") , FilteredTag.init (Tag "Remote") , FilteredTag.init (Tag "Romania") , FilteredTag.init (Tag "Russia") , FilteredTag.init (Tag "Scotland") , FilteredTag.init (Tag "Singapore") , FilteredTag.init (Tag "South Africa") , FilteredTag.init (Tag "South Korea") , FilteredTag.init (Tag "Spain") , FilteredTag.init (Tag "Sweden") , FilteredTag.init (Tag "Switzerland") , FilteredTag.init (Tag "Taiwan") , FilteredTag.init (Tag "Tunisia") , FilteredTag.init (Tag "Turkey") , FilteredTag.init (Tag "UAE") , FilteredTag.init (Tag "USA") , FilteredTag.init (Tag "Ukraine") , FilteredTag.init (Tag "Uruguay") , FilteredTag.init (Tag "Wales") ] } ] , includePastEvents = False }
elm
[ { "context": "10.FormTypes.TextUsername ->\n \"username\"\n\n R10.FormTypes.TextEmail ->\n ", "end": 15752, "score": 0.9996644258, "start": 15744, "tag": "USERNAME", "value": "username" }, { "context": "Types.TextPasswordCurrent ->\n \"password\"\n\n R10.FormTypes.TextPasswordNew -", "end": 15998, "score": 0.9986754656, "start": 15990, "tag": "PASSWORD", "value": "password" }, { "context": "FormTypes.TextPasswordNew ->\n \"password\"\n\n R10.FormTypes.TextPlain ->\n ", "end": 16079, "score": 0.9987194538, "start": 16071, "tag": "PASSWORD", "value": "password" } ]
src/R10/FormComponents/Internal/Text.elm
csaltos/r10
61
module R10.FormComponents.Internal.Text exposing ( Args , extraCss , view , viewInput ) import Element.WithContext exposing (..) import Element.WithContext.Background as Background import Element.WithContext.Border as Border import Element.WithContext.Events as Events import Element.WithContext.Font as Font import Element.WithContext.Input as Input import Html.Attributes import Html.Events import Json.Decode import R10.Color.AttrsBackground import R10.Color.AttrsBorder import R10.Color.AttrsFont import R10.Context exposing (..) import R10.Device import R10.FontSize import R10.FormComponents.Internal.EmailAutoSuggest import R10.FormComponents.Internal.IconButton import R10.FormComponents.Internal.Style import R10.FormComponents.Internal.TextColors import R10.FormComponents.Internal.UI import R10.FormComponents.Internal.UI.Color import R10.FormComponents.Internal.UI.Const import R10.FormTypes import R10.Svg.Icons import R10.Transition import Regex textWithPatternLargeAttrs : List (AttributeC msg) textWithPatternLargeAttrs = [ withContextAttribute <| \c -> Font.size c.inputFieldWithLargePattern_fontSize , Font.family [ Font.monospace ] , withContextAttribute <| \c -> htmlAttribute <| Html.Attributes.style "letter-spacing" (String.fromInt c.inputFieldWithLargePattern_letterSpacing ++ "px") ] textWithPatternLargeAttrsExtra : List (AttributeC msg) textWithPatternLargeAttrsExtra = [ centerX , withContextAttribute <| \c -> width <| px c.inputFieldWithLargePattern_width ] textWithPatternAttrs : List (AttributeC msg) textWithPatternAttrs = -- -- Regular input field with patter, like brithday -- -- [ Font.size 18 -- , Font.family [ Font.monospace ] -- , htmlAttribute <| Html.Attributes.style "letter-spacing" "1px" -- ] [ htmlAttribute <| Html.Attributes.style "letter-spacing" "2px" ] viewShowHidePasswordButton : { a | msgOnTogglePasswordShow : Maybe msg, showPassword : Bool, palette : R10.FormTypes.Palette } -> ElementC msg viewShowHidePasswordButton { msgOnTogglePasswordShow, showPassword, palette } = let icon : ElementC msg icon = if showPassword then R10.Svg.Icons.eye_ban_l [] (R10.FormComponents.Internal.UI.Color.label palette) 24 else R10.Svg.Icons.eye_l [] (R10.FormComponents.Internal.UI.Color.label palette) 24 in case msgOnTogglePasswordShow of Just msgOnTogglePasswordShow_ -> R10.FormComponents.Internal.IconButton.view [] { palette = palette, icon = icon, msgOnClick = Just msgOnTogglePasswordShow_, size = 24 } Nothing -> none needShowHideIcon : R10.FormTypes.TypeText -> Bool needShowHideIcon fieldType = fieldType == R10.FormTypes.TextPasswordCurrent || fieldType == R10.FormTypes.TextPasswordNew type alias Args msg = { -- Stuff that change during -- the life of the component -- value : String , focused : Bool , maybeValid : Maybe Bool , disabled : Bool , showPassword : Bool , leadingIcon : List (ElementC msg) , trailingIcon : List (ElementC msg) -- Messages , msgOnChange : String -> msg , msgOnFocus : msg , msgOnLoseFocus : Maybe msg , msgOnTogglePasswordShow : Maybe msg , msgOnEnter : Maybe msg -- Stuff that doesn't change during -- the life of the component -- , label : String , helperText : Maybe String , requiredLabel : Maybe String , idDom : Maybe String , style : R10.FormComponents.Internal.Style.Style , palette : R10.FormTypes.Palette , autocomplete : Maybe String , floatingLabelAlwaysUp : Bool , placeholder : Maybe String -- Specific , textType : R10.FormTypes.TypeText } getBorder : { a | focused : Bool , style : R10.FormComponents.Internal.Style.Style , palette : R10.FormTypes.Palette , maybeValid : Maybe Bool , displayValidation : Bool , isMouseOver : Bool , disabled : Bool } -> AttrC decorative msg getBorder args = let { offset, size } = R10.FormComponents.Internal.UI.getTextfieldBorderSizeOffset args in Border.innerShadow { offset = offset , size = size , blur = 0 , color = R10.FormComponents.Internal.TextColors.getBorderColor args } viewBehindPattern2 : { a | floatingLabelAlwaysUp : Bool , focused : Bool , msgOnChange : String -> msg , textType : R10.FormTypes.TypeText , value : String } -> String -> List (AttributeC msg) viewBehindPattern2 args pattern = let valueWithTrailingPattern : String valueWithTrailingPattern = if args.focused || args.floatingLabelAlwaysUp then let lengthDifference : Int lengthDifference = String.length pattern - String.length args.value in args.value ++ String.right lengthDifference pattern else "" in [ behindContent <| -- -- This show the pattern underneath the real input field. -- We could use just an Element.el, but the pattern is not -- perfectly aligned in that case. -- Input.text ([ alpha 0.4 , Border.color <| rgba 0 0 0 0 , Background.color <| rgba 0 0 0 0 , moveDown 7 , moveRight 3 , htmlAttribute <| Html.Attributes.attribute "disabled" "true" ] ++ (case args.textType of R10.FormTypes.TextWithPatternLarge _ -> textWithPatternLargeAttrs ++ textWithPatternLargeAttrsExtra R10.FormTypes.TextWithPattern _ -> textWithPatternAttrs _ -> [] ) ) { label = Input.labelHidden "" , onChange = args.msgOnChange , placeholder = Nothing , text = valueWithTrailingPattern } ] viewBehindPattern : Args msg -> List (AttributeC msg) viewBehindPattern args = case args.textType of R10.FormTypes.TextWithPattern pattern -> viewBehindPattern2 args pattern R10.FormTypes.TextWithPatternLarge pattern -> viewBehindPattern2 args pattern _ -> [] extraCss : String extraCss = "" -- TextWithPattern Internal handleWithPatternChange : { pattern : String, oldValue : String, newValue : String } -> String handleWithPatternChange args = let isDeleteAction : Bool isDeleteAction = removeTrailingChar args.oldValue == args.newValue value : String value = args.newValue |> onlyDigit |> appendPattern args.pattern in if value == args.oldValue && isDeleteAction then -- if user would remove part of a pattern, it would be restored. -- To prevent this, -- if user removes one char of trailing pattern, remove trailing pattern + one char value |> removeTrailingPattern |> removeTrailingChar else value regexNotDigit : Regex.Regex regexNotDigit = Maybe.withDefault Regex.never (Regex.fromString "[^0-9]") regexNotDigitAtTheEnd : Regex.Regex regexNotDigitAtTheEnd = Maybe.withDefault Regex.never (Regex.fromString "[^0-9]*$") removeTrailingChar : String -> String removeTrailingChar str = String.left (String.length str - 1) str removeTrailingPattern : String -> String removeTrailingPattern str = Regex.replace regexNotDigitAtTheEnd (\_ -> "") str onlyDigit : String -> String onlyDigit str = Regex.replace regexNotDigit (\_ -> "") str type Token = InputValue | Other Char format : List Token -> String -> String format tokens input = if String.isEmpty input then input else append tokens (String.toList input) "" appendPattern : String -> String -> String appendPattern template string = format (parse '0' template) string parse : Char -> String -> List Token parse inputChar pattern = String.toList pattern |> List.map (tokenize inputChar) tokenize : Char -> Char -> Token tokenize inputChar pattern = if List.member pattern (String.toList "_MYD年月日AG0123456789") then InputValue else Other pattern append : List Token -> List Char -> String -> String append tokens input formatted = let appendInput : String appendInput = List.head input |> Maybe.map (\char -> formatted ++ String.fromChar char) |> Maybe.map (append (Maybe.withDefault [] (List.tail tokens)) (Maybe.withDefault [] (List.tail input))) |> Maybe.withDefault formatted maybeToken : Maybe Token maybeToken = List.head tokens in case maybeToken of Nothing -> formatted Just token -> case token of InputValue -> appendInput Other char -> append (Maybe.withDefault [] <| List.tail tokens) input (formatted ++ String.fromChar char) view : List (AttributeC msg) -> List (AttributeC msg) -> Args msg -> ElementC msg view attrs extraInputAttrs args = let displayValidation : Bool displayValidation = args.maybeValid /= Nothing newArgs : Args msg newArgs = -- Adding extra icons to the arguments: -- -- * Password eye -- * Validation result -- { args | trailingIcon = args.trailingIcon |> (\icons -> -- Adding the password eye if needed if needShowHideIcon args.textType then (el [ paddingEach { top = 0 , right = 8 , bottom = 0 , left = 0 } ] <| viewShowHidePasswordButton args ) :: icons else icons ) |> (\icons -> -- Adding the validation icon. Should not this be conditional? icons ++ [ R10.FormComponents.Internal.UI.showValidationIcon_ { maybeValid = args.maybeValid , displayValidation = displayValidation , palette = args.palette , style = args.style } ] ) } styleArgs : { disabled : Bool , displayValidation : Bool , focused : Bool , isMouseOver : Bool , label : String , leadingIcon : List (ElementC msg) , palette : R10.FormTypes.Palette , requiredLabel : Maybe String , style : R10.FormComponents.Internal.Style.Style , trailingIcon : List (ElementC msg) , maybeValid : Maybe Bool , value : String , floatingLabelAlwaysUp : Bool } styleArgs = { label = newArgs.label , value = newArgs.value , focused = newArgs.focused , disabled = newArgs.disabled , requiredLabel = newArgs.requiredLabel , style = newArgs.style , palette = newArgs.palette , leadingIcon = newArgs.leadingIcon , trailingIcon = newArgs.trailingIcon , maybeValid = args.maybeValid , displayValidation = displayValidation , isMouseOver = False , floatingLabelAlwaysUp = args.floatingLabelAlwaysUp } in column ([ -- This spacing need to be zero because errors need always have to have -- a div in the DOM also if there are no errors (for the animation. -- If there is spacing and no error, it will appear as a double spacing. spacing 0 , width (fill |> minimum 150) , inFront <| R10.FormComponents.Internal.UI.floatingLabel styleArgs ] ++ (if newArgs.disabled then [ alpha 0.6 ] else [ alpha 1 ] ) ++ attrs ) [ viewInput ([ case newArgs.style of R10.FormComponents.Internal.Style.Filled -> Border.rounded 0 R10.FormComponents.Internal.Style.Outlined -> Border.rounded 5 , withContextAttribute <| \c -> height <| px <| case newArgs.textType of R10.FormTypes.TextMultiline -> 200 R10.FormTypes.TextWithPatternLarge _ -> c.inputFieldWithLargePattern_height _ -> R10.FormComponents.Internal.UI.Const.inputTextHeight ] ++ (case args.idDom of Just id -> [ htmlAttribute <| Html.Attributes.id id ] Nothing -> [] ) ++ extraInputAttrs ) newArgs , R10.FormComponents.Internal.UI.viewHelperText newArgs.palette [ spacing 2 , alpha 0.5 , Font.size 14 , paddingEach { top = R10.FormComponents.Internal.UI.genericSpacing, right = 0, bottom = 0, left = 0 } ] newArgs.helperText ] viewInput : List (AttributeC msg) -> Args msg -> ElementC msg viewInput extraAttr args = let inputDisabledAttrs : List (AttributeC msg) inputDisabledAttrs = [ htmlAttribute <| Html.Attributes.attribute "disabled" "true" ] iconCommonAttrs : List (AttrC () msg) iconCommonAttrs = [ -- in order to icon to be aligned with the input, move icon down moveDown <| case args.style of R10.FormComponents.Internal.Style.Filled -> 8 R10.FormComponents.Internal.Style.Outlined -> 0 ] -- paddingValues : { top : Int, right : Int, bottom : Int, left : Int } -- paddingValues = -- R10.FormComponents.Internal.UI.getTextfieldPaddingEach args paddingOffset = 12 name = case args.textType of R10.FormTypes.TextUsername -> "username" R10.FormTypes.TextEmail -> "email" R10.FormTypes.TextEmailWithSuggestions _ -> "email" R10.FormTypes.TextPasswordCurrent -> "password" R10.FormTypes.TextPasswordNew -> "password" R10.FormTypes.TextPlain -> "" R10.FormTypes.TextMultiline -> "" R10.FormTypes.TextWithPattern _ -> "" R10.FormTypes.TextWithPatternLarge _ -> "" inputAttrs : List (AttributeC msg) inputAttrs = [ -- IOS fix that remove autocorrect, autocapitalize and spellcheck htmlAttribute <| Html.Attributes.attribute "spellcheck" "false" , htmlAttribute <| Html.Attributes.attribute "autocorrect" "off" , htmlAttribute <| Html.Attributes.attribute "autocapitalize" "off" , R10.Transition.transition "all 0.15s" , htmlAttribute <| Html.Attributes.name name , Font.size R10.FormComponents.Internal.UI.Const.inputTextFontSize , Font.color <| R10.FormComponents.Internal.UI.Color.font args.palette , Border.width 0 , Background.color <| R10.FormComponents.Internal.UI.Color.transparent , Events.onFocus args.msgOnFocus -- Adding some padding to have the input field to stay in a good position -- This value also influence the light blue area of the Browsers's -- autocomplete feature. , paddingEach { top = case args.style of R10.FormComponents.Internal.Style.Filled -> 23 R10.FormComponents.Internal.Style.Outlined -> 20 , right = 16 , bottom = case args.style of R10.FormComponents.Internal.Style.Filled -> 2 R10.FormComponents.Internal.Style.Outlined -> 5 , left = case args.style of R10.FormComponents.Internal.Style.Filled -> 0 R10.FormComponents.Internal.Style.Outlined -> 16 } ] ++ (case args.textType of R10.FormTypes.TextWithPatternLarge _ -> textWithPatternLargeAttrs R10.FormTypes.TextWithPattern _ -> textWithPatternAttrs _ -> [] ) ++ (case args.autocomplete of Nothing -> [] Just string -> [ htmlAttribute <| Html.Attributes.attribute "autocomplete" string ] ) ++ (case args.msgOnEnter of Just msgOnEnter_ -> [ htmlAttribute <| R10.FormComponents.Internal.UI.onEnter msgOnEnter_ ] Nothing -> [] ) ++ (case args.msgOnLoseFocus of Just msgOnLoseFocus_ -> [ Events.onLoseFocus msgOnLoseFocus_ ] Nothing -> [] ) ++ (if args.disabled then inputDisabledAttrs else [] ) ++ viewBehindPattern args ++ extraAttr behavioursText : { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , text : String } behavioursText = { onChange = args.msgOnChange , placeholder = case args.placeholder of Just string -> Just <| Input.placeholder [] (text string) Nothing -> Nothing , text = args.value , label = Input.labelHidden args.label } behavioursTextEmailWithSuggestions : { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , text : String } behavioursTextEmailWithSuggestions = -- ╔══════════════╤═════════════════════════════════════════════════╗ -- ║ FEATURE_NAME │ Email Input Field with Domain Suggestions ║ -- ╚══════════════╧═════════════════════════════════════════════════╝ -- The "behaviours" (arguments to Input.text) are the same as the -- regular input field -- behavioursText maybeEmailSuggestion : List String -> Maybe String maybeEmailSuggestion listSuggestions = if args.focused then R10.FormComponents.Internal.EmailAutoSuggest.emailDomainAutocomplete listSuggestions args.value else Nothing rightKeyDownDetection : List String -> List (AttributeC msg) rightKeyDownDetection listSuggestions = case maybeEmailSuggestion listSuggestions of Nothing -> [] Just emailSuggestion -> [ htmlAttribute <| R10.FormComponents.Internal.EmailAutoSuggest.addOnRightKeyDownEvent args.msgOnChange args.value (args.value ++ emailSuggestion) ] behavioursTextWithPattern : String -> { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , text : String } behavioursTextWithPattern pattern = { onChange = \string -> args.msgOnChange (handleWithPatternChange { pattern = pattern , oldValue = args.value , newValue = string } ) , placeholder = Nothing , text = args.value , label = Input.labelHidden args.label } behavioursPassword : Bool -> { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe a1 , show : Bool , text : String } behavioursPassword show = { onChange = args.msgOnChange , placeholder = Nothing , text = args.value , label = Input.labelHidden args.label , show = show } behavioursMultiline : { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , spellcheck : Bool , text : String } behavioursMultiline = { onChange = args.msgOnChange , placeholder = Nothing , text = args.value , label = Input.labelHidden args.label , spellcheck = False } styleArgs : { disabled : Bool , displayValidation : Bool , focused : Bool , isMouseOver : Bool , label : String , palette : R10.FormTypes.Palette , requiredLabel : Maybe String , style : R10.FormComponents.Internal.Style.Style , leadingIcon : List (ElementC msg) , trailingIcon : List (ElementC msg) , maybeValid : Maybe Bool , value : String } styleArgs = { label = args.label , value = args.value , focused = args.focused , disabled = args.disabled , requiredLabel = args.requiredLabel , style = args.style , palette = args.palette , leadingIcon = args.leadingIcon , trailingIcon = args.trailingIcon , maybeValid = args.maybeValid , displayValidation = displayValidation , isMouseOver = False } displayValidation : Bool displayValidation = args.maybeValid /= Nothing in row [ case args.style of R10.FormComponents.Internal.Style.Filled -> Border.rounded 0 R10.FormComponents.Internal.Style.Outlined -> Border.rounded 5 , getBorder styleArgs , mouseOver [ getBorder { styleArgs | isMouseOver = True } ] , width fill , padding 0 -- Spacing must be 0 here , spacing 0 ] <| [] ++ List.map (\icon -> el iconCommonAttrs icon) args.leadingIcon ++ [ case args.textType of R10.FormTypes.TextUsername -> Input.username inputAttrs behavioursText R10.FormTypes.TextEmail -> Input.email inputAttrs behavioursText R10.FormTypes.TextEmailWithSuggestions listSuggestions -> el -- ╔══════════════╤═════════════════════════════════════════════════╗ -- ║ FEATURE_NAME │ Email Input Field with Domain Suggestions ║ -- ╚══════════════╧═════════════════════════════════════════════════╝ -- Detection of the key "right arrow" need to be -- done on a parent element, otherwise it doesn't -- work. Not sure why. This is why we are -- creating this extra "el" instead attaching it -- to the input field directly -- ([ width fill ] ++ rightKeyDownDetection listSuggestions) (withContext <| \c -> let autoSuggestionsAttrs : List (AttributeC msg) autoSuggestionsAttrs = R10.FormComponents.Internal.EmailAutoSuggest.autoSuggestionsAttrs { userAgent = c.userAgent , maybeEmailSuggestion = maybeEmailSuggestion c.emailDomainList , msgOnChange = args.msgOnChange , value = args.value } in Input.email (autoSuggestionsAttrs ++ inputAttrs) behavioursTextEmailWithSuggestions ) R10.FormTypes.TextPasswordCurrent -> Input.currentPassword inputAttrs (behavioursPassword args.showPassword) R10.FormTypes.TextPasswordNew -> Input.newPassword inputAttrs (behavioursPassword args.showPassword) R10.FormTypes.TextPlain -> Input.text inputAttrs behavioursText R10.FormTypes.TextMultiline -> Input.multiline inputAttrs behavioursMultiline R10.FormTypes.TextWithPattern pattern -> Input.text inputAttrs <| behavioursTextWithPattern pattern R10.FormTypes.TextWithPatternLarge pattern -> Input.text (textWithPatternLargeAttrsExtra ++ inputAttrs) <| behavioursTextWithPattern pattern ] ++ List.map (\icon -> el iconCommonAttrs icon) args.trailingIcon
60040
module R10.FormComponents.Internal.Text exposing ( Args , extraCss , view , viewInput ) import Element.WithContext exposing (..) import Element.WithContext.Background as Background import Element.WithContext.Border as Border import Element.WithContext.Events as Events import Element.WithContext.Font as Font import Element.WithContext.Input as Input import Html.Attributes import Html.Events import Json.Decode import R10.Color.AttrsBackground import R10.Color.AttrsBorder import R10.Color.AttrsFont import R10.Context exposing (..) import R10.Device import R10.FontSize import R10.FormComponents.Internal.EmailAutoSuggest import R10.FormComponents.Internal.IconButton import R10.FormComponents.Internal.Style import R10.FormComponents.Internal.TextColors import R10.FormComponents.Internal.UI import R10.FormComponents.Internal.UI.Color import R10.FormComponents.Internal.UI.Const import R10.FormTypes import R10.Svg.Icons import R10.Transition import Regex textWithPatternLargeAttrs : List (AttributeC msg) textWithPatternLargeAttrs = [ withContextAttribute <| \c -> Font.size c.inputFieldWithLargePattern_fontSize , Font.family [ Font.monospace ] , withContextAttribute <| \c -> htmlAttribute <| Html.Attributes.style "letter-spacing" (String.fromInt c.inputFieldWithLargePattern_letterSpacing ++ "px") ] textWithPatternLargeAttrsExtra : List (AttributeC msg) textWithPatternLargeAttrsExtra = [ centerX , withContextAttribute <| \c -> width <| px c.inputFieldWithLargePattern_width ] textWithPatternAttrs : List (AttributeC msg) textWithPatternAttrs = -- -- Regular input field with patter, like brithday -- -- [ Font.size 18 -- , Font.family [ Font.monospace ] -- , htmlAttribute <| Html.Attributes.style "letter-spacing" "1px" -- ] [ htmlAttribute <| Html.Attributes.style "letter-spacing" "2px" ] viewShowHidePasswordButton : { a | msgOnTogglePasswordShow : Maybe msg, showPassword : Bool, palette : R10.FormTypes.Palette } -> ElementC msg viewShowHidePasswordButton { msgOnTogglePasswordShow, showPassword, palette } = let icon : ElementC msg icon = if showPassword then R10.Svg.Icons.eye_ban_l [] (R10.FormComponents.Internal.UI.Color.label palette) 24 else R10.Svg.Icons.eye_l [] (R10.FormComponents.Internal.UI.Color.label palette) 24 in case msgOnTogglePasswordShow of Just msgOnTogglePasswordShow_ -> R10.FormComponents.Internal.IconButton.view [] { palette = palette, icon = icon, msgOnClick = Just msgOnTogglePasswordShow_, size = 24 } Nothing -> none needShowHideIcon : R10.FormTypes.TypeText -> Bool needShowHideIcon fieldType = fieldType == R10.FormTypes.TextPasswordCurrent || fieldType == R10.FormTypes.TextPasswordNew type alias Args msg = { -- Stuff that change during -- the life of the component -- value : String , focused : Bool , maybeValid : Maybe Bool , disabled : Bool , showPassword : Bool , leadingIcon : List (ElementC msg) , trailingIcon : List (ElementC msg) -- Messages , msgOnChange : String -> msg , msgOnFocus : msg , msgOnLoseFocus : Maybe msg , msgOnTogglePasswordShow : Maybe msg , msgOnEnter : Maybe msg -- Stuff that doesn't change during -- the life of the component -- , label : String , helperText : Maybe String , requiredLabel : Maybe String , idDom : Maybe String , style : R10.FormComponents.Internal.Style.Style , palette : R10.FormTypes.Palette , autocomplete : Maybe String , floatingLabelAlwaysUp : Bool , placeholder : Maybe String -- Specific , textType : R10.FormTypes.TypeText } getBorder : { a | focused : Bool , style : R10.FormComponents.Internal.Style.Style , palette : R10.FormTypes.Palette , maybeValid : Maybe Bool , displayValidation : Bool , isMouseOver : Bool , disabled : Bool } -> AttrC decorative msg getBorder args = let { offset, size } = R10.FormComponents.Internal.UI.getTextfieldBorderSizeOffset args in Border.innerShadow { offset = offset , size = size , blur = 0 , color = R10.FormComponents.Internal.TextColors.getBorderColor args } viewBehindPattern2 : { a | floatingLabelAlwaysUp : Bool , focused : Bool , msgOnChange : String -> msg , textType : R10.FormTypes.TypeText , value : String } -> String -> List (AttributeC msg) viewBehindPattern2 args pattern = let valueWithTrailingPattern : String valueWithTrailingPattern = if args.focused || args.floatingLabelAlwaysUp then let lengthDifference : Int lengthDifference = String.length pattern - String.length args.value in args.value ++ String.right lengthDifference pattern else "" in [ behindContent <| -- -- This show the pattern underneath the real input field. -- We could use just an Element.el, but the pattern is not -- perfectly aligned in that case. -- Input.text ([ alpha 0.4 , Border.color <| rgba 0 0 0 0 , Background.color <| rgba 0 0 0 0 , moveDown 7 , moveRight 3 , htmlAttribute <| Html.Attributes.attribute "disabled" "true" ] ++ (case args.textType of R10.FormTypes.TextWithPatternLarge _ -> textWithPatternLargeAttrs ++ textWithPatternLargeAttrsExtra R10.FormTypes.TextWithPattern _ -> textWithPatternAttrs _ -> [] ) ) { label = Input.labelHidden "" , onChange = args.msgOnChange , placeholder = Nothing , text = valueWithTrailingPattern } ] viewBehindPattern : Args msg -> List (AttributeC msg) viewBehindPattern args = case args.textType of R10.FormTypes.TextWithPattern pattern -> viewBehindPattern2 args pattern R10.FormTypes.TextWithPatternLarge pattern -> viewBehindPattern2 args pattern _ -> [] extraCss : String extraCss = "" -- TextWithPattern Internal handleWithPatternChange : { pattern : String, oldValue : String, newValue : String } -> String handleWithPatternChange args = let isDeleteAction : Bool isDeleteAction = removeTrailingChar args.oldValue == args.newValue value : String value = args.newValue |> onlyDigit |> appendPattern args.pattern in if value == args.oldValue && isDeleteAction then -- if user would remove part of a pattern, it would be restored. -- To prevent this, -- if user removes one char of trailing pattern, remove trailing pattern + one char value |> removeTrailingPattern |> removeTrailingChar else value regexNotDigit : Regex.Regex regexNotDigit = Maybe.withDefault Regex.never (Regex.fromString "[^0-9]") regexNotDigitAtTheEnd : Regex.Regex regexNotDigitAtTheEnd = Maybe.withDefault Regex.never (Regex.fromString "[^0-9]*$") removeTrailingChar : String -> String removeTrailingChar str = String.left (String.length str - 1) str removeTrailingPattern : String -> String removeTrailingPattern str = Regex.replace regexNotDigitAtTheEnd (\_ -> "") str onlyDigit : String -> String onlyDigit str = Regex.replace regexNotDigit (\_ -> "") str type Token = InputValue | Other Char format : List Token -> String -> String format tokens input = if String.isEmpty input then input else append tokens (String.toList input) "" appendPattern : String -> String -> String appendPattern template string = format (parse '0' template) string parse : Char -> String -> List Token parse inputChar pattern = String.toList pattern |> List.map (tokenize inputChar) tokenize : Char -> Char -> Token tokenize inputChar pattern = if List.member pattern (String.toList "_MYD年月日AG0123456789") then InputValue else Other pattern append : List Token -> List Char -> String -> String append tokens input formatted = let appendInput : String appendInput = List.head input |> Maybe.map (\char -> formatted ++ String.fromChar char) |> Maybe.map (append (Maybe.withDefault [] (List.tail tokens)) (Maybe.withDefault [] (List.tail input))) |> Maybe.withDefault formatted maybeToken : Maybe Token maybeToken = List.head tokens in case maybeToken of Nothing -> formatted Just token -> case token of InputValue -> appendInput Other char -> append (Maybe.withDefault [] <| List.tail tokens) input (formatted ++ String.fromChar char) view : List (AttributeC msg) -> List (AttributeC msg) -> Args msg -> ElementC msg view attrs extraInputAttrs args = let displayValidation : Bool displayValidation = args.maybeValid /= Nothing newArgs : Args msg newArgs = -- Adding extra icons to the arguments: -- -- * Password eye -- * Validation result -- { args | trailingIcon = args.trailingIcon |> (\icons -> -- Adding the password eye if needed if needShowHideIcon args.textType then (el [ paddingEach { top = 0 , right = 8 , bottom = 0 , left = 0 } ] <| viewShowHidePasswordButton args ) :: icons else icons ) |> (\icons -> -- Adding the validation icon. Should not this be conditional? icons ++ [ R10.FormComponents.Internal.UI.showValidationIcon_ { maybeValid = args.maybeValid , displayValidation = displayValidation , palette = args.palette , style = args.style } ] ) } styleArgs : { disabled : Bool , displayValidation : Bool , focused : Bool , isMouseOver : Bool , label : String , leadingIcon : List (ElementC msg) , palette : R10.FormTypes.Palette , requiredLabel : Maybe String , style : R10.FormComponents.Internal.Style.Style , trailingIcon : List (ElementC msg) , maybeValid : Maybe Bool , value : String , floatingLabelAlwaysUp : Bool } styleArgs = { label = newArgs.label , value = newArgs.value , focused = newArgs.focused , disabled = newArgs.disabled , requiredLabel = newArgs.requiredLabel , style = newArgs.style , palette = newArgs.palette , leadingIcon = newArgs.leadingIcon , trailingIcon = newArgs.trailingIcon , maybeValid = args.maybeValid , displayValidation = displayValidation , isMouseOver = False , floatingLabelAlwaysUp = args.floatingLabelAlwaysUp } in column ([ -- This spacing need to be zero because errors need always have to have -- a div in the DOM also if there are no errors (for the animation. -- If there is spacing and no error, it will appear as a double spacing. spacing 0 , width (fill |> minimum 150) , inFront <| R10.FormComponents.Internal.UI.floatingLabel styleArgs ] ++ (if newArgs.disabled then [ alpha 0.6 ] else [ alpha 1 ] ) ++ attrs ) [ viewInput ([ case newArgs.style of R10.FormComponents.Internal.Style.Filled -> Border.rounded 0 R10.FormComponents.Internal.Style.Outlined -> Border.rounded 5 , withContextAttribute <| \c -> height <| px <| case newArgs.textType of R10.FormTypes.TextMultiline -> 200 R10.FormTypes.TextWithPatternLarge _ -> c.inputFieldWithLargePattern_height _ -> R10.FormComponents.Internal.UI.Const.inputTextHeight ] ++ (case args.idDom of Just id -> [ htmlAttribute <| Html.Attributes.id id ] Nothing -> [] ) ++ extraInputAttrs ) newArgs , R10.FormComponents.Internal.UI.viewHelperText newArgs.palette [ spacing 2 , alpha 0.5 , Font.size 14 , paddingEach { top = R10.FormComponents.Internal.UI.genericSpacing, right = 0, bottom = 0, left = 0 } ] newArgs.helperText ] viewInput : List (AttributeC msg) -> Args msg -> ElementC msg viewInput extraAttr args = let inputDisabledAttrs : List (AttributeC msg) inputDisabledAttrs = [ htmlAttribute <| Html.Attributes.attribute "disabled" "true" ] iconCommonAttrs : List (AttrC () msg) iconCommonAttrs = [ -- in order to icon to be aligned with the input, move icon down moveDown <| case args.style of R10.FormComponents.Internal.Style.Filled -> 8 R10.FormComponents.Internal.Style.Outlined -> 0 ] -- paddingValues : { top : Int, right : Int, bottom : Int, left : Int } -- paddingValues = -- R10.FormComponents.Internal.UI.getTextfieldPaddingEach args paddingOffset = 12 name = case args.textType of R10.FormTypes.TextUsername -> "username" R10.FormTypes.TextEmail -> "email" R10.FormTypes.TextEmailWithSuggestions _ -> "email" R10.FormTypes.TextPasswordCurrent -> "<PASSWORD>" R10.FormTypes.TextPasswordNew -> "<PASSWORD>" R10.FormTypes.TextPlain -> "" R10.FormTypes.TextMultiline -> "" R10.FormTypes.TextWithPattern _ -> "" R10.FormTypes.TextWithPatternLarge _ -> "" inputAttrs : List (AttributeC msg) inputAttrs = [ -- IOS fix that remove autocorrect, autocapitalize and spellcheck htmlAttribute <| Html.Attributes.attribute "spellcheck" "false" , htmlAttribute <| Html.Attributes.attribute "autocorrect" "off" , htmlAttribute <| Html.Attributes.attribute "autocapitalize" "off" , R10.Transition.transition "all 0.15s" , htmlAttribute <| Html.Attributes.name name , Font.size R10.FormComponents.Internal.UI.Const.inputTextFontSize , Font.color <| R10.FormComponents.Internal.UI.Color.font args.palette , Border.width 0 , Background.color <| R10.FormComponents.Internal.UI.Color.transparent , Events.onFocus args.msgOnFocus -- Adding some padding to have the input field to stay in a good position -- This value also influence the light blue area of the Browsers's -- autocomplete feature. , paddingEach { top = case args.style of R10.FormComponents.Internal.Style.Filled -> 23 R10.FormComponents.Internal.Style.Outlined -> 20 , right = 16 , bottom = case args.style of R10.FormComponents.Internal.Style.Filled -> 2 R10.FormComponents.Internal.Style.Outlined -> 5 , left = case args.style of R10.FormComponents.Internal.Style.Filled -> 0 R10.FormComponents.Internal.Style.Outlined -> 16 } ] ++ (case args.textType of R10.FormTypes.TextWithPatternLarge _ -> textWithPatternLargeAttrs R10.FormTypes.TextWithPattern _ -> textWithPatternAttrs _ -> [] ) ++ (case args.autocomplete of Nothing -> [] Just string -> [ htmlAttribute <| Html.Attributes.attribute "autocomplete" string ] ) ++ (case args.msgOnEnter of Just msgOnEnter_ -> [ htmlAttribute <| R10.FormComponents.Internal.UI.onEnter msgOnEnter_ ] Nothing -> [] ) ++ (case args.msgOnLoseFocus of Just msgOnLoseFocus_ -> [ Events.onLoseFocus msgOnLoseFocus_ ] Nothing -> [] ) ++ (if args.disabled then inputDisabledAttrs else [] ) ++ viewBehindPattern args ++ extraAttr behavioursText : { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , text : String } behavioursText = { onChange = args.msgOnChange , placeholder = case args.placeholder of Just string -> Just <| Input.placeholder [] (text string) Nothing -> Nothing , text = args.value , label = Input.labelHidden args.label } behavioursTextEmailWithSuggestions : { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , text : String } behavioursTextEmailWithSuggestions = -- ╔══════════════╤═════════════════════════════════════════════════╗ -- ║ FEATURE_NAME │ Email Input Field with Domain Suggestions ║ -- ╚══════════════╧═════════════════════════════════════════════════╝ -- The "behaviours" (arguments to Input.text) are the same as the -- regular input field -- behavioursText maybeEmailSuggestion : List String -> Maybe String maybeEmailSuggestion listSuggestions = if args.focused then R10.FormComponents.Internal.EmailAutoSuggest.emailDomainAutocomplete listSuggestions args.value else Nothing rightKeyDownDetection : List String -> List (AttributeC msg) rightKeyDownDetection listSuggestions = case maybeEmailSuggestion listSuggestions of Nothing -> [] Just emailSuggestion -> [ htmlAttribute <| R10.FormComponents.Internal.EmailAutoSuggest.addOnRightKeyDownEvent args.msgOnChange args.value (args.value ++ emailSuggestion) ] behavioursTextWithPattern : String -> { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , text : String } behavioursTextWithPattern pattern = { onChange = \string -> args.msgOnChange (handleWithPatternChange { pattern = pattern , oldValue = args.value , newValue = string } ) , placeholder = Nothing , text = args.value , label = Input.labelHidden args.label } behavioursPassword : Bool -> { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe a1 , show : Bool , text : String } behavioursPassword show = { onChange = args.msgOnChange , placeholder = Nothing , text = args.value , label = Input.labelHidden args.label , show = show } behavioursMultiline : { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , spellcheck : Bool , text : String } behavioursMultiline = { onChange = args.msgOnChange , placeholder = Nothing , text = args.value , label = Input.labelHidden args.label , spellcheck = False } styleArgs : { disabled : Bool , displayValidation : Bool , focused : Bool , isMouseOver : Bool , label : String , palette : R10.FormTypes.Palette , requiredLabel : Maybe String , style : R10.FormComponents.Internal.Style.Style , leadingIcon : List (ElementC msg) , trailingIcon : List (ElementC msg) , maybeValid : Maybe Bool , value : String } styleArgs = { label = args.label , value = args.value , focused = args.focused , disabled = args.disabled , requiredLabel = args.requiredLabel , style = args.style , palette = args.palette , leadingIcon = args.leadingIcon , trailingIcon = args.trailingIcon , maybeValid = args.maybeValid , displayValidation = displayValidation , isMouseOver = False } displayValidation : Bool displayValidation = args.maybeValid /= Nothing in row [ case args.style of R10.FormComponents.Internal.Style.Filled -> Border.rounded 0 R10.FormComponents.Internal.Style.Outlined -> Border.rounded 5 , getBorder styleArgs , mouseOver [ getBorder { styleArgs | isMouseOver = True } ] , width fill , padding 0 -- Spacing must be 0 here , spacing 0 ] <| [] ++ List.map (\icon -> el iconCommonAttrs icon) args.leadingIcon ++ [ case args.textType of R10.FormTypes.TextUsername -> Input.username inputAttrs behavioursText R10.FormTypes.TextEmail -> Input.email inputAttrs behavioursText R10.FormTypes.TextEmailWithSuggestions listSuggestions -> el -- ╔══════════════╤═════════════════════════════════════════════════╗ -- ║ FEATURE_NAME │ Email Input Field with Domain Suggestions ║ -- ╚══════════════╧═════════════════════════════════════════════════╝ -- Detection of the key "right arrow" need to be -- done on a parent element, otherwise it doesn't -- work. Not sure why. This is why we are -- creating this extra "el" instead attaching it -- to the input field directly -- ([ width fill ] ++ rightKeyDownDetection listSuggestions) (withContext <| \c -> let autoSuggestionsAttrs : List (AttributeC msg) autoSuggestionsAttrs = R10.FormComponents.Internal.EmailAutoSuggest.autoSuggestionsAttrs { userAgent = c.userAgent , maybeEmailSuggestion = maybeEmailSuggestion c.emailDomainList , msgOnChange = args.msgOnChange , value = args.value } in Input.email (autoSuggestionsAttrs ++ inputAttrs) behavioursTextEmailWithSuggestions ) R10.FormTypes.TextPasswordCurrent -> Input.currentPassword inputAttrs (behavioursPassword args.showPassword) R10.FormTypes.TextPasswordNew -> Input.newPassword inputAttrs (behavioursPassword args.showPassword) R10.FormTypes.TextPlain -> Input.text inputAttrs behavioursText R10.FormTypes.TextMultiline -> Input.multiline inputAttrs behavioursMultiline R10.FormTypes.TextWithPattern pattern -> Input.text inputAttrs <| behavioursTextWithPattern pattern R10.FormTypes.TextWithPatternLarge pattern -> Input.text (textWithPatternLargeAttrsExtra ++ inputAttrs) <| behavioursTextWithPattern pattern ] ++ List.map (\icon -> el iconCommonAttrs icon) args.trailingIcon
true
module R10.FormComponents.Internal.Text exposing ( Args , extraCss , view , viewInput ) import Element.WithContext exposing (..) import Element.WithContext.Background as Background import Element.WithContext.Border as Border import Element.WithContext.Events as Events import Element.WithContext.Font as Font import Element.WithContext.Input as Input import Html.Attributes import Html.Events import Json.Decode import R10.Color.AttrsBackground import R10.Color.AttrsBorder import R10.Color.AttrsFont import R10.Context exposing (..) import R10.Device import R10.FontSize import R10.FormComponents.Internal.EmailAutoSuggest import R10.FormComponents.Internal.IconButton import R10.FormComponents.Internal.Style import R10.FormComponents.Internal.TextColors import R10.FormComponents.Internal.UI import R10.FormComponents.Internal.UI.Color import R10.FormComponents.Internal.UI.Const import R10.FormTypes import R10.Svg.Icons import R10.Transition import Regex textWithPatternLargeAttrs : List (AttributeC msg) textWithPatternLargeAttrs = [ withContextAttribute <| \c -> Font.size c.inputFieldWithLargePattern_fontSize , Font.family [ Font.monospace ] , withContextAttribute <| \c -> htmlAttribute <| Html.Attributes.style "letter-spacing" (String.fromInt c.inputFieldWithLargePattern_letterSpacing ++ "px") ] textWithPatternLargeAttrsExtra : List (AttributeC msg) textWithPatternLargeAttrsExtra = [ centerX , withContextAttribute <| \c -> width <| px c.inputFieldWithLargePattern_width ] textWithPatternAttrs : List (AttributeC msg) textWithPatternAttrs = -- -- Regular input field with patter, like brithday -- -- [ Font.size 18 -- , Font.family [ Font.monospace ] -- , htmlAttribute <| Html.Attributes.style "letter-spacing" "1px" -- ] [ htmlAttribute <| Html.Attributes.style "letter-spacing" "2px" ] viewShowHidePasswordButton : { a | msgOnTogglePasswordShow : Maybe msg, showPassword : Bool, palette : R10.FormTypes.Palette } -> ElementC msg viewShowHidePasswordButton { msgOnTogglePasswordShow, showPassword, palette } = let icon : ElementC msg icon = if showPassword then R10.Svg.Icons.eye_ban_l [] (R10.FormComponents.Internal.UI.Color.label palette) 24 else R10.Svg.Icons.eye_l [] (R10.FormComponents.Internal.UI.Color.label palette) 24 in case msgOnTogglePasswordShow of Just msgOnTogglePasswordShow_ -> R10.FormComponents.Internal.IconButton.view [] { palette = palette, icon = icon, msgOnClick = Just msgOnTogglePasswordShow_, size = 24 } Nothing -> none needShowHideIcon : R10.FormTypes.TypeText -> Bool needShowHideIcon fieldType = fieldType == R10.FormTypes.TextPasswordCurrent || fieldType == R10.FormTypes.TextPasswordNew type alias Args msg = { -- Stuff that change during -- the life of the component -- value : String , focused : Bool , maybeValid : Maybe Bool , disabled : Bool , showPassword : Bool , leadingIcon : List (ElementC msg) , trailingIcon : List (ElementC msg) -- Messages , msgOnChange : String -> msg , msgOnFocus : msg , msgOnLoseFocus : Maybe msg , msgOnTogglePasswordShow : Maybe msg , msgOnEnter : Maybe msg -- Stuff that doesn't change during -- the life of the component -- , label : String , helperText : Maybe String , requiredLabel : Maybe String , idDom : Maybe String , style : R10.FormComponents.Internal.Style.Style , palette : R10.FormTypes.Palette , autocomplete : Maybe String , floatingLabelAlwaysUp : Bool , placeholder : Maybe String -- Specific , textType : R10.FormTypes.TypeText } getBorder : { a | focused : Bool , style : R10.FormComponents.Internal.Style.Style , palette : R10.FormTypes.Palette , maybeValid : Maybe Bool , displayValidation : Bool , isMouseOver : Bool , disabled : Bool } -> AttrC decorative msg getBorder args = let { offset, size } = R10.FormComponents.Internal.UI.getTextfieldBorderSizeOffset args in Border.innerShadow { offset = offset , size = size , blur = 0 , color = R10.FormComponents.Internal.TextColors.getBorderColor args } viewBehindPattern2 : { a | floatingLabelAlwaysUp : Bool , focused : Bool , msgOnChange : String -> msg , textType : R10.FormTypes.TypeText , value : String } -> String -> List (AttributeC msg) viewBehindPattern2 args pattern = let valueWithTrailingPattern : String valueWithTrailingPattern = if args.focused || args.floatingLabelAlwaysUp then let lengthDifference : Int lengthDifference = String.length pattern - String.length args.value in args.value ++ String.right lengthDifference pattern else "" in [ behindContent <| -- -- This show the pattern underneath the real input field. -- We could use just an Element.el, but the pattern is not -- perfectly aligned in that case. -- Input.text ([ alpha 0.4 , Border.color <| rgba 0 0 0 0 , Background.color <| rgba 0 0 0 0 , moveDown 7 , moveRight 3 , htmlAttribute <| Html.Attributes.attribute "disabled" "true" ] ++ (case args.textType of R10.FormTypes.TextWithPatternLarge _ -> textWithPatternLargeAttrs ++ textWithPatternLargeAttrsExtra R10.FormTypes.TextWithPattern _ -> textWithPatternAttrs _ -> [] ) ) { label = Input.labelHidden "" , onChange = args.msgOnChange , placeholder = Nothing , text = valueWithTrailingPattern } ] viewBehindPattern : Args msg -> List (AttributeC msg) viewBehindPattern args = case args.textType of R10.FormTypes.TextWithPattern pattern -> viewBehindPattern2 args pattern R10.FormTypes.TextWithPatternLarge pattern -> viewBehindPattern2 args pattern _ -> [] extraCss : String extraCss = "" -- TextWithPattern Internal handleWithPatternChange : { pattern : String, oldValue : String, newValue : String } -> String handleWithPatternChange args = let isDeleteAction : Bool isDeleteAction = removeTrailingChar args.oldValue == args.newValue value : String value = args.newValue |> onlyDigit |> appendPattern args.pattern in if value == args.oldValue && isDeleteAction then -- if user would remove part of a pattern, it would be restored. -- To prevent this, -- if user removes one char of trailing pattern, remove trailing pattern + one char value |> removeTrailingPattern |> removeTrailingChar else value regexNotDigit : Regex.Regex regexNotDigit = Maybe.withDefault Regex.never (Regex.fromString "[^0-9]") regexNotDigitAtTheEnd : Regex.Regex regexNotDigitAtTheEnd = Maybe.withDefault Regex.never (Regex.fromString "[^0-9]*$") removeTrailingChar : String -> String removeTrailingChar str = String.left (String.length str - 1) str removeTrailingPattern : String -> String removeTrailingPattern str = Regex.replace regexNotDigitAtTheEnd (\_ -> "") str onlyDigit : String -> String onlyDigit str = Regex.replace regexNotDigit (\_ -> "") str type Token = InputValue | Other Char format : List Token -> String -> String format tokens input = if String.isEmpty input then input else append tokens (String.toList input) "" appendPattern : String -> String -> String appendPattern template string = format (parse '0' template) string parse : Char -> String -> List Token parse inputChar pattern = String.toList pattern |> List.map (tokenize inputChar) tokenize : Char -> Char -> Token tokenize inputChar pattern = if List.member pattern (String.toList "_MYD年月日AG0123456789") then InputValue else Other pattern append : List Token -> List Char -> String -> String append tokens input formatted = let appendInput : String appendInput = List.head input |> Maybe.map (\char -> formatted ++ String.fromChar char) |> Maybe.map (append (Maybe.withDefault [] (List.tail tokens)) (Maybe.withDefault [] (List.tail input))) |> Maybe.withDefault formatted maybeToken : Maybe Token maybeToken = List.head tokens in case maybeToken of Nothing -> formatted Just token -> case token of InputValue -> appendInput Other char -> append (Maybe.withDefault [] <| List.tail tokens) input (formatted ++ String.fromChar char) view : List (AttributeC msg) -> List (AttributeC msg) -> Args msg -> ElementC msg view attrs extraInputAttrs args = let displayValidation : Bool displayValidation = args.maybeValid /= Nothing newArgs : Args msg newArgs = -- Adding extra icons to the arguments: -- -- * Password eye -- * Validation result -- { args | trailingIcon = args.trailingIcon |> (\icons -> -- Adding the password eye if needed if needShowHideIcon args.textType then (el [ paddingEach { top = 0 , right = 8 , bottom = 0 , left = 0 } ] <| viewShowHidePasswordButton args ) :: icons else icons ) |> (\icons -> -- Adding the validation icon. Should not this be conditional? icons ++ [ R10.FormComponents.Internal.UI.showValidationIcon_ { maybeValid = args.maybeValid , displayValidation = displayValidation , palette = args.palette , style = args.style } ] ) } styleArgs : { disabled : Bool , displayValidation : Bool , focused : Bool , isMouseOver : Bool , label : String , leadingIcon : List (ElementC msg) , palette : R10.FormTypes.Palette , requiredLabel : Maybe String , style : R10.FormComponents.Internal.Style.Style , trailingIcon : List (ElementC msg) , maybeValid : Maybe Bool , value : String , floatingLabelAlwaysUp : Bool } styleArgs = { label = newArgs.label , value = newArgs.value , focused = newArgs.focused , disabled = newArgs.disabled , requiredLabel = newArgs.requiredLabel , style = newArgs.style , palette = newArgs.palette , leadingIcon = newArgs.leadingIcon , trailingIcon = newArgs.trailingIcon , maybeValid = args.maybeValid , displayValidation = displayValidation , isMouseOver = False , floatingLabelAlwaysUp = args.floatingLabelAlwaysUp } in column ([ -- This spacing need to be zero because errors need always have to have -- a div in the DOM also if there are no errors (for the animation. -- If there is spacing and no error, it will appear as a double spacing. spacing 0 , width (fill |> minimum 150) , inFront <| R10.FormComponents.Internal.UI.floatingLabel styleArgs ] ++ (if newArgs.disabled then [ alpha 0.6 ] else [ alpha 1 ] ) ++ attrs ) [ viewInput ([ case newArgs.style of R10.FormComponents.Internal.Style.Filled -> Border.rounded 0 R10.FormComponents.Internal.Style.Outlined -> Border.rounded 5 , withContextAttribute <| \c -> height <| px <| case newArgs.textType of R10.FormTypes.TextMultiline -> 200 R10.FormTypes.TextWithPatternLarge _ -> c.inputFieldWithLargePattern_height _ -> R10.FormComponents.Internal.UI.Const.inputTextHeight ] ++ (case args.idDom of Just id -> [ htmlAttribute <| Html.Attributes.id id ] Nothing -> [] ) ++ extraInputAttrs ) newArgs , R10.FormComponents.Internal.UI.viewHelperText newArgs.palette [ spacing 2 , alpha 0.5 , Font.size 14 , paddingEach { top = R10.FormComponents.Internal.UI.genericSpacing, right = 0, bottom = 0, left = 0 } ] newArgs.helperText ] viewInput : List (AttributeC msg) -> Args msg -> ElementC msg viewInput extraAttr args = let inputDisabledAttrs : List (AttributeC msg) inputDisabledAttrs = [ htmlAttribute <| Html.Attributes.attribute "disabled" "true" ] iconCommonAttrs : List (AttrC () msg) iconCommonAttrs = [ -- in order to icon to be aligned with the input, move icon down moveDown <| case args.style of R10.FormComponents.Internal.Style.Filled -> 8 R10.FormComponents.Internal.Style.Outlined -> 0 ] -- paddingValues : { top : Int, right : Int, bottom : Int, left : Int } -- paddingValues = -- R10.FormComponents.Internal.UI.getTextfieldPaddingEach args paddingOffset = 12 name = case args.textType of R10.FormTypes.TextUsername -> "username" R10.FormTypes.TextEmail -> "email" R10.FormTypes.TextEmailWithSuggestions _ -> "email" R10.FormTypes.TextPasswordCurrent -> "PI:PASSWORD:<PASSWORD>END_PI" R10.FormTypes.TextPasswordNew -> "PI:PASSWORD:<PASSWORD>END_PI" R10.FormTypes.TextPlain -> "" R10.FormTypes.TextMultiline -> "" R10.FormTypes.TextWithPattern _ -> "" R10.FormTypes.TextWithPatternLarge _ -> "" inputAttrs : List (AttributeC msg) inputAttrs = [ -- IOS fix that remove autocorrect, autocapitalize and spellcheck htmlAttribute <| Html.Attributes.attribute "spellcheck" "false" , htmlAttribute <| Html.Attributes.attribute "autocorrect" "off" , htmlAttribute <| Html.Attributes.attribute "autocapitalize" "off" , R10.Transition.transition "all 0.15s" , htmlAttribute <| Html.Attributes.name name , Font.size R10.FormComponents.Internal.UI.Const.inputTextFontSize , Font.color <| R10.FormComponents.Internal.UI.Color.font args.palette , Border.width 0 , Background.color <| R10.FormComponents.Internal.UI.Color.transparent , Events.onFocus args.msgOnFocus -- Adding some padding to have the input field to stay in a good position -- This value also influence the light blue area of the Browsers's -- autocomplete feature. , paddingEach { top = case args.style of R10.FormComponents.Internal.Style.Filled -> 23 R10.FormComponents.Internal.Style.Outlined -> 20 , right = 16 , bottom = case args.style of R10.FormComponents.Internal.Style.Filled -> 2 R10.FormComponents.Internal.Style.Outlined -> 5 , left = case args.style of R10.FormComponents.Internal.Style.Filled -> 0 R10.FormComponents.Internal.Style.Outlined -> 16 } ] ++ (case args.textType of R10.FormTypes.TextWithPatternLarge _ -> textWithPatternLargeAttrs R10.FormTypes.TextWithPattern _ -> textWithPatternAttrs _ -> [] ) ++ (case args.autocomplete of Nothing -> [] Just string -> [ htmlAttribute <| Html.Attributes.attribute "autocomplete" string ] ) ++ (case args.msgOnEnter of Just msgOnEnter_ -> [ htmlAttribute <| R10.FormComponents.Internal.UI.onEnter msgOnEnter_ ] Nothing -> [] ) ++ (case args.msgOnLoseFocus of Just msgOnLoseFocus_ -> [ Events.onLoseFocus msgOnLoseFocus_ ] Nothing -> [] ) ++ (if args.disabled then inputDisabledAttrs else [] ) ++ viewBehindPattern args ++ extraAttr behavioursText : { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , text : String } behavioursText = { onChange = args.msgOnChange , placeholder = case args.placeholder of Just string -> Just <| Input.placeholder [] (text string) Nothing -> Nothing , text = args.value , label = Input.labelHidden args.label } behavioursTextEmailWithSuggestions : { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , text : String } behavioursTextEmailWithSuggestions = -- ╔══════════════╤═════════════════════════════════════════════════╗ -- ║ FEATURE_NAME │ Email Input Field with Domain Suggestions ║ -- ╚══════════════╧═════════════════════════════════════════════════╝ -- The "behaviours" (arguments to Input.text) are the same as the -- regular input field -- behavioursText maybeEmailSuggestion : List String -> Maybe String maybeEmailSuggestion listSuggestions = if args.focused then R10.FormComponents.Internal.EmailAutoSuggest.emailDomainAutocomplete listSuggestions args.value else Nothing rightKeyDownDetection : List String -> List (AttributeC msg) rightKeyDownDetection listSuggestions = case maybeEmailSuggestion listSuggestions of Nothing -> [] Just emailSuggestion -> [ htmlAttribute <| R10.FormComponents.Internal.EmailAutoSuggest.addOnRightKeyDownEvent args.msgOnChange args.value (args.value ++ emailSuggestion) ] behavioursTextWithPattern : String -> { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , text : String } behavioursTextWithPattern pattern = { onChange = \string -> args.msgOnChange (handleWithPatternChange { pattern = pattern , oldValue = args.value , newValue = string } ) , placeholder = Nothing , text = args.value , label = Input.labelHidden args.label } behavioursPassword : Bool -> { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe a1 , show : Bool , text : String } behavioursPassword show = { onChange = args.msgOnChange , placeholder = Nothing , text = args.value , label = Input.labelHidden args.label , show = show } behavioursMultiline : { label : Input.Label context msg , onChange : String -> msg , placeholder : Maybe (Input.Placeholder context msg) , spellcheck : Bool , text : String } behavioursMultiline = { onChange = args.msgOnChange , placeholder = Nothing , text = args.value , label = Input.labelHidden args.label , spellcheck = False } styleArgs : { disabled : Bool , displayValidation : Bool , focused : Bool , isMouseOver : Bool , label : String , palette : R10.FormTypes.Palette , requiredLabel : Maybe String , style : R10.FormComponents.Internal.Style.Style , leadingIcon : List (ElementC msg) , trailingIcon : List (ElementC msg) , maybeValid : Maybe Bool , value : String } styleArgs = { label = args.label , value = args.value , focused = args.focused , disabled = args.disabled , requiredLabel = args.requiredLabel , style = args.style , palette = args.palette , leadingIcon = args.leadingIcon , trailingIcon = args.trailingIcon , maybeValid = args.maybeValid , displayValidation = displayValidation , isMouseOver = False } displayValidation : Bool displayValidation = args.maybeValid /= Nothing in row [ case args.style of R10.FormComponents.Internal.Style.Filled -> Border.rounded 0 R10.FormComponents.Internal.Style.Outlined -> Border.rounded 5 , getBorder styleArgs , mouseOver [ getBorder { styleArgs | isMouseOver = True } ] , width fill , padding 0 -- Spacing must be 0 here , spacing 0 ] <| [] ++ List.map (\icon -> el iconCommonAttrs icon) args.leadingIcon ++ [ case args.textType of R10.FormTypes.TextUsername -> Input.username inputAttrs behavioursText R10.FormTypes.TextEmail -> Input.email inputAttrs behavioursText R10.FormTypes.TextEmailWithSuggestions listSuggestions -> el -- ╔══════════════╤═════════════════════════════════════════════════╗ -- ║ FEATURE_NAME │ Email Input Field with Domain Suggestions ║ -- ╚══════════════╧═════════════════════════════════════════════════╝ -- Detection of the key "right arrow" need to be -- done on a parent element, otherwise it doesn't -- work. Not sure why. This is why we are -- creating this extra "el" instead attaching it -- to the input field directly -- ([ width fill ] ++ rightKeyDownDetection listSuggestions) (withContext <| \c -> let autoSuggestionsAttrs : List (AttributeC msg) autoSuggestionsAttrs = R10.FormComponents.Internal.EmailAutoSuggest.autoSuggestionsAttrs { userAgent = c.userAgent , maybeEmailSuggestion = maybeEmailSuggestion c.emailDomainList , msgOnChange = args.msgOnChange , value = args.value } in Input.email (autoSuggestionsAttrs ++ inputAttrs) behavioursTextEmailWithSuggestions ) R10.FormTypes.TextPasswordCurrent -> Input.currentPassword inputAttrs (behavioursPassword args.showPassword) R10.FormTypes.TextPasswordNew -> Input.newPassword inputAttrs (behavioursPassword args.showPassword) R10.FormTypes.TextPlain -> Input.text inputAttrs behavioursText R10.FormTypes.TextMultiline -> Input.multiline inputAttrs behavioursMultiline R10.FormTypes.TextWithPattern pattern -> Input.text inputAttrs <| behavioursTextWithPattern pattern R10.FormTypes.TextWithPatternLarge pattern -> Input.text (textWithPatternLargeAttrsExtra ++ inputAttrs) <| behavioursTextWithPattern pattern ] ++ List.map (\icon -> el iconCommonAttrs icon) args.trailingIcon
elm
[ { "context": "\": \"9999\",\n \"name\": \"Drip\",\n \"slug\": \"drip\",\n ", "end": 594, "score": 0.999542594, "start": 590, "tag": "NAME", "value": "Drip" }, { "context": "id = \"9999\"\n , name = \"Drip\"\n , slug = \"drip\"\n ", "end": 1034, "score": 0.9995450974, "start": 1030, "tag": "NAME", "value": "Drip" } ]
assets/elm/tests/SpaceTest.elm
pradyumna2905/level
0
module SpaceTest exposing (decoders) import Expect exposing (Expectation) import Json.Decode as Decode exposing (decodeString) import Space import Test exposing (..) import TestHelpers exposing (success) {-| Tests for JSON decoders. -} decoders : Test decoders = describe "decoders" [ describe "Space.decoder" [ test "decodes space JSON" <| \_ -> let json = """ { "id": "9999", "name": "Drip", "slug": "drip", "avatarUrl": "src", "openInvitationUrl": "...", "setupState": "COMPLETE", "fetchedAt": 0 } """ expected = { id = "9999" , name = "Drip" , slug = "drip" , avatarUrl = Just "src" , openInvitationUrl = Just "..." , setupState = Space.Complete , fetchedAt = 0 } in case decodeString Space.decoder json of Ok value -> Expect.equal expected (Space.getCachedData value) Err err -> Expect.fail (Decode.errorToString err) , test "does not succeed given invalid JSON" <| \_ -> let json = """ { "id": "9999" } """ result = decodeString Space.decoder json in Expect.equal False (success result) ] ]
14616
module SpaceTest exposing (decoders) import Expect exposing (Expectation) import Json.Decode as Decode exposing (decodeString) import Space import Test exposing (..) import TestHelpers exposing (success) {-| Tests for JSON decoders. -} decoders : Test decoders = describe "decoders" [ describe "Space.decoder" [ test "decodes space JSON" <| \_ -> let json = """ { "id": "9999", "name": "<NAME>", "slug": "drip", "avatarUrl": "src", "openInvitationUrl": "...", "setupState": "COMPLETE", "fetchedAt": 0 } """ expected = { id = "9999" , name = "<NAME>" , slug = "drip" , avatarUrl = Just "src" , openInvitationUrl = Just "..." , setupState = Space.Complete , fetchedAt = 0 } in case decodeString Space.decoder json of Ok value -> Expect.equal expected (Space.getCachedData value) Err err -> Expect.fail (Decode.errorToString err) , test "does not succeed given invalid JSON" <| \_ -> let json = """ { "id": "9999" } """ result = decodeString Space.decoder json in Expect.equal False (success result) ] ]
true
module SpaceTest exposing (decoders) import Expect exposing (Expectation) import Json.Decode as Decode exposing (decodeString) import Space import Test exposing (..) import TestHelpers exposing (success) {-| Tests for JSON decoders. -} decoders : Test decoders = describe "decoders" [ describe "Space.decoder" [ test "decodes space JSON" <| \_ -> let json = """ { "id": "9999", "name": "PI:NAME:<NAME>END_PI", "slug": "drip", "avatarUrl": "src", "openInvitationUrl": "...", "setupState": "COMPLETE", "fetchedAt": 0 } """ expected = { id = "9999" , name = "PI:NAME:<NAME>END_PI" , slug = "drip" , avatarUrl = Just "src" , openInvitationUrl = Just "..." , setupState = Space.Complete , fetchedAt = 0 } in case decodeString Space.decoder json of Ok value -> Expect.equal expected (Space.getCachedData value) Err err -> Expect.fail (Decode.errorToString err) , test "does not succeed given invalid JSON" <| \_ -> let json = """ { "id": "9999" } """ result = decodeString Space.decoder json in Expect.equal False (success result) ] ]
elm
[ { "context": "n\n { isServer = nick == \"\"\n , nick = nick\n , hostname = host\n , realname = re", "end": 1731, "score": 0.7409517169, "start": 1727, "tag": "NAME", "value": "nick" } ]
projects/elm-irc/src/Irc.elm
erik/sketches
1
module Irc exposing (..) import Array exposing (..) import Date import Model import Regex exposing (HowMany(All)) type alias ParsedMessage = { raw : String , time : Float , prefix : String , command : String , params : Array String } type alias User = { isServer : Bool , nick : String , hostname : String , realname : String } type Message = Unknown ParsedMessage | Ping String | Notice { from : User , target : String , text : String } | Privmsg { from : User , target : String , text : String } | Registered | Joined { who : User , channel : String } | Parted { who : User , channel : String , reason : Maybe String } | Topic { who : User , channel : String , text : Maybe String } | TopicIs { text : String, channel : String } | NickList { channel : String, users : List Model.UserInfo } | Nick { who : User , nick : String } | Kicked { who : User , whom : String , channel : String , reason : Maybe String } parseUser : String -> User parseUser prefix = let ( nick, rest ) = case String.split "!" prefix of [ nick, rest ] -> ( nick, rest ) _ -> ( "", prefix ) ( real, host ) = case String.split "@" rest of [ real, host ] -> ( real, host ) _ -> ( "", rest ) in { isServer = nick == "" , nick = nick , hostname = host , realname = real } parse : ParsedMessage -> ( Date.Date, Message ) parse msg = let ts = Date.fromTime msg.time m = case msg.command of "PING" -> Ping (String.join " " (toList msg.params)) "PRIVMSG" -> let user = parseUser msg.prefix target = get 0 msg.params |> Maybe.map (\x -> if String.startsWith "#" x then x else user.nick ) text = get 1 msg.params in Privmsg { from = user , target = Maybe.withDefault "" target , text = Maybe.withDefault "" text } "NOTICE" -> let user = parseUser msg.prefix target = get 0 msg.params text = get 1 msg.params in Notice { from = user , target = Maybe.withDefault "" target , text = Maybe.withDefault "" text } "JOIN" -> let user = parseUser msg.prefix target = get 0 msg.params in Joined { who = user , channel = Maybe.withDefault "what" target } "NICK" -> let user = parseUser msg.prefix nick = get 0 msg.params in Nick { who = user , nick = Maybe.withDefault "[bug]" nick } "332" -> let target = get 1 msg.params topic = get 2 msg.params in TopicIs { text = Maybe.withDefault "what" topic , channel = Maybe.withDefault "what" target } "353" -> let specialChars = Regex.regex "[%@~\\+]+" mkUserInfo nickStr = nickStr |> Regex.replace All specialChars (\_ -> "") |> (\nick -> { nick = nick , user = "" , host = "" , name = "" } ) users = get 3 msg.params |> Maybe.withDefault "" |> String.words |> List.map mkUserInfo channel = get 2 msg.params in NickList { channel = Maybe.withDefault "wtf" channel , users = users } _ -> Unknown msg in ( ts, m )
34634
module Irc exposing (..) import Array exposing (..) import Date import Model import Regex exposing (HowMany(All)) type alias ParsedMessage = { raw : String , time : Float , prefix : String , command : String , params : Array String } type alias User = { isServer : Bool , nick : String , hostname : String , realname : String } type Message = Unknown ParsedMessage | Ping String | Notice { from : User , target : String , text : String } | Privmsg { from : User , target : String , text : String } | Registered | Joined { who : User , channel : String } | Parted { who : User , channel : String , reason : Maybe String } | Topic { who : User , channel : String , text : Maybe String } | TopicIs { text : String, channel : String } | NickList { channel : String, users : List Model.UserInfo } | Nick { who : User , nick : String } | Kicked { who : User , whom : String , channel : String , reason : Maybe String } parseUser : String -> User parseUser prefix = let ( nick, rest ) = case String.split "!" prefix of [ nick, rest ] -> ( nick, rest ) _ -> ( "", prefix ) ( real, host ) = case String.split "@" rest of [ real, host ] -> ( real, host ) _ -> ( "", rest ) in { isServer = nick == "" , nick = <NAME> , hostname = host , realname = real } parse : ParsedMessage -> ( Date.Date, Message ) parse msg = let ts = Date.fromTime msg.time m = case msg.command of "PING" -> Ping (String.join " " (toList msg.params)) "PRIVMSG" -> let user = parseUser msg.prefix target = get 0 msg.params |> Maybe.map (\x -> if String.startsWith "#" x then x else user.nick ) text = get 1 msg.params in Privmsg { from = user , target = Maybe.withDefault "" target , text = Maybe.withDefault "" text } "NOTICE" -> let user = parseUser msg.prefix target = get 0 msg.params text = get 1 msg.params in Notice { from = user , target = Maybe.withDefault "" target , text = Maybe.withDefault "" text } "JOIN" -> let user = parseUser msg.prefix target = get 0 msg.params in Joined { who = user , channel = Maybe.withDefault "what" target } "NICK" -> let user = parseUser msg.prefix nick = get 0 msg.params in Nick { who = user , nick = Maybe.withDefault "[bug]" nick } "332" -> let target = get 1 msg.params topic = get 2 msg.params in TopicIs { text = Maybe.withDefault "what" topic , channel = Maybe.withDefault "what" target } "353" -> let specialChars = Regex.regex "[%@~\\+]+" mkUserInfo nickStr = nickStr |> Regex.replace All specialChars (\_ -> "") |> (\nick -> { nick = nick , user = "" , host = "" , name = "" } ) users = get 3 msg.params |> Maybe.withDefault "" |> String.words |> List.map mkUserInfo channel = get 2 msg.params in NickList { channel = Maybe.withDefault "wtf" channel , users = users } _ -> Unknown msg in ( ts, m )
true
module Irc exposing (..) import Array exposing (..) import Date import Model import Regex exposing (HowMany(All)) type alias ParsedMessage = { raw : String , time : Float , prefix : String , command : String , params : Array String } type alias User = { isServer : Bool , nick : String , hostname : String , realname : String } type Message = Unknown ParsedMessage | Ping String | Notice { from : User , target : String , text : String } | Privmsg { from : User , target : String , text : String } | Registered | Joined { who : User , channel : String } | Parted { who : User , channel : String , reason : Maybe String } | Topic { who : User , channel : String , text : Maybe String } | TopicIs { text : String, channel : String } | NickList { channel : String, users : List Model.UserInfo } | Nick { who : User , nick : String } | Kicked { who : User , whom : String , channel : String , reason : Maybe String } parseUser : String -> User parseUser prefix = let ( nick, rest ) = case String.split "!" prefix of [ nick, rest ] -> ( nick, rest ) _ -> ( "", prefix ) ( real, host ) = case String.split "@" rest of [ real, host ] -> ( real, host ) _ -> ( "", rest ) in { isServer = nick == "" , nick = PI:NAME:<NAME>END_PI , hostname = host , realname = real } parse : ParsedMessage -> ( Date.Date, Message ) parse msg = let ts = Date.fromTime msg.time m = case msg.command of "PING" -> Ping (String.join " " (toList msg.params)) "PRIVMSG" -> let user = parseUser msg.prefix target = get 0 msg.params |> Maybe.map (\x -> if String.startsWith "#" x then x else user.nick ) text = get 1 msg.params in Privmsg { from = user , target = Maybe.withDefault "" target , text = Maybe.withDefault "" text } "NOTICE" -> let user = parseUser msg.prefix target = get 0 msg.params text = get 1 msg.params in Notice { from = user , target = Maybe.withDefault "" target , text = Maybe.withDefault "" text } "JOIN" -> let user = parseUser msg.prefix target = get 0 msg.params in Joined { who = user , channel = Maybe.withDefault "what" target } "NICK" -> let user = parseUser msg.prefix nick = get 0 msg.params in Nick { who = user , nick = Maybe.withDefault "[bug]" nick } "332" -> let target = get 1 msg.params topic = get 2 msg.params in TopicIs { text = Maybe.withDefault "what" topic , channel = Maybe.withDefault "what" target } "353" -> let specialChars = Regex.regex "[%@~\\+]+" mkUserInfo nickStr = nickStr |> Regex.replace All specialChars (\_ -> "") |> (\nick -> { nick = nick , user = "" , host = "" , name = "" } ) users = get 3 msg.params |> Maybe.withDefault "" |> String.words |> List.map mkUserInfo channel = get 2 msg.params in NickList { channel = Maybe.withDefault "wtf" channel , users = users } _ -> Unknown msg in ( ts, m )
elm
[ { "context": "/v1/gifs/search?q=\" ++ query ++ \"&limit=7&api_key=dc6zaTOxFJmzC\"\n in\n Http.send resultToMessage (Http.get u", "end": 2486, "score": 0.9526833296, "start": 2473, "tag": "KEY", "value": "dc6zaTOxFJmzC" } ]
src/MainBonus.elm
StefanHub/giphy-elm
0
module MainBonus exposing (..) import Control exposing (..) import Control.Debounce exposing (..) import Date exposing (..) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) import Http exposing (..) import JsonDecode exposing (..) import Task exposing (..) import Time exposing (..) import Util exposing (..) main : Program Never Model Msg main = Html.program { init = init , view = view , update = update , subscriptions = subscriptions --always Sub.none } -- MODEL type alias Model = { query : String , error : Maybe String , debounceState : Control.State Msg , data : List GiphyData , selected : Maybe GiphyData , time : Time } -- initial model init : ( Model, Cmd Msg ) init = ( { query = "" , error = Nothing , debounceState = Control.initialState , data = [] , selected = Maybe.Nothing , time = 0 } , Cmd.batch [ Util.perform (NewSearch "minions"), Task.perform NewTime Time.now ] --perform (NewSearch "minions") --Cmd.none ) -- UPDATE type Msg = NewSearch String | Debounce (Control Msg) | NewGiphys (Result Error GiphyResult) | GiphySelect GiphyData | NewTime Time update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NewSearch query -> ( { model | query = query }, searchGiphys NewGiphys query ) Debounce control -> Control.update (\newDebounceState -> { model | debounceState = newDebounceState }) model.debounceState control NewGiphys result -> case result of Ok giphyResult -> ( { model | data = giphyResult.data , selected = List.head giphyResult.data , error = Nothing } , Cmd.none ) Err err -> ( { model | error = Just (toString err) }, Cmd.none ) GiphySelect giphyData -> ( { model | selected = Just giphyData }, Cmd.none ) NewTime time -> ( { model | time = time }, Cmd.none ) searchGiphys : (Result Error GiphyResult -> msg) -> String -> Cmd msg searchGiphys resultToMessage query = let url = "http://api.giphy.com/v1/gifs/search?q=" ++ query ++ "&limit=7&api_key=dc6zaTOxFJmzC" in Http.send resultToMessage (Http.get url decodeGiphyResult) --- VIEW view : Model -> Html Msg view model = div [ class "container" ] [ h1 [ class "text-center" ] [ text ("Giphy Search - " ++ toClock model.time) ] , searchBar , viewError model.error , viewDetail model.selected , viewList model.data ] searchBar : Html Msg searchBar = div [ class "search-bar" ] [ input [ placeholder "Search term .." , type_ "text" , Html.Attributes.map debounce (onInput NewSearch) ] [] ] debounce : Msg -> Msg debounce = -- !! no parameter !! Control.Debounce.trailing Debounce (1 * Time.second) viewError : Maybe String -> Html Msg viewError error = case error of Just message -> div [ class "alert alert-danger" ] [ text message ] Nothing -> span [] [] viewList : List GiphyData -> Html Msg viewList data = ul [ class "col-md-4 list-group" ] (viewListItems data) viewListItems : List GiphyData -> List (Html Msg) viewListItems data = List.map viewListItem data viewListItem : GiphyData -> Html Msg viewListItem data = li [ class "list-group-item" ] [ div [ class "giphy-list media" ] [ div [ class "media-left" ] [ img [ src data.images.fixed_height_small_still.url , onClick (GiphySelect data) ] [] ] ] ] viewDetail : Maybe GiphyData -> Html Msg viewDetail maybeData = div [ class "giphy-detail col-md-8" ] [ case maybeData of Just data -> div [] [ div [ class "embed-responsive embed-responsive-16by9" ] [ iframe [ class "embed-responsive-item" , src data.embed_url , title data.slug ] [] ] , div [ class "details text-center" ] [ a [ class "btn btn-primary" , role "button" , downloadAs data.slug , href data.images.original.url , title data.slug , alt data.slug ] [ text "Download from Giphy" ] ] ] Nothing -> div [] [ text "Loading .." ] ] -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions model = Time.every Time.second NewTime toClock : Time -> String toClock time = let date = fromTime time hour = Date.hour date |> to2DigitString minute = to2DigitString (Date.minute date) second = date |> Date.second |> to2DigitString in hour ++ ":" ++ minute ++ ":" ++ second to2DigitString : Int -> String to2DigitString t = let ts = toString t in case String.length ts of 1 -> "0" ++ ts _ -> ts
50768
module MainBonus exposing (..) import Control exposing (..) import Control.Debounce exposing (..) import Date exposing (..) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) import Http exposing (..) import JsonDecode exposing (..) import Task exposing (..) import Time exposing (..) import Util exposing (..) main : Program Never Model Msg main = Html.program { init = init , view = view , update = update , subscriptions = subscriptions --always Sub.none } -- MODEL type alias Model = { query : String , error : Maybe String , debounceState : Control.State Msg , data : List GiphyData , selected : Maybe GiphyData , time : Time } -- initial model init : ( Model, Cmd Msg ) init = ( { query = "" , error = Nothing , debounceState = Control.initialState , data = [] , selected = Maybe.Nothing , time = 0 } , Cmd.batch [ Util.perform (NewSearch "minions"), Task.perform NewTime Time.now ] --perform (NewSearch "minions") --Cmd.none ) -- UPDATE type Msg = NewSearch String | Debounce (Control Msg) | NewGiphys (Result Error GiphyResult) | GiphySelect GiphyData | NewTime Time update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NewSearch query -> ( { model | query = query }, searchGiphys NewGiphys query ) Debounce control -> Control.update (\newDebounceState -> { model | debounceState = newDebounceState }) model.debounceState control NewGiphys result -> case result of Ok giphyResult -> ( { model | data = giphyResult.data , selected = List.head giphyResult.data , error = Nothing } , Cmd.none ) Err err -> ( { model | error = Just (toString err) }, Cmd.none ) GiphySelect giphyData -> ( { model | selected = Just giphyData }, Cmd.none ) NewTime time -> ( { model | time = time }, Cmd.none ) searchGiphys : (Result Error GiphyResult -> msg) -> String -> Cmd msg searchGiphys resultToMessage query = let url = "http://api.giphy.com/v1/gifs/search?q=" ++ query ++ "&limit=7&api_key=<KEY>" in Http.send resultToMessage (Http.get url decodeGiphyResult) --- VIEW view : Model -> Html Msg view model = div [ class "container" ] [ h1 [ class "text-center" ] [ text ("Giphy Search - " ++ toClock model.time) ] , searchBar , viewError model.error , viewDetail model.selected , viewList model.data ] searchBar : Html Msg searchBar = div [ class "search-bar" ] [ input [ placeholder "Search term .." , type_ "text" , Html.Attributes.map debounce (onInput NewSearch) ] [] ] debounce : Msg -> Msg debounce = -- !! no parameter !! Control.Debounce.trailing Debounce (1 * Time.second) viewError : Maybe String -> Html Msg viewError error = case error of Just message -> div [ class "alert alert-danger" ] [ text message ] Nothing -> span [] [] viewList : List GiphyData -> Html Msg viewList data = ul [ class "col-md-4 list-group" ] (viewListItems data) viewListItems : List GiphyData -> List (Html Msg) viewListItems data = List.map viewListItem data viewListItem : GiphyData -> Html Msg viewListItem data = li [ class "list-group-item" ] [ div [ class "giphy-list media" ] [ div [ class "media-left" ] [ img [ src data.images.fixed_height_small_still.url , onClick (GiphySelect data) ] [] ] ] ] viewDetail : Maybe GiphyData -> Html Msg viewDetail maybeData = div [ class "giphy-detail col-md-8" ] [ case maybeData of Just data -> div [] [ div [ class "embed-responsive embed-responsive-16by9" ] [ iframe [ class "embed-responsive-item" , src data.embed_url , title data.slug ] [] ] , div [ class "details text-center" ] [ a [ class "btn btn-primary" , role "button" , downloadAs data.slug , href data.images.original.url , title data.slug , alt data.slug ] [ text "Download from Giphy" ] ] ] Nothing -> div [] [ text "Loading .." ] ] -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions model = Time.every Time.second NewTime toClock : Time -> String toClock time = let date = fromTime time hour = Date.hour date |> to2DigitString minute = to2DigitString (Date.minute date) second = date |> Date.second |> to2DigitString in hour ++ ":" ++ minute ++ ":" ++ second to2DigitString : Int -> String to2DigitString t = let ts = toString t in case String.length ts of 1 -> "0" ++ ts _ -> ts
true
module MainBonus exposing (..) import Control exposing (..) import Control.Debounce exposing (..) import Date exposing (..) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) import Http exposing (..) import JsonDecode exposing (..) import Task exposing (..) import Time exposing (..) import Util exposing (..) main : Program Never Model Msg main = Html.program { init = init , view = view , update = update , subscriptions = subscriptions --always Sub.none } -- MODEL type alias Model = { query : String , error : Maybe String , debounceState : Control.State Msg , data : List GiphyData , selected : Maybe GiphyData , time : Time } -- initial model init : ( Model, Cmd Msg ) init = ( { query = "" , error = Nothing , debounceState = Control.initialState , data = [] , selected = Maybe.Nothing , time = 0 } , Cmd.batch [ Util.perform (NewSearch "minions"), Task.perform NewTime Time.now ] --perform (NewSearch "minions") --Cmd.none ) -- UPDATE type Msg = NewSearch String | Debounce (Control Msg) | NewGiphys (Result Error GiphyResult) | GiphySelect GiphyData | NewTime Time update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NewSearch query -> ( { model | query = query }, searchGiphys NewGiphys query ) Debounce control -> Control.update (\newDebounceState -> { model | debounceState = newDebounceState }) model.debounceState control NewGiphys result -> case result of Ok giphyResult -> ( { model | data = giphyResult.data , selected = List.head giphyResult.data , error = Nothing } , Cmd.none ) Err err -> ( { model | error = Just (toString err) }, Cmd.none ) GiphySelect giphyData -> ( { model | selected = Just giphyData }, Cmd.none ) NewTime time -> ( { model | time = time }, Cmd.none ) searchGiphys : (Result Error GiphyResult -> msg) -> String -> Cmd msg searchGiphys resultToMessage query = let url = "http://api.giphy.com/v1/gifs/search?q=" ++ query ++ "&limit=7&api_key=PI:KEY:<KEY>END_PI" in Http.send resultToMessage (Http.get url decodeGiphyResult) --- VIEW view : Model -> Html Msg view model = div [ class "container" ] [ h1 [ class "text-center" ] [ text ("Giphy Search - " ++ toClock model.time) ] , searchBar , viewError model.error , viewDetail model.selected , viewList model.data ] searchBar : Html Msg searchBar = div [ class "search-bar" ] [ input [ placeholder "Search term .." , type_ "text" , Html.Attributes.map debounce (onInput NewSearch) ] [] ] debounce : Msg -> Msg debounce = -- !! no parameter !! Control.Debounce.trailing Debounce (1 * Time.second) viewError : Maybe String -> Html Msg viewError error = case error of Just message -> div [ class "alert alert-danger" ] [ text message ] Nothing -> span [] [] viewList : List GiphyData -> Html Msg viewList data = ul [ class "col-md-4 list-group" ] (viewListItems data) viewListItems : List GiphyData -> List (Html Msg) viewListItems data = List.map viewListItem data viewListItem : GiphyData -> Html Msg viewListItem data = li [ class "list-group-item" ] [ div [ class "giphy-list media" ] [ div [ class "media-left" ] [ img [ src data.images.fixed_height_small_still.url , onClick (GiphySelect data) ] [] ] ] ] viewDetail : Maybe GiphyData -> Html Msg viewDetail maybeData = div [ class "giphy-detail col-md-8" ] [ case maybeData of Just data -> div [] [ div [ class "embed-responsive embed-responsive-16by9" ] [ iframe [ class "embed-responsive-item" , src data.embed_url , title data.slug ] [] ] , div [ class "details text-center" ] [ a [ class "btn btn-primary" , role "button" , downloadAs data.slug , href data.images.original.url , title data.slug , alt data.slug ] [ text "Download from Giphy" ] ] ] Nothing -> div [] [ text "Loading .." ] ] -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions model = Time.every Time.second NewTime toClock : Time -> String toClock time = let date = fromTime time hour = Date.hour date |> to2DigitString minute = to2DigitString (Date.minute date) second = date |> Date.second |> to2DigitString in hour ++ ":" ++ minute ++ ":" ++ second to2DigitString : Int -> String to2DigitString t = let ts = toString t in case String.length ts of 1 -> "0" ++ ts _ -> ts
elm
[ { "context": "{-\n Swaggy Jenkins\n Jenkins API clients generated from Swagger / O", "end": 20, "score": 0.9992318153, "start": 6, "tag": "NAME", "value": "Swaggy Jenkins" }, { "context": "cation\n\n OpenAPI spec version: 1.1.1\n Contact: blah@cliffano.com\n\n NOTE: This file is auto generated by the open", "end": 153, "score": 0.9999136925, "start": 136, "tag": "EMAIL", "value": "blah@cliffano.com" }, { "context": "d by the openapi-generator.\n https://github.com/openapitools/openapi-generator.git\n Do not edit this file ma", "end": 252, "score": 0.9996411204, "start": 240, "tag": "USERNAME", "value": "openapitools" } ]
clients/elm/generated/src/Data/ClassesByClass.elm
PankTrue/swaggy-jenkins
23
{- Swaggy Jenkins Jenkins API clients generated from Swagger / Open API specification OpenAPI spec version: 1.1.1 Contact: blah@cliffano.com NOTE: This file is auto generated by the openapi-generator. https://github.com/openapitools/openapi-generator.git Do not edit this file manually. -} module Data.ClassesByClass exposing (ClassesByClass, classesByClassDecoder, classesByClassEncoder) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (decode, optional, required) import Json.Encode as Encode import Maybe exposing (map, withDefault) type alias ClassesByClass = { classes : Maybe (List String) , class : Maybe String } classesByClassDecoder : Decoder ClassesByClass classesByClassDecoder = decode ClassesByClass |> optional "classes" (Decode.nullable (Decode.list Decode.string)) Nothing |> optional "_class" (Decode.nullable Decode.string) Nothing classesByClassEncoder : ClassesByClass -> Encode.Value classesByClassEncoder model = Encode.object [ ( "classes", withDefault Encode.null (map (Encode.list << List.map Encode.string) model.classes) ) , ( "_class", withDefault Encode.null (map Encode.string model.class) ) ]
38303
{- <NAME> Jenkins API clients generated from Swagger / Open API specification OpenAPI spec version: 1.1.1 Contact: <EMAIL> NOTE: This file is auto generated by the openapi-generator. https://github.com/openapitools/openapi-generator.git Do not edit this file manually. -} module Data.ClassesByClass exposing (ClassesByClass, classesByClassDecoder, classesByClassEncoder) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (decode, optional, required) import Json.Encode as Encode import Maybe exposing (map, withDefault) type alias ClassesByClass = { classes : Maybe (List String) , class : Maybe String } classesByClassDecoder : Decoder ClassesByClass classesByClassDecoder = decode ClassesByClass |> optional "classes" (Decode.nullable (Decode.list Decode.string)) Nothing |> optional "_class" (Decode.nullable Decode.string) Nothing classesByClassEncoder : ClassesByClass -> Encode.Value classesByClassEncoder model = Encode.object [ ( "classes", withDefault Encode.null (map (Encode.list << List.map Encode.string) model.classes) ) , ( "_class", withDefault Encode.null (map Encode.string model.class) ) ]
true
{- PI:NAME:<NAME>END_PI Jenkins API clients generated from Swagger / Open API specification OpenAPI spec version: 1.1.1 Contact: PI:EMAIL:<EMAIL>END_PI NOTE: This file is auto generated by the openapi-generator. https://github.com/openapitools/openapi-generator.git Do not edit this file manually. -} module Data.ClassesByClass exposing (ClassesByClass, classesByClassDecoder, classesByClassEncoder) import Json.Decode as Decode exposing (Decoder) import Json.Decode.Pipeline exposing (decode, optional, required) import Json.Encode as Encode import Maybe exposing (map, withDefault) type alias ClassesByClass = { classes : Maybe (List String) , class : Maybe String } classesByClassDecoder : Decoder ClassesByClass classesByClassDecoder = decode ClassesByClass |> optional "classes" (Decode.nullable (Decode.list Decode.string)) Nothing |> optional "_class" (Decode.nullable Decode.string) Nothing classesByClassEncoder : ClassesByClass -> Encode.Value classesByClassEncoder model = Encode.object [ ( "classes", withDefault Encode.null (map (Encode.list << List.map Encode.string) model.classes) ) , ( "_class", withDefault Encode.null (map Encode.string model.class) ) ]
elm
[ { "context": "uleName = \"Translation.Test\"\n , key = \"myString\"\n , comment = \"MyComment\"\n ", "end": 436, "score": 0.9059610367, "start": 428, "tag": "KEY", "value": "myString" }, { "context": "eName = \"Translation.Second\"\n , key = \"myString\"\n , comment = \"Multiline\\ncomment\"\n ", "end": 648, "score": 0.892790556, "start": 640, "tag": "KEY", "value": "myString" }, { "context": "eName = \"Translation.Test\"\n , key = \"myFormat\"\n , comment = \"\"\n }\n ", "end": 867, "score": 0.6914054155, "start": 861, "tag": "KEY", "value": "Format" } ]
tests/Tests/PO/Export.elm
davidjb99/elm-i18n
72
module Tests.PO.Export exposing (..) import Expect import Localized import PO.Export as PO import Test exposing (..) testExport : Test testExport = test "testExport" <| \() -> PO.generate elements |> Expect.equal expectedPO elements : List Localized.Element elements = [ Localized.ElementStatic { meta = { moduleName = "Translation.Test" , key = "myString" , comment = "MyComment" } , value = "Value" } , Localized.ElementStatic { meta = { moduleName = "Translation.Second" , key = "myString" , comment = "Multiline\ncomment" } , value = "Value" } , Localized.ElementFormat { meta = { moduleName = "Translation.Test" , key = "myFormat" , comment = "" } , placeholders = [ "label" ] , components = [ Localized.FormatComponentStatic "Prefix: " , Localized.FormatComponentPlaceholder "label" ] } ] expectedPO : String expectedPO = """#. MyComment msgid "Translation.Test.myString" msgstr "Value" #. Multiline #. comment msgid "Translation.Second.myString" msgstr "Value" #. #. i18n: placeholders: label msgid "Translation.Test.myFormat" msgstr "Prefix: %(label)s" """
1150
module Tests.PO.Export exposing (..) import Expect import Localized import PO.Export as PO import Test exposing (..) testExport : Test testExport = test "testExport" <| \() -> PO.generate elements |> Expect.equal expectedPO elements : List Localized.Element elements = [ Localized.ElementStatic { meta = { moduleName = "Translation.Test" , key = "<KEY>" , comment = "MyComment" } , value = "Value" } , Localized.ElementStatic { meta = { moduleName = "Translation.Second" , key = "<KEY>" , comment = "Multiline\ncomment" } , value = "Value" } , Localized.ElementFormat { meta = { moduleName = "Translation.Test" , key = "my<KEY>" , comment = "" } , placeholders = [ "label" ] , components = [ Localized.FormatComponentStatic "Prefix: " , Localized.FormatComponentPlaceholder "label" ] } ] expectedPO : String expectedPO = """#. MyComment msgid "Translation.Test.myString" msgstr "Value" #. Multiline #. comment msgid "Translation.Second.myString" msgstr "Value" #. #. i18n: placeholders: label msgid "Translation.Test.myFormat" msgstr "Prefix: %(label)s" """
true
module Tests.PO.Export exposing (..) import Expect import Localized import PO.Export as PO import Test exposing (..) testExport : Test testExport = test "testExport" <| \() -> PO.generate elements |> Expect.equal expectedPO elements : List Localized.Element elements = [ Localized.ElementStatic { meta = { moduleName = "Translation.Test" , key = "PI:KEY:<KEY>END_PI" , comment = "MyComment" } , value = "Value" } , Localized.ElementStatic { meta = { moduleName = "Translation.Second" , key = "PI:KEY:<KEY>END_PI" , comment = "Multiline\ncomment" } , value = "Value" } , Localized.ElementFormat { meta = { moduleName = "Translation.Test" , key = "myPI:KEY:<KEY>END_PI" , comment = "" } , placeholders = [ "label" ] , components = [ Localized.FormatComponentStatic "Prefix: " , Localized.FormatComponentPlaceholder "label" ] } ] expectedPO : String expectedPO = """#. MyComment msgid "Translation.Test.myString" msgstr "Value" #. Multiline #. comment msgid "Translation.Second.myString" msgstr "Value" #. #. i18n: placeholders: label msgid "Translation.Test.myFormat" msgstr "Prefix: %(label)s" """
elm
[ { "context": " , Html.Attributes.href \"https://github.com/inkuzmin/elm-multiselect\"\n , Html.Attri", "end": 7346, "score": 0.9889643192, "start": 7338, "tag": "USERNAME", "value": "inkuzmin" }, { "context": " , Html.Attributes.attribute \"aria-label\" \"Star inkuzmin/elm-multiselect on GitHub\"\n ]\n", "end": 7580, "score": 0.9681950808, "start": 7572, "tag": "USERNAME", "value": "inkuzmin" }, { "context": "Html.a [ Html.Attributes.href \"https://github.com/inkuzmin\" ] [ text \"Ivan Kuzmin\" ] ]\n ]\n ", "end": 9805, "score": 0.9994388223, "start": 9797, "tag": "USERNAME", "value": "inkuzmin" }, { "context": "utes.href \"https://github.com/inkuzmin\" ] [ text \"Ivan Kuzmin\" ] ]\n ]\n ]\n ]\n\n\n", "end": 9828, "score": 0.9999001622, "start": 9817, "tag": "NAME", "value": "Ivan Kuzmin" }, { "context": " url =\n \"https://api.github.com/repos/inkuzmin/elm-multiselect/contributors\"\n\n request =\n", "end": 10480, "score": 0.9977256656, "start": 10472, "tag": "USERNAME", "value": "inkuzmin" } ]
example/src/Main.elm
sirstrahd/elm-multiselect
0
module Main exposing (Flags, Model, Msg(..), addTag, decodeUrl, handleTag, init, initModel, main, prepopulateValues, showSelected, subscriptions, update, updateOutMsg, valuesA, valuesB, valuesC, valuesD, view) import Browser as Browser import Html exposing (Html, button, div, text) import Html.Attributes import Html.Events exposing (onClick) import Http as Http import Json.Decode as Decode import Multiselect main : Program Flags Model Msg main = Browser.document { init = init , view = \m -> { title = "Elm 0.19 starter" , body = [ view m ] } , update = update , subscriptions = subscriptions } -- MODEL valuesA : List ( String, String ) valuesA = [ ( "elixir-estonia", "ELIXIR Estonia" ) , ( "unitartu", "University of Tartu" ) , ( "cs", "Institute of Computer Science" ) , ( "biit", "BIIT" ) , ( "javascript", "JavaScript" ) , ( "elm", "Elm" ) , ( "multiselect", "Multiselect" ) , ( "haskell", "Haskell" ) , ( "elixir", "Elixir" ) , ( "clojure", "Clojure" ) , ( "shen", "Shen" ) ] valuesB : List ( String, String ) valuesB = [ ( "0", "AAA" ) , ( "1", "AAB" ) , ( "2", "ABA" ) , ( "3", "ABB" ) , ( "4", "BAA" ) , ( "5", "BAB" ) , ( "6", "BBA" ) , ( "7", "BBB" ) ] valuesC : List ( String, String ) valuesC = [] valuesD : List ( String, String ) valuesD = [] type alias Flags = {} type alias Model = { multiselectA : Multiselect.Model , multiselectB : Multiselect.Model , multiselectC : Multiselect.Model , multiselectD : Multiselect.Model , selectedA : List ( String, String ) } initModel : Model initModel = { multiselectA = Multiselect.initModel valuesA "A" , multiselectB = Multiselect.initModel valuesB "B" , multiselectC = Multiselect.initModel valuesC "C" , multiselectD = Multiselect.initModel valuesD "D" , selectedA = [] } init : Flags -> ( Model, Cmd Msg ) init flags = ( initModel, prepopulateValues ) -- UPDATE type Msg = NoOp | HOI Multiselect.Msg | Nyan Multiselect.Msg | Yay Multiselect.Msg | Tags Multiselect.Msg | SelectA | Prepopulate (Result Http.Error (List String)) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NoOp -> ( model, Cmd.none ) HOI sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectA in ( { model | multiselectA = subModel }, Cmd.map HOI subCmd ) Nyan sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectB in ( { model | multiselectB = subModel }, Cmd.map Nyan subCmd ) Yay sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectC newModel = { model | multiselectC = subModel } ( newerModel, outCommands ) = case outMsg of Just m -> updateOutMsg m newModel Nothing -> ( newModel, Cmd.none ) in ( newerModel, Cmd.batch [ Cmd.map Yay subCmd, outCommands ] ) Tags sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectD newModel = { model | multiselectD = subModel } ( newerModel, outCommands ) = case outMsg of Just m -> handleTag m newModel Nothing -> ( newModel, Cmd.none ) in ( newerModel, Cmd.batch [ Cmd.map Tags subCmd, outCommands ] ) SelectA -> ( { model | selectedA = Multiselect.getSelectedValues model.multiselectA }, Cmd.none ) Prepopulate (Ok vs) -> let multiselectModel = model.multiselectC values = List.map (\v -> ( v, v )) vs in ( { model | multiselectC = Multiselect.populateValues multiselectModel values [] }, Cmd.none ) Prepopulate (Err _) -> Debug.log "error" ( model, Cmd.none ) addTag : Multiselect.Model -> ( String, String ) -> ( Multiselect.Model, Cmd Msg ) addTag multiselectModel tag = let values = Multiselect.getValues multiselectModel selected = Multiselect.getSelectedValues multiselectModel alreadyExists = List.member tag values in if alreadyExists then ( multiselectModel, Cmd.none ) else Multiselect.populateValues multiselectModel (values ++ [ tag ]) (selected ++ [ tag ]) |> Multiselect.clearInputText |> (\( m, c ) -> ( m, Cmd.map Tags c )) handleTag : Multiselect.OutMsg -> Model -> ( Model, Cmd Msg ) handleTag msg model = case msg of Multiselect.NotFound v -> let _ = Debug.log "Received Not Found msg from Multiselect, value" v tag = ( v, v ) multiselectModel = model.multiselectD ( populated, cmd ) = addTag multiselectModel tag in ( { model | multiselectD = populated }, cmd ) _ -> ( model, Cmd.none ) updateOutMsg : Multiselect.OutMsg -> Model -> ( Model, Cmd Msg ) updateOutMsg msg model = case msg of Multiselect.Selected ( k, v ) -> let _ = ( Debug.log "Received Selected msg from Multiselect, key" k , Debug.log "value" v ) in ( model, Cmd.none ) Multiselect.Unselected ( k, v ) -> let _ = ( Debug.log "Received Unselected msg from Multiselect, key" k , Debug.log "value" v ) in ( model, Cmd.none ) Multiselect.Cleared -> let _ = Debug.log "Received Cleared msg from Multiselect" "" in ( model, Cmd.none ) Multiselect.NotFound v -> let _ = Debug.log "Received Not Found msg from Multiselect, value" v in ( model, Cmd.none ) -- VIEW view : Model -> Html Msg view model = div [] [ div [ Html.Attributes.class "wrapper" ] [ Html.header [] [ div [] [ Html.h1 [] [ text "elm-multiselect" ] , Html.p [] [ text "A multiselect control built with and for Elm" ] ] ] , div [ Html.Attributes.class "subheader" ] [ Html.a [ Html.Attributes.class "github-button" , Html.Attributes.href "https://github.com/inkuzmin/elm-multiselect" , Html.Attributes.attribute "data-size" "large" , Html.Attributes.attribute "data-show-count" "true" , Html.Attributes.attribute "aria-label" "Star inkuzmin/elm-multiselect on GitHub" ] [ text "Star" ] ] , div [ Html.Attributes.id "main" ] [ Html.h3 [] [ text "Submit on button click" ] , Html.map HOI <| Multiselect.view model.multiselectA , showSelected model.selectedA , Html.button [ Html.Attributes.class "btn", onClick SelectA ] [ text "Select!" ] , div [ Html.Attributes.style "height" "300px" ] [ text "" ] , Html.h3 [] [ text "Submit on select" ] , Html.map Nyan <| Multiselect.view model.multiselectB , showSelected (Multiselect.getSelectedValues model.multiselectB) , div [ Html.Attributes.style "height" "300px" ] [ text "" ] , Html.h3 [] [ text "Contributors (dynamic fetching of values)" ] , Html.map Yay <| Multiselect.view model.multiselectC , showSelected (Multiselect.getSelectedValues model.multiselectC) , div [ Html.Attributes.style "height" "300px" ] [ text "" ] , Html.h3 [] [ text "Tagging Example" ] , Html.map Tags <| Multiselect.view model.multiselectD , showSelected (Multiselect.getSelectedValues model.multiselectD) ] , div [ Html.Attributes.class "push" ] [] ] , Html.footer [] [ div [ Html.Attributes.class "acknowledgements" ] [ Html.a [ Html.Attributes.class "image unitartu", Html.Attributes.href "https://www.ut.ee/en" ] [ Html.img [ Html.Attributes.alt "Emblem of the University of Tartu", Html.Attributes.src "https://inkuzmin.github.io/logos/assets/unitartu.svg", Html.Attributes.width 100 ] [] ] , Html.a [ Html.Attributes.class "image biit", Html.Attributes.href "https://biit.cs.ut.ee/" ] [ Html.img [ Html.Attributes.alt "BIIT research group", Html.Attributes.src "https://inkuzmin.github.io/logos/assets/biit.svg", Html.Attributes.width 100 ] [] ] ] , div [ Html.Attributes.class "copy" ] [ Html.p [] [ text "© 2018 ", Html.a [ Html.Attributes.href "https://github.com/inkuzmin" ] [ text "Ivan Kuzmin" ] ] ] ] ] showSelected : List ( String, String ) -> Html Msg showSelected values = Html.ul [] (List.map (\( name, value ) -> Html.li [] [ text value ]) values) -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions model = Sub.batch [ Sub.map HOI <| Multiselect.subscriptions model.multiselectA , Sub.map Nyan <| Multiselect.subscriptions model.multiselectB , Sub.map Yay <| Multiselect.subscriptions model.multiselectC ] -- HELPERS prepopulateValues : Cmd Msg prepopulateValues = let url = "https://api.github.com/repos/inkuzmin/elm-multiselect/contributors" request = Http.get url decodeUrl in Http.send Prepopulate request decodeUrl : Decode.Decoder (List String) decodeUrl = Decode.list (Decode.field "login" Decode.string)
9625
module Main exposing (Flags, Model, Msg(..), addTag, decodeUrl, handleTag, init, initModel, main, prepopulateValues, showSelected, subscriptions, update, updateOutMsg, valuesA, valuesB, valuesC, valuesD, view) import Browser as Browser import Html exposing (Html, button, div, text) import Html.Attributes import Html.Events exposing (onClick) import Http as Http import Json.Decode as Decode import Multiselect main : Program Flags Model Msg main = Browser.document { init = init , view = \m -> { title = "Elm 0.19 starter" , body = [ view m ] } , update = update , subscriptions = subscriptions } -- MODEL valuesA : List ( String, String ) valuesA = [ ( "elixir-estonia", "ELIXIR Estonia" ) , ( "unitartu", "University of Tartu" ) , ( "cs", "Institute of Computer Science" ) , ( "biit", "BIIT" ) , ( "javascript", "JavaScript" ) , ( "elm", "Elm" ) , ( "multiselect", "Multiselect" ) , ( "haskell", "Haskell" ) , ( "elixir", "Elixir" ) , ( "clojure", "Clojure" ) , ( "shen", "Shen" ) ] valuesB : List ( String, String ) valuesB = [ ( "0", "AAA" ) , ( "1", "AAB" ) , ( "2", "ABA" ) , ( "3", "ABB" ) , ( "4", "BAA" ) , ( "5", "BAB" ) , ( "6", "BBA" ) , ( "7", "BBB" ) ] valuesC : List ( String, String ) valuesC = [] valuesD : List ( String, String ) valuesD = [] type alias Flags = {} type alias Model = { multiselectA : Multiselect.Model , multiselectB : Multiselect.Model , multiselectC : Multiselect.Model , multiselectD : Multiselect.Model , selectedA : List ( String, String ) } initModel : Model initModel = { multiselectA = Multiselect.initModel valuesA "A" , multiselectB = Multiselect.initModel valuesB "B" , multiselectC = Multiselect.initModel valuesC "C" , multiselectD = Multiselect.initModel valuesD "D" , selectedA = [] } init : Flags -> ( Model, Cmd Msg ) init flags = ( initModel, prepopulateValues ) -- UPDATE type Msg = NoOp | HOI Multiselect.Msg | Nyan Multiselect.Msg | Yay Multiselect.Msg | Tags Multiselect.Msg | SelectA | Prepopulate (Result Http.Error (List String)) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NoOp -> ( model, Cmd.none ) HOI sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectA in ( { model | multiselectA = subModel }, Cmd.map HOI subCmd ) Nyan sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectB in ( { model | multiselectB = subModel }, Cmd.map Nyan subCmd ) Yay sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectC newModel = { model | multiselectC = subModel } ( newerModel, outCommands ) = case outMsg of Just m -> updateOutMsg m newModel Nothing -> ( newModel, Cmd.none ) in ( newerModel, Cmd.batch [ Cmd.map Yay subCmd, outCommands ] ) Tags sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectD newModel = { model | multiselectD = subModel } ( newerModel, outCommands ) = case outMsg of Just m -> handleTag m newModel Nothing -> ( newModel, Cmd.none ) in ( newerModel, Cmd.batch [ Cmd.map Tags subCmd, outCommands ] ) SelectA -> ( { model | selectedA = Multiselect.getSelectedValues model.multiselectA }, Cmd.none ) Prepopulate (Ok vs) -> let multiselectModel = model.multiselectC values = List.map (\v -> ( v, v )) vs in ( { model | multiselectC = Multiselect.populateValues multiselectModel values [] }, Cmd.none ) Prepopulate (Err _) -> Debug.log "error" ( model, Cmd.none ) addTag : Multiselect.Model -> ( String, String ) -> ( Multiselect.Model, Cmd Msg ) addTag multiselectModel tag = let values = Multiselect.getValues multiselectModel selected = Multiselect.getSelectedValues multiselectModel alreadyExists = List.member tag values in if alreadyExists then ( multiselectModel, Cmd.none ) else Multiselect.populateValues multiselectModel (values ++ [ tag ]) (selected ++ [ tag ]) |> Multiselect.clearInputText |> (\( m, c ) -> ( m, Cmd.map Tags c )) handleTag : Multiselect.OutMsg -> Model -> ( Model, Cmd Msg ) handleTag msg model = case msg of Multiselect.NotFound v -> let _ = Debug.log "Received Not Found msg from Multiselect, value" v tag = ( v, v ) multiselectModel = model.multiselectD ( populated, cmd ) = addTag multiselectModel tag in ( { model | multiselectD = populated }, cmd ) _ -> ( model, Cmd.none ) updateOutMsg : Multiselect.OutMsg -> Model -> ( Model, Cmd Msg ) updateOutMsg msg model = case msg of Multiselect.Selected ( k, v ) -> let _ = ( Debug.log "Received Selected msg from Multiselect, key" k , Debug.log "value" v ) in ( model, Cmd.none ) Multiselect.Unselected ( k, v ) -> let _ = ( Debug.log "Received Unselected msg from Multiselect, key" k , Debug.log "value" v ) in ( model, Cmd.none ) Multiselect.Cleared -> let _ = Debug.log "Received Cleared msg from Multiselect" "" in ( model, Cmd.none ) Multiselect.NotFound v -> let _ = Debug.log "Received Not Found msg from Multiselect, value" v in ( model, Cmd.none ) -- VIEW view : Model -> Html Msg view model = div [] [ div [ Html.Attributes.class "wrapper" ] [ Html.header [] [ div [] [ Html.h1 [] [ text "elm-multiselect" ] , Html.p [] [ text "A multiselect control built with and for Elm" ] ] ] , div [ Html.Attributes.class "subheader" ] [ Html.a [ Html.Attributes.class "github-button" , Html.Attributes.href "https://github.com/inkuzmin/elm-multiselect" , Html.Attributes.attribute "data-size" "large" , Html.Attributes.attribute "data-show-count" "true" , Html.Attributes.attribute "aria-label" "Star inkuzmin/elm-multiselect on GitHub" ] [ text "Star" ] ] , div [ Html.Attributes.id "main" ] [ Html.h3 [] [ text "Submit on button click" ] , Html.map HOI <| Multiselect.view model.multiselectA , showSelected model.selectedA , Html.button [ Html.Attributes.class "btn", onClick SelectA ] [ text "Select!" ] , div [ Html.Attributes.style "height" "300px" ] [ text "" ] , Html.h3 [] [ text "Submit on select" ] , Html.map Nyan <| Multiselect.view model.multiselectB , showSelected (Multiselect.getSelectedValues model.multiselectB) , div [ Html.Attributes.style "height" "300px" ] [ text "" ] , Html.h3 [] [ text "Contributors (dynamic fetching of values)" ] , Html.map Yay <| Multiselect.view model.multiselectC , showSelected (Multiselect.getSelectedValues model.multiselectC) , div [ Html.Attributes.style "height" "300px" ] [ text "" ] , Html.h3 [] [ text "Tagging Example" ] , Html.map Tags <| Multiselect.view model.multiselectD , showSelected (Multiselect.getSelectedValues model.multiselectD) ] , div [ Html.Attributes.class "push" ] [] ] , Html.footer [] [ div [ Html.Attributes.class "acknowledgements" ] [ Html.a [ Html.Attributes.class "image unitartu", Html.Attributes.href "https://www.ut.ee/en" ] [ Html.img [ Html.Attributes.alt "Emblem of the University of Tartu", Html.Attributes.src "https://inkuzmin.github.io/logos/assets/unitartu.svg", Html.Attributes.width 100 ] [] ] , Html.a [ Html.Attributes.class "image biit", Html.Attributes.href "https://biit.cs.ut.ee/" ] [ Html.img [ Html.Attributes.alt "BIIT research group", Html.Attributes.src "https://inkuzmin.github.io/logos/assets/biit.svg", Html.Attributes.width 100 ] [] ] ] , div [ Html.Attributes.class "copy" ] [ Html.p [] [ text "© 2018 ", Html.a [ Html.Attributes.href "https://github.com/inkuzmin" ] [ text "<NAME>" ] ] ] ] ] showSelected : List ( String, String ) -> Html Msg showSelected values = Html.ul [] (List.map (\( name, value ) -> Html.li [] [ text value ]) values) -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions model = Sub.batch [ Sub.map HOI <| Multiselect.subscriptions model.multiselectA , Sub.map Nyan <| Multiselect.subscriptions model.multiselectB , Sub.map Yay <| Multiselect.subscriptions model.multiselectC ] -- HELPERS prepopulateValues : Cmd Msg prepopulateValues = let url = "https://api.github.com/repos/inkuzmin/elm-multiselect/contributors" request = Http.get url decodeUrl in Http.send Prepopulate request decodeUrl : Decode.Decoder (List String) decodeUrl = Decode.list (Decode.field "login" Decode.string)
true
module Main exposing (Flags, Model, Msg(..), addTag, decodeUrl, handleTag, init, initModel, main, prepopulateValues, showSelected, subscriptions, update, updateOutMsg, valuesA, valuesB, valuesC, valuesD, view) import Browser as Browser import Html exposing (Html, button, div, text) import Html.Attributes import Html.Events exposing (onClick) import Http as Http import Json.Decode as Decode import Multiselect main : Program Flags Model Msg main = Browser.document { init = init , view = \m -> { title = "Elm 0.19 starter" , body = [ view m ] } , update = update , subscriptions = subscriptions } -- MODEL valuesA : List ( String, String ) valuesA = [ ( "elixir-estonia", "ELIXIR Estonia" ) , ( "unitartu", "University of Tartu" ) , ( "cs", "Institute of Computer Science" ) , ( "biit", "BIIT" ) , ( "javascript", "JavaScript" ) , ( "elm", "Elm" ) , ( "multiselect", "Multiselect" ) , ( "haskell", "Haskell" ) , ( "elixir", "Elixir" ) , ( "clojure", "Clojure" ) , ( "shen", "Shen" ) ] valuesB : List ( String, String ) valuesB = [ ( "0", "AAA" ) , ( "1", "AAB" ) , ( "2", "ABA" ) , ( "3", "ABB" ) , ( "4", "BAA" ) , ( "5", "BAB" ) , ( "6", "BBA" ) , ( "7", "BBB" ) ] valuesC : List ( String, String ) valuesC = [] valuesD : List ( String, String ) valuesD = [] type alias Flags = {} type alias Model = { multiselectA : Multiselect.Model , multiselectB : Multiselect.Model , multiselectC : Multiselect.Model , multiselectD : Multiselect.Model , selectedA : List ( String, String ) } initModel : Model initModel = { multiselectA = Multiselect.initModel valuesA "A" , multiselectB = Multiselect.initModel valuesB "B" , multiselectC = Multiselect.initModel valuesC "C" , multiselectD = Multiselect.initModel valuesD "D" , selectedA = [] } init : Flags -> ( Model, Cmd Msg ) init flags = ( initModel, prepopulateValues ) -- UPDATE type Msg = NoOp | HOI Multiselect.Msg | Nyan Multiselect.Msg | Yay Multiselect.Msg | Tags Multiselect.Msg | SelectA | Prepopulate (Result Http.Error (List String)) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NoOp -> ( model, Cmd.none ) HOI sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectA in ( { model | multiselectA = subModel }, Cmd.map HOI subCmd ) Nyan sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectB in ( { model | multiselectB = subModel }, Cmd.map Nyan subCmd ) Yay sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectC newModel = { model | multiselectC = subModel } ( newerModel, outCommands ) = case outMsg of Just m -> updateOutMsg m newModel Nothing -> ( newModel, Cmd.none ) in ( newerModel, Cmd.batch [ Cmd.map Yay subCmd, outCommands ] ) Tags sub -> let ( subModel, subCmd, outMsg ) = Multiselect.update sub model.multiselectD newModel = { model | multiselectD = subModel } ( newerModel, outCommands ) = case outMsg of Just m -> handleTag m newModel Nothing -> ( newModel, Cmd.none ) in ( newerModel, Cmd.batch [ Cmd.map Tags subCmd, outCommands ] ) SelectA -> ( { model | selectedA = Multiselect.getSelectedValues model.multiselectA }, Cmd.none ) Prepopulate (Ok vs) -> let multiselectModel = model.multiselectC values = List.map (\v -> ( v, v )) vs in ( { model | multiselectC = Multiselect.populateValues multiselectModel values [] }, Cmd.none ) Prepopulate (Err _) -> Debug.log "error" ( model, Cmd.none ) addTag : Multiselect.Model -> ( String, String ) -> ( Multiselect.Model, Cmd Msg ) addTag multiselectModel tag = let values = Multiselect.getValues multiselectModel selected = Multiselect.getSelectedValues multiselectModel alreadyExists = List.member tag values in if alreadyExists then ( multiselectModel, Cmd.none ) else Multiselect.populateValues multiselectModel (values ++ [ tag ]) (selected ++ [ tag ]) |> Multiselect.clearInputText |> (\( m, c ) -> ( m, Cmd.map Tags c )) handleTag : Multiselect.OutMsg -> Model -> ( Model, Cmd Msg ) handleTag msg model = case msg of Multiselect.NotFound v -> let _ = Debug.log "Received Not Found msg from Multiselect, value" v tag = ( v, v ) multiselectModel = model.multiselectD ( populated, cmd ) = addTag multiselectModel tag in ( { model | multiselectD = populated }, cmd ) _ -> ( model, Cmd.none ) updateOutMsg : Multiselect.OutMsg -> Model -> ( Model, Cmd Msg ) updateOutMsg msg model = case msg of Multiselect.Selected ( k, v ) -> let _ = ( Debug.log "Received Selected msg from Multiselect, key" k , Debug.log "value" v ) in ( model, Cmd.none ) Multiselect.Unselected ( k, v ) -> let _ = ( Debug.log "Received Unselected msg from Multiselect, key" k , Debug.log "value" v ) in ( model, Cmd.none ) Multiselect.Cleared -> let _ = Debug.log "Received Cleared msg from Multiselect" "" in ( model, Cmd.none ) Multiselect.NotFound v -> let _ = Debug.log "Received Not Found msg from Multiselect, value" v in ( model, Cmd.none ) -- VIEW view : Model -> Html Msg view model = div [] [ div [ Html.Attributes.class "wrapper" ] [ Html.header [] [ div [] [ Html.h1 [] [ text "elm-multiselect" ] , Html.p [] [ text "A multiselect control built with and for Elm" ] ] ] , div [ Html.Attributes.class "subheader" ] [ Html.a [ Html.Attributes.class "github-button" , Html.Attributes.href "https://github.com/inkuzmin/elm-multiselect" , Html.Attributes.attribute "data-size" "large" , Html.Attributes.attribute "data-show-count" "true" , Html.Attributes.attribute "aria-label" "Star inkuzmin/elm-multiselect on GitHub" ] [ text "Star" ] ] , div [ Html.Attributes.id "main" ] [ Html.h3 [] [ text "Submit on button click" ] , Html.map HOI <| Multiselect.view model.multiselectA , showSelected model.selectedA , Html.button [ Html.Attributes.class "btn", onClick SelectA ] [ text "Select!" ] , div [ Html.Attributes.style "height" "300px" ] [ text "" ] , Html.h3 [] [ text "Submit on select" ] , Html.map Nyan <| Multiselect.view model.multiselectB , showSelected (Multiselect.getSelectedValues model.multiselectB) , div [ Html.Attributes.style "height" "300px" ] [ text "" ] , Html.h3 [] [ text "Contributors (dynamic fetching of values)" ] , Html.map Yay <| Multiselect.view model.multiselectC , showSelected (Multiselect.getSelectedValues model.multiselectC) , div [ Html.Attributes.style "height" "300px" ] [ text "" ] , Html.h3 [] [ text "Tagging Example" ] , Html.map Tags <| Multiselect.view model.multiselectD , showSelected (Multiselect.getSelectedValues model.multiselectD) ] , div [ Html.Attributes.class "push" ] [] ] , Html.footer [] [ div [ Html.Attributes.class "acknowledgements" ] [ Html.a [ Html.Attributes.class "image unitartu", Html.Attributes.href "https://www.ut.ee/en" ] [ Html.img [ Html.Attributes.alt "Emblem of the University of Tartu", Html.Attributes.src "https://inkuzmin.github.io/logos/assets/unitartu.svg", Html.Attributes.width 100 ] [] ] , Html.a [ Html.Attributes.class "image biit", Html.Attributes.href "https://biit.cs.ut.ee/" ] [ Html.img [ Html.Attributes.alt "BIIT research group", Html.Attributes.src "https://inkuzmin.github.io/logos/assets/biit.svg", Html.Attributes.width 100 ] [] ] ] , div [ Html.Attributes.class "copy" ] [ Html.p [] [ text "© 2018 ", Html.a [ Html.Attributes.href "https://github.com/inkuzmin" ] [ text "PI:NAME:<NAME>END_PI" ] ] ] ] ] showSelected : List ( String, String ) -> Html Msg showSelected values = Html.ul [] (List.map (\( name, value ) -> Html.li [] [ text value ]) values) -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions model = Sub.batch [ Sub.map HOI <| Multiselect.subscriptions model.multiselectA , Sub.map Nyan <| Multiselect.subscriptions model.multiselectB , Sub.map Yay <| Multiselect.subscriptions model.multiselectC ] -- HELPERS prepopulateValues : Cmd Msg prepopulateValues = let url = "https://api.github.com/repos/inkuzmin/elm-multiselect/contributors" request = Http.get url decodeUrl in Http.send Prepopulate request decodeUrl : Decode.Decoder (List String) decodeUrl = Decode.list (Decode.field "login" Decode.string)
elm
[ { "context": "by dillonkearns/elm-graphql\n-- https://github.com/dillonkearns/elm-graphql\n\n\nmodule Swapi.Enum.Phrase exposing (", "end": 119, "score": 0.9912624359, "start": 107, "tag": "USERNAME", "value": "dillonkearns" }, { "context": "y said by Obi-Wan\n - Faith - Originally said by Vader.\n - Father - Originally said by Vader.\n - Help ", "end": 398, "score": 0.5272910595, "start": 394, "tag": "NAME", "value": "ader" }, { "context": "inally said by Vader\n - Trap - Originally said by Admiral Ackbar\n - Try - Originally said by Yoda.\n\n-}\ntype Phras", "end": 601, "score": 0.9834150076, "start": 587, "tag": "NAME", "value": "Admiral Ackbar" } ]
examples/src/Swapi/Enum/Phrase.elm
teresy/elm-graphql
0
-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql -- https://github.com/dillonkearns/elm-graphql module Swapi.Enum.Phrase exposing (Phrase(..), decoder, toString) import Json.Decode as Decode exposing (Decoder) {-| Phrases for StarChat - BadFeeling - Originally said by Han Solo - Droids - Originally said by Obi-Wan - Faith - Originally said by Vader. - Father - Originally said by Vader. - Help - Originally said by Leia. - TheForce - Originally said by Obi-Wan. - Traitor - Originally said by Vader - Trap - Originally said by Admiral Ackbar - Try - Originally said by Yoda. -} type Phrase = BadFeeling | Droids | Faith | Father | Help | TheForce | Traitor | Trap | Try decoder : Decoder Phrase decoder = Decode.string |> Decode.andThen (\string -> case string of "BAD_FEELING" -> Decode.succeed BadFeeling "DROIDS" -> Decode.succeed Droids "FAITH" -> Decode.succeed Faith "FATHER" -> Decode.succeed Father "HELP" -> Decode.succeed Help "THE_FORCE" -> Decode.succeed TheForce "TRAITOR" -> Decode.succeed Traitor "TRAP" -> Decode.succeed Trap "TRY" -> Decode.succeed Try _ -> Decode.fail ("Invalid Phrase type, " ++ string ++ " try re-running the @dillonkearns/elm-graphql CLI ") ) {-| Convert from the union type representating the Enum to a string that the GraphQL server will recognize. -} toString : Phrase -> String toString enum = case enum of BadFeeling -> "BAD_FEELING" Droids -> "DROIDS" Faith -> "FAITH" Father -> "FATHER" Help -> "HELP" TheForce -> "THE_FORCE" Traitor -> "TRAITOR" Trap -> "TRAP" Try -> "TRY"
33532
-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql -- https://github.com/dillonkearns/elm-graphql module Swapi.Enum.Phrase exposing (Phrase(..), decoder, toString) import Json.Decode as Decode exposing (Decoder) {-| Phrases for StarChat - BadFeeling - Originally said by Han Solo - Droids - Originally said by Obi-Wan - Faith - Originally said by V<NAME>. - Father - Originally said by Vader. - Help - Originally said by Leia. - TheForce - Originally said by Obi-Wan. - Traitor - Originally said by Vader - Trap - Originally said by <NAME> - Try - Originally said by Yoda. -} type Phrase = BadFeeling | Droids | Faith | Father | Help | TheForce | Traitor | Trap | Try decoder : Decoder Phrase decoder = Decode.string |> Decode.andThen (\string -> case string of "BAD_FEELING" -> Decode.succeed BadFeeling "DROIDS" -> Decode.succeed Droids "FAITH" -> Decode.succeed Faith "FATHER" -> Decode.succeed Father "HELP" -> Decode.succeed Help "THE_FORCE" -> Decode.succeed TheForce "TRAITOR" -> Decode.succeed Traitor "TRAP" -> Decode.succeed Trap "TRY" -> Decode.succeed Try _ -> Decode.fail ("Invalid Phrase type, " ++ string ++ " try re-running the @dillonkearns/elm-graphql CLI ") ) {-| Convert from the union type representating the Enum to a string that the GraphQL server will recognize. -} toString : Phrase -> String toString enum = case enum of BadFeeling -> "BAD_FEELING" Droids -> "DROIDS" Faith -> "FAITH" Father -> "FATHER" Help -> "HELP" TheForce -> "THE_FORCE" Traitor -> "TRAITOR" Trap -> "TRAP" Try -> "TRY"
true
-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql -- https://github.com/dillonkearns/elm-graphql module Swapi.Enum.Phrase exposing (Phrase(..), decoder, toString) import Json.Decode as Decode exposing (Decoder) {-| Phrases for StarChat - BadFeeling - Originally said by Han Solo - Droids - Originally said by Obi-Wan - Faith - Originally said by VPI:NAME:<NAME>END_PI. - Father - Originally said by Vader. - Help - Originally said by Leia. - TheForce - Originally said by Obi-Wan. - Traitor - Originally said by Vader - Trap - Originally said by PI:NAME:<NAME>END_PI - Try - Originally said by Yoda. -} type Phrase = BadFeeling | Droids | Faith | Father | Help | TheForce | Traitor | Trap | Try decoder : Decoder Phrase decoder = Decode.string |> Decode.andThen (\string -> case string of "BAD_FEELING" -> Decode.succeed BadFeeling "DROIDS" -> Decode.succeed Droids "FAITH" -> Decode.succeed Faith "FATHER" -> Decode.succeed Father "HELP" -> Decode.succeed Help "THE_FORCE" -> Decode.succeed TheForce "TRAITOR" -> Decode.succeed Traitor "TRAP" -> Decode.succeed Trap "TRY" -> Decode.succeed Try _ -> Decode.fail ("Invalid Phrase type, " ++ string ++ " try re-running the @dillonkearns/elm-graphql CLI ") ) {-| Convert from the union type representating the Enum to a string that the GraphQL server will recognize. -} toString : Phrase -> String toString enum = case enum of BadFeeling -> "BAD_FEELING" Droids -> "DROIDS" Faith -> "FAITH" Father -> "FATHER" Help -> "HELP" TheForce -> "THE_FORCE" Traitor -> "TRAITOR" Trap -> "TRAP" Try -> "TRY"
elm
[ { "context": "-\n Single-step evaluation of Haskelite programs\n Pedro Vasconcelos, 2021\n-} \nmodule Eval exposing (..)\n\nimport AST e", "end": 69, "score": 0.9998630881, "start": 52, "tag": "NAME", "value": "Pedro Vasconcelos" } ]
src/Eval.elm
pbv/haskelite
0
{- Single-step evaluation of Haskelite programs Pedro Vasconcelos, 2021 -} module Eval exposing (..) import AST exposing (Expr(..), Pattern(..), Decl(..), Info(..), Name, Subst) import Pretty import Dict exposing (Dict) import Context exposing (Context) import Monocle.Optional as Monocle -- * semantics -- global function bindings type alias Binds = Dict AST.Name (List Alt) -- alternatives equations for a single function type alias Alt = (List Pattern, Expr) -- Semantics of primitive operations: a function from global -- definitions and the stack of arguments after unwinding to an -- optional expression; a result of Nothing means that the function -- does not reduce; the string is an human readable explanation for -- the reduction (either the equation employed or some primitive -- operation). -- This needs globals because primitives may force the evaluation -- of arguments. type alias Prim = Binds -> List Expr -> Maybe (Expr, Info) -- transform a list of declarations into a dictionary for functions collectBindings : List Decl -> Binds -> Binds collectBindings decls accum = case decls of [] -> accum (Equation fun ps e :: rest) -> let -- info = Pretty.prettyDecl (Equation fun ps e) (alts1,rest1) = collectAlts fun rest accum1 = Dict.insert fun ((ps,e)::alts1) accum in collectBindings rest1 accum1 (_ :: rest) -> collectBindings rest accum -- collect all contiguous equations for a given name collectAlts : Name -> List Decl -> (List Alt, List Decl) collectAlts fun decls = case decls of [] -> ([], []) (TypeSig _ _ :: rest) -> ([], rest) (Comment _ :: rest) -> collectAlts fun rest (Equation f ps e :: rest) -> if f==fun then let (alts, rest1) = collectAlts fun rest in ((ps,e)::alts, rest1) else ([], decls) -- built-in operations primitives : Dict AST.Name Prim primitives = Dict.fromList [ (":", consPrim) , ("+", arithOp "+" (+)) , ("-", arithOp "-" (-)) , ("*", arithOp "*" (*)) , ("div", arithOp "div" (//)) , ("mod", arithOp "mod" (\x y -> modBy y x)) , ("/=", compareOp "/=" (/=)) , ("==", compareOp "==" (==)) , (">=", compareOp ">=" (>=)) , ("<=", compareOp "<=" (<=)) , (">", compareOp ">" (>)) , ("<", compareOp "<" (<)) , ("enumFrom", enumFrom) , ("enumFromThen", enumFromThen) , ("enumFromTo", enumFromTo) , ("enumFromThenTo", enumFromThenTo) , ("negate", arithNeg) ] mkCons : Expr -> Expr -> Expr mkCons e1 e2 = App (Var ":") [e1,e2] consPrim : Binds -> List Expr -> Maybe (Expr, Info) consPrim global args = case args of [e1, ListLit l] -> Just (Eval (ListLit (e1::l)), Prim "constructor") [e1, TupleLit _] -> Just (Fail "type error", Prim "constructor") [e1, Boolean _] -> Just (Fail "type error", Prim "constructor") [e1, Number _] -> Just (Fail "type error", Prim "construtor") [e1, Lam _ _] -> Just (Fail "type error", Prim "construtor") _ -> Nothing arithNeg : Binds -> List Expr -> Maybe (Expr, Info) arithNeg globals args = case args of [Number x] -> Just (Eval (Number (-x)), Prim "negate") [arg1] -> if isWeakNormalForm arg1 then Just (Fail "type error: operator requires numbers" , Prim "negate") else redex globals arg1 |> Maybe.andThen (\(narg1,info) -> Just (App (Var "negate") [narg1] , info)) _ -> if List.length args > 2 then Just (Fail "type error: wrong number of arguments" ,Prim "negate") else Nothing arithOp : Name -> (Int -> Int -> Int) -> Binds -> List Expr -> Maybe (Expr, Info) arithOp op func globals args = case args of [Number x, Number y] -> Just (Eval (Number (func x y)), Prim op) [arg1, arg2] -> if isWeakNormalForm arg1 && isWeakNormalForm arg2 then Just (Fail "type error: operator requires numbers" , Prim op) else case redex globals arg1 of Just (narg1, info) -> Just (InfixOp op narg1 arg2, info) Nothing -> case redex globals arg2 of Just (narg2, info) -> Just (InfixOp op arg1 narg2, info) Nothing -> Nothing _ -> if List.length args > 2 then Just (Fail "type error: wrong number of arguments", Prim op) else Nothing -- simple comparisons for numbers only compareOp : Name -> (Int -> Int -> Bool) -> Binds -> List Expr -> Maybe (Expr,Info) compareOp op func globals args = case args of [Number x, Number y] -> Just (Eval (Boolean (func x y)), Prim op) [arg1, arg2] -> if isWeakNormalForm arg1 && isWeakNormalForm arg2 then Just (Fail "type error: operator requires numbers", Prim op) else case redex globals arg1 of Just (narg1, info) -> Just (InfixOp op narg1 arg2, info) Nothing -> case redex globals arg2 of Just (narg2, info) -> Just (InfixOp op arg1 narg2, info) Nothing -> Nothing _ -> if List.length args > 2 then Just (Fail "type error: wrong number of arguments", Prim op) else Nothing enumFrom : Binds -> List Expr -> Maybe (Expr, Info) enumFrom globals args = case args of [Number a] -> Just (Eval (mkCons (Number a) (App (Var "enumFrom") [Number (a+1)])) , Prim "enumeration" ) [e1] -> redex globals e1 |> Maybe.andThen (\(ne1,info) -> Just (App (Var "enumFrom") [ne1] , info)) _ -> Nothing enumFromThen : Binds -> List Expr -> Maybe (Expr, Info) enumFromThen globals args = case args of [Number a1, Number a2] -> let a3 = 2*a2 - a1 in Just (Eval (mkCons (Number a1) (App (Var "enumFromThen") [Number a2, Number a3])) , Prim "enumeration" ) [e1, e2] -> case redex globals e1 of Just (ne1,info) -> Just (App (Var "enumFromThen") [ne1,e2] , info) Nothing -> redex globals e2 |> Maybe.andThen (\(ne2,info) -> Just (App (Var "enumFromThen") [e1,ne2] , info)) _ -> Nothing enumFromTo : Binds -> List Expr -> Maybe (Expr, Info) enumFromTo globals args = case args of [Number a, Number b] -> Just (Eval (ListLit <| List.map Number <| ranged a b 1) , Prim "enumeration" ) [e1, e2] -> case redex globals e1 of Just (ne1,info) -> Just (App (Var "enumFromTo") [ne1,e2] , info) Nothing -> redex globals e2 |> Maybe.andThen (\(ne2,info) -> Just (App (Var "enumFromTo") [e1,ne2] , info)) _ -> Nothing enumFromThenTo : Binds -> List Expr -> Maybe (Expr, Info) enumFromThenTo globals args = case args of [Number a1, Number a2, Number b] -> Just (Eval (ListLit <| List.map Number <| ranged a1 b (a2-a1)) , Prim "enumeration" ) [e1, e2, e3] -> case redex globals e1 of Just (ne1,info) -> Just (App (Var "enumFromThenTo") [ne1,e2,e3] , info) Nothing -> case redex globals e2 of Just (ne2,info) -> Just (App (Var "enumFromThenTo") [e1,ne2,e3], info) Nothing -> redex globals e3 |> Maybe.andThen (\(ne3,info) -> Just (App (Var "enumFromThenTo") [e1,e2,ne3], info)) _ -> Nothing -- apply a function specifified by a list of alterantives -- to a list of arguments -- result is Nothing if the expression can't be reduced yet dispatchAlts : Binds -> Name -> List Alt -> List Expr -> Maybe (Expr, Info) dispatchAlts globals fun alts args = case alts of [] -> Just (Fail "pattern match failure", Prim "error") ((ps,e)::alts1) -> let nps = List.length ps nargs = List.length args in if nargs < nps then Nothing else let args1 = List.take nps args args2 = List.drop nps args in case patternEvalList globals ps args1 [] of Just (nargs1,info) -> let ne = applyArgs (makeApp fun nargs1) args2 in Just (ne, info) Nothing -> case matchingList ps args1 Dict.empty of Nothing -> dispatchAlts globals fun alts1 args Just s -> let ne = applyArgs (Eval (AST.applySubst s e)) args2 info = Rewrite (Equation fun ps e) in Just (ne, info) dispatchBeta : List Name -> Expr -> List Expr -> Maybe (Expr, Info) dispatchBeta vars body args = let nvars = List.length vars nargs = List.length args in if nargs < nvars then Nothing else let args1 = List.take nvars args args2 = List.drop nvars args s = Dict.fromList (List.map2 Tuple.pair vars args1) ne = applyArgs (Eval (AST.applySubst s body)) args2 info = Prim "beta reduction" in Just (ne, info) makeApp : Name -> List Expr -> Expr makeApp fun args = case args of [arg1, arg2] -> if Pretty.isOperator fun then InfixOp fun arg1 arg2 else App (Var fun) args _ -> App (Var fun) args -- perform the next single step reduction -- to evaluate an expression to weak head normal form redex : Binds -> Expr -> Maybe (Expr,Info) redex globals expr = case expr of Var x -> redex globals (App (Var x) []) App e1 es -> case unwindArgs e1 es of (Lam xs e0, args) -> dispatchBeta xs e0 args (Var fun, args) -> case Dict.get fun globals of Just alts -> dispatchAlts globals fun alts args Nothing -> case Dict.get fun primitives of Just prim -> prim globals args Nothing -> Just (Fail "undefined name" , Prim "application") _ -> Just (Fail "invalid function", Prim "application") InfixOp op e1 e2 -> redex globals (App (Var op) [e1, e2]) IfThenElse e1 e2 e3 -> case e1 of Boolean True -> Just (Eval e2, Prim "if-True") Boolean False -> Just (Eval e3, Prim "if-False") _ -> if isWeakNormalForm e1 then Just (Fail "type error", Prim "if") else redex globals e1 |> Maybe.andThen (\(ne1,info) -> Just (IfThenElse ne1 e2 e3,info)) Eval e1 -> redex globals e1 _ -> Nothing -- unwind nested applications in a stack of arguments unwindArgs : Expr -> List Expr -> (Expr, List Expr) unwindArgs e args = case e of (App e1 es) -> unwindArgs e1 (es++args) _ -> (e, args) -- reverse the unwound stack of arguments back into an application applyArgs : Expr -> List Expr -> Expr applyArgs e0 args = case args of [] -> e0 _ -> App e0 args -- perform pattern matching matching : Pattern -> Expr -> Subst -> Maybe Subst matching p e s = case p of (VarP x) -> Just (Dict.insert x e s) (BangP x) -> Just (Dict.insert x e s) (NumberP n) -> case e of Number m -> if n==m then Just s else Nothing _ -> Nothing (BooleanP b) -> case e of Boolean c -> if b==c then Just s else Nothing _ -> Nothing (ListP []) -> case e of ListLit [] -> Just s _ -> Nothing (ListP (p1::ps)) -> case e of ListLit (e1::es) -> matching p1 e1 s |> Maybe.andThen (matching (ListP ps) (ListLit es)) App (Var ":") [e1, e2] -> matching p1 e1 s |> Maybe.andThen (matching (ListP ps) e2) _ -> Nothing (TupleP ps) -> case e of TupleLit es -> matchingList ps es s _ -> Nothing (ConsP p1 p2) -> case e of (App (Var ":") [e1, e2]) -> matching p1 e1 s |> Maybe.andThen (matching p2 e2) (ListLit (e1::e2)) -> matching p1 e1 s |> Maybe.andThen (matching p2 (ListLit e2)) _ -> Nothing matchingList : List Pattern -> List Expr -> Subst -> Maybe Subst matchingList ps es s = case (ps, es) of (p1::ps1, e1::es1) -> matching p1 e1 s |> Maybe.andThen (\s1 -> matchingList ps1 es1 s1) ([], []) -> Just s _ -> Nothing -- -- check if a pattern performs evaluation of subexpression -- returns Just (newexpr, info) if it forces the evaluation -- or Nothing otherwise -- patternEval : Binds -> Pattern -> Expr -> Maybe (Expr, Info) patternEval globals p e = case (p, e) of (VarP _, _) -> Nothing (NumberP _, Number _) -> Nothing (BooleanP _, Boolean _) -> Nothing (TupleP ps, TupleLit es) -> patternEvalList globals ps es [] |> Maybe.andThen (\(nes, info) -> Just (TupleLit nes, info)) (ListP ps, ListLit es) -> patternEvalList globals ps es [] |> Maybe.andThen (\(nes,info) -> Just (ListLit nes, info)) (ListP [], App (Var ":") _) -> Nothing (ListP (p1::ps), App (Var ":") [e1, e2]) -> case patternEval globals p1 e1 of Just (ne1,info) -> Just (App (Var ":") [ne1, e2], info) Nothing -> patternEval globals (ListP ps) e2 |> Maybe.andThen (\(ne2,info) -> Just (App (Var ":") [e1, ne2],info)) (ConsP p1 p2, ListLit []) -> Nothing (ConsP p1 p2, ListLit (e1::rest)) -> case patternEval globals p1 e1 of Just (ne1,info) -> Just (ListLit (ne1::rest),info) Nothing -> patternEval globals p2 (ListLit rest) |> Maybe.andThen (\(nrest_,info) -> case nrest_ of ListLit nrest -> Just (ListLit (e1::nrest), info) _ -> Nothing) (_, _) -> redex globals e patternEvalList : Binds -> List Pattern -> List Expr -> List Expr -> Maybe (List Expr,Info) patternEvalList globals patts exprs accum = case (patts, exprs) of (p1::ps, e1::es) -> case patternEval globals p1 e1 of Just (ne1,info) -> Just (List.reverse accum ++ (ne1::es), info) Nothing -> patternEvalList globals ps es (e1::accum) (_, _) -> Nothing -- * perform a single reduction under a context redexCtx : Binds -> Expr -> Context -> Maybe (Expr,Info) redexCtx functions expr ctx = ctx.getOption expr |> Maybe.andThen (\subexpr -> redex functions subexpr |> Maybe.andThen (\result -> case result of (Fail err, info) -> Just (Fail err, info) (new,info) -> Just (ctx.set new expr, info))) -- locate the next outermost-leftmost redex -- to evaluate an expression to head normal form; -- does not evaluate under lambdas or if branches outermostRedex : Binds -> Expr -> Maybe Context outermostRedex globals expr = case redex globals expr of Just _ -> Just Context.hole Nothing -> outermostRedexAux globals expr outermostRedexAux : Binds -> Expr -> Maybe Context outermostRedexAux globals expr = case expr of (App (Var ":") [e0, e1]) -> case outermostRedex globals e0 of Just ctx -> Just (Monocle.compose Context.cons0 ctx) Nothing -> case outermostRedex globals e1 of Just ctx -> Just (Monocle.compose Context.cons1 ctx) Nothing -> Nothing (TupleLit items) -> outermostRedexArgs globals Context.tupleItem items 0 (ListLit items) -> outermostRedexArgs globals Context.listItem items 0 (IfThenElse e0 e1 e2) -> case outermostRedex globals e0 of Just ctx -> Just (Monocle.compose Context.if0 ctx) Nothing -> Nothing _ -> Nothing -- * try to reduce some argument by left to right order outermostRedexArgs : Binds -> (Int -> Context) -> List Expr -> Int -> Maybe Context outermostRedexArgs functions proj args i = case args of (arg::rest) -> case outermostRedex functions arg of Just ctx -> Just (Monocle.compose (proj i) ctx) Nothing -> outermostRedexArgs functions proj rest (i+1) [] -> Nothing reduceNext : Binds -> Expr -> Maybe (Expr,Info) reduceNext globals expr = let expr1 = AST.uneval expr in outermostRedex globals expr1 |> Maybe.andThen (\ctx -> redexCtx globals expr1 ctx) isNormalForm : Binds -> Expr -> Bool isNormalForm functions expr = case reduceNext functions expr of Just _ -> False Nothing -> True reduceFull : Binds -> Expr -> Maybe (Expr, Info) reduceFull globals expr = reduceNext globals expr |> Maybe.andThen (\(expr1,_) -> Just (reduceFullAux globals expr1, Prim "...")) reduceFullAux : Binds -> Expr -> Expr reduceFullAux globals expr = case reduceNext globals expr of Just (expr1,_) -> reduceFullAux globals expr1 Nothing -> expr -- check if an expression is a weak normal form isWeakNormalForm : Expr -> Bool isWeakNormalForm expr = case expr of App (Var ":") _ -> True App _ _ -> False Lam _ _ -> True Var _ -> False Number _ -> True Boolean _ -> True ListLit _ -> True TupleLit _ -> True _ -> False -- like List.range but with a variable step (delta) ranged : Int -> Int -> Int -> List Int ranged a b delta = if delta>0 then rangedUp a b delta else if delta<0 then rangedDown a b delta else [] rangedUp a b delta = if a <= b then a :: rangedUp (a+delta) b delta else [] rangedDown a b delta = if a >= b then a :: rangedDown (a+delta) b delta else []
58845
{- Single-step evaluation of Haskelite programs <NAME>, 2021 -} module Eval exposing (..) import AST exposing (Expr(..), Pattern(..), Decl(..), Info(..), Name, Subst) import Pretty import Dict exposing (Dict) import Context exposing (Context) import Monocle.Optional as Monocle -- * semantics -- global function bindings type alias Binds = Dict AST.Name (List Alt) -- alternatives equations for a single function type alias Alt = (List Pattern, Expr) -- Semantics of primitive operations: a function from global -- definitions and the stack of arguments after unwinding to an -- optional expression; a result of Nothing means that the function -- does not reduce; the string is an human readable explanation for -- the reduction (either the equation employed or some primitive -- operation). -- This needs globals because primitives may force the evaluation -- of arguments. type alias Prim = Binds -> List Expr -> Maybe (Expr, Info) -- transform a list of declarations into a dictionary for functions collectBindings : List Decl -> Binds -> Binds collectBindings decls accum = case decls of [] -> accum (Equation fun ps e :: rest) -> let -- info = Pretty.prettyDecl (Equation fun ps e) (alts1,rest1) = collectAlts fun rest accum1 = Dict.insert fun ((ps,e)::alts1) accum in collectBindings rest1 accum1 (_ :: rest) -> collectBindings rest accum -- collect all contiguous equations for a given name collectAlts : Name -> List Decl -> (List Alt, List Decl) collectAlts fun decls = case decls of [] -> ([], []) (TypeSig _ _ :: rest) -> ([], rest) (Comment _ :: rest) -> collectAlts fun rest (Equation f ps e :: rest) -> if f==fun then let (alts, rest1) = collectAlts fun rest in ((ps,e)::alts, rest1) else ([], decls) -- built-in operations primitives : Dict AST.Name Prim primitives = Dict.fromList [ (":", consPrim) , ("+", arithOp "+" (+)) , ("-", arithOp "-" (-)) , ("*", arithOp "*" (*)) , ("div", arithOp "div" (//)) , ("mod", arithOp "mod" (\x y -> modBy y x)) , ("/=", compareOp "/=" (/=)) , ("==", compareOp "==" (==)) , (">=", compareOp ">=" (>=)) , ("<=", compareOp "<=" (<=)) , (">", compareOp ">" (>)) , ("<", compareOp "<" (<)) , ("enumFrom", enumFrom) , ("enumFromThen", enumFromThen) , ("enumFromTo", enumFromTo) , ("enumFromThenTo", enumFromThenTo) , ("negate", arithNeg) ] mkCons : Expr -> Expr -> Expr mkCons e1 e2 = App (Var ":") [e1,e2] consPrim : Binds -> List Expr -> Maybe (Expr, Info) consPrim global args = case args of [e1, ListLit l] -> Just (Eval (ListLit (e1::l)), Prim "constructor") [e1, TupleLit _] -> Just (Fail "type error", Prim "constructor") [e1, Boolean _] -> Just (Fail "type error", Prim "constructor") [e1, Number _] -> Just (Fail "type error", Prim "construtor") [e1, Lam _ _] -> Just (Fail "type error", Prim "construtor") _ -> Nothing arithNeg : Binds -> List Expr -> Maybe (Expr, Info) arithNeg globals args = case args of [Number x] -> Just (Eval (Number (-x)), Prim "negate") [arg1] -> if isWeakNormalForm arg1 then Just (Fail "type error: operator requires numbers" , Prim "negate") else redex globals arg1 |> Maybe.andThen (\(narg1,info) -> Just (App (Var "negate") [narg1] , info)) _ -> if List.length args > 2 then Just (Fail "type error: wrong number of arguments" ,Prim "negate") else Nothing arithOp : Name -> (Int -> Int -> Int) -> Binds -> List Expr -> Maybe (Expr, Info) arithOp op func globals args = case args of [Number x, Number y] -> Just (Eval (Number (func x y)), Prim op) [arg1, arg2] -> if isWeakNormalForm arg1 && isWeakNormalForm arg2 then Just (Fail "type error: operator requires numbers" , Prim op) else case redex globals arg1 of Just (narg1, info) -> Just (InfixOp op narg1 arg2, info) Nothing -> case redex globals arg2 of Just (narg2, info) -> Just (InfixOp op arg1 narg2, info) Nothing -> Nothing _ -> if List.length args > 2 then Just (Fail "type error: wrong number of arguments", Prim op) else Nothing -- simple comparisons for numbers only compareOp : Name -> (Int -> Int -> Bool) -> Binds -> List Expr -> Maybe (Expr,Info) compareOp op func globals args = case args of [Number x, Number y] -> Just (Eval (Boolean (func x y)), Prim op) [arg1, arg2] -> if isWeakNormalForm arg1 && isWeakNormalForm arg2 then Just (Fail "type error: operator requires numbers", Prim op) else case redex globals arg1 of Just (narg1, info) -> Just (InfixOp op narg1 arg2, info) Nothing -> case redex globals arg2 of Just (narg2, info) -> Just (InfixOp op arg1 narg2, info) Nothing -> Nothing _ -> if List.length args > 2 then Just (Fail "type error: wrong number of arguments", Prim op) else Nothing enumFrom : Binds -> List Expr -> Maybe (Expr, Info) enumFrom globals args = case args of [Number a] -> Just (Eval (mkCons (Number a) (App (Var "enumFrom") [Number (a+1)])) , Prim "enumeration" ) [e1] -> redex globals e1 |> Maybe.andThen (\(ne1,info) -> Just (App (Var "enumFrom") [ne1] , info)) _ -> Nothing enumFromThen : Binds -> List Expr -> Maybe (Expr, Info) enumFromThen globals args = case args of [Number a1, Number a2] -> let a3 = 2*a2 - a1 in Just (Eval (mkCons (Number a1) (App (Var "enumFromThen") [Number a2, Number a3])) , Prim "enumeration" ) [e1, e2] -> case redex globals e1 of Just (ne1,info) -> Just (App (Var "enumFromThen") [ne1,e2] , info) Nothing -> redex globals e2 |> Maybe.andThen (\(ne2,info) -> Just (App (Var "enumFromThen") [e1,ne2] , info)) _ -> Nothing enumFromTo : Binds -> List Expr -> Maybe (Expr, Info) enumFromTo globals args = case args of [Number a, Number b] -> Just (Eval (ListLit <| List.map Number <| ranged a b 1) , Prim "enumeration" ) [e1, e2] -> case redex globals e1 of Just (ne1,info) -> Just (App (Var "enumFromTo") [ne1,e2] , info) Nothing -> redex globals e2 |> Maybe.andThen (\(ne2,info) -> Just (App (Var "enumFromTo") [e1,ne2] , info)) _ -> Nothing enumFromThenTo : Binds -> List Expr -> Maybe (Expr, Info) enumFromThenTo globals args = case args of [Number a1, Number a2, Number b] -> Just (Eval (ListLit <| List.map Number <| ranged a1 b (a2-a1)) , Prim "enumeration" ) [e1, e2, e3] -> case redex globals e1 of Just (ne1,info) -> Just (App (Var "enumFromThenTo") [ne1,e2,e3] , info) Nothing -> case redex globals e2 of Just (ne2,info) -> Just (App (Var "enumFromThenTo") [e1,ne2,e3], info) Nothing -> redex globals e3 |> Maybe.andThen (\(ne3,info) -> Just (App (Var "enumFromThenTo") [e1,e2,ne3], info)) _ -> Nothing -- apply a function specifified by a list of alterantives -- to a list of arguments -- result is Nothing if the expression can't be reduced yet dispatchAlts : Binds -> Name -> List Alt -> List Expr -> Maybe (Expr, Info) dispatchAlts globals fun alts args = case alts of [] -> Just (Fail "pattern match failure", Prim "error") ((ps,e)::alts1) -> let nps = List.length ps nargs = List.length args in if nargs < nps then Nothing else let args1 = List.take nps args args2 = List.drop nps args in case patternEvalList globals ps args1 [] of Just (nargs1,info) -> let ne = applyArgs (makeApp fun nargs1) args2 in Just (ne, info) Nothing -> case matchingList ps args1 Dict.empty of Nothing -> dispatchAlts globals fun alts1 args Just s -> let ne = applyArgs (Eval (AST.applySubst s e)) args2 info = Rewrite (Equation fun ps e) in Just (ne, info) dispatchBeta : List Name -> Expr -> List Expr -> Maybe (Expr, Info) dispatchBeta vars body args = let nvars = List.length vars nargs = List.length args in if nargs < nvars then Nothing else let args1 = List.take nvars args args2 = List.drop nvars args s = Dict.fromList (List.map2 Tuple.pair vars args1) ne = applyArgs (Eval (AST.applySubst s body)) args2 info = Prim "beta reduction" in Just (ne, info) makeApp : Name -> List Expr -> Expr makeApp fun args = case args of [arg1, arg2] -> if Pretty.isOperator fun then InfixOp fun arg1 arg2 else App (Var fun) args _ -> App (Var fun) args -- perform the next single step reduction -- to evaluate an expression to weak head normal form redex : Binds -> Expr -> Maybe (Expr,Info) redex globals expr = case expr of Var x -> redex globals (App (Var x) []) App e1 es -> case unwindArgs e1 es of (Lam xs e0, args) -> dispatchBeta xs e0 args (Var fun, args) -> case Dict.get fun globals of Just alts -> dispatchAlts globals fun alts args Nothing -> case Dict.get fun primitives of Just prim -> prim globals args Nothing -> Just (Fail "undefined name" , Prim "application") _ -> Just (Fail "invalid function", Prim "application") InfixOp op e1 e2 -> redex globals (App (Var op) [e1, e2]) IfThenElse e1 e2 e3 -> case e1 of Boolean True -> Just (Eval e2, Prim "if-True") Boolean False -> Just (Eval e3, Prim "if-False") _ -> if isWeakNormalForm e1 then Just (Fail "type error", Prim "if") else redex globals e1 |> Maybe.andThen (\(ne1,info) -> Just (IfThenElse ne1 e2 e3,info)) Eval e1 -> redex globals e1 _ -> Nothing -- unwind nested applications in a stack of arguments unwindArgs : Expr -> List Expr -> (Expr, List Expr) unwindArgs e args = case e of (App e1 es) -> unwindArgs e1 (es++args) _ -> (e, args) -- reverse the unwound stack of arguments back into an application applyArgs : Expr -> List Expr -> Expr applyArgs e0 args = case args of [] -> e0 _ -> App e0 args -- perform pattern matching matching : Pattern -> Expr -> Subst -> Maybe Subst matching p e s = case p of (VarP x) -> Just (Dict.insert x e s) (BangP x) -> Just (Dict.insert x e s) (NumberP n) -> case e of Number m -> if n==m then Just s else Nothing _ -> Nothing (BooleanP b) -> case e of Boolean c -> if b==c then Just s else Nothing _ -> Nothing (ListP []) -> case e of ListLit [] -> Just s _ -> Nothing (ListP (p1::ps)) -> case e of ListLit (e1::es) -> matching p1 e1 s |> Maybe.andThen (matching (ListP ps) (ListLit es)) App (Var ":") [e1, e2] -> matching p1 e1 s |> Maybe.andThen (matching (ListP ps) e2) _ -> Nothing (TupleP ps) -> case e of TupleLit es -> matchingList ps es s _ -> Nothing (ConsP p1 p2) -> case e of (App (Var ":") [e1, e2]) -> matching p1 e1 s |> Maybe.andThen (matching p2 e2) (ListLit (e1::e2)) -> matching p1 e1 s |> Maybe.andThen (matching p2 (ListLit e2)) _ -> Nothing matchingList : List Pattern -> List Expr -> Subst -> Maybe Subst matchingList ps es s = case (ps, es) of (p1::ps1, e1::es1) -> matching p1 e1 s |> Maybe.andThen (\s1 -> matchingList ps1 es1 s1) ([], []) -> Just s _ -> Nothing -- -- check if a pattern performs evaluation of subexpression -- returns Just (newexpr, info) if it forces the evaluation -- or Nothing otherwise -- patternEval : Binds -> Pattern -> Expr -> Maybe (Expr, Info) patternEval globals p e = case (p, e) of (VarP _, _) -> Nothing (NumberP _, Number _) -> Nothing (BooleanP _, Boolean _) -> Nothing (TupleP ps, TupleLit es) -> patternEvalList globals ps es [] |> Maybe.andThen (\(nes, info) -> Just (TupleLit nes, info)) (ListP ps, ListLit es) -> patternEvalList globals ps es [] |> Maybe.andThen (\(nes,info) -> Just (ListLit nes, info)) (ListP [], App (Var ":") _) -> Nothing (ListP (p1::ps), App (Var ":") [e1, e2]) -> case patternEval globals p1 e1 of Just (ne1,info) -> Just (App (Var ":") [ne1, e2], info) Nothing -> patternEval globals (ListP ps) e2 |> Maybe.andThen (\(ne2,info) -> Just (App (Var ":") [e1, ne2],info)) (ConsP p1 p2, ListLit []) -> Nothing (ConsP p1 p2, ListLit (e1::rest)) -> case patternEval globals p1 e1 of Just (ne1,info) -> Just (ListLit (ne1::rest),info) Nothing -> patternEval globals p2 (ListLit rest) |> Maybe.andThen (\(nrest_,info) -> case nrest_ of ListLit nrest -> Just (ListLit (e1::nrest), info) _ -> Nothing) (_, _) -> redex globals e patternEvalList : Binds -> List Pattern -> List Expr -> List Expr -> Maybe (List Expr,Info) patternEvalList globals patts exprs accum = case (patts, exprs) of (p1::ps, e1::es) -> case patternEval globals p1 e1 of Just (ne1,info) -> Just (List.reverse accum ++ (ne1::es), info) Nothing -> patternEvalList globals ps es (e1::accum) (_, _) -> Nothing -- * perform a single reduction under a context redexCtx : Binds -> Expr -> Context -> Maybe (Expr,Info) redexCtx functions expr ctx = ctx.getOption expr |> Maybe.andThen (\subexpr -> redex functions subexpr |> Maybe.andThen (\result -> case result of (Fail err, info) -> Just (Fail err, info) (new,info) -> Just (ctx.set new expr, info))) -- locate the next outermost-leftmost redex -- to evaluate an expression to head normal form; -- does not evaluate under lambdas or if branches outermostRedex : Binds -> Expr -> Maybe Context outermostRedex globals expr = case redex globals expr of Just _ -> Just Context.hole Nothing -> outermostRedexAux globals expr outermostRedexAux : Binds -> Expr -> Maybe Context outermostRedexAux globals expr = case expr of (App (Var ":") [e0, e1]) -> case outermostRedex globals e0 of Just ctx -> Just (Monocle.compose Context.cons0 ctx) Nothing -> case outermostRedex globals e1 of Just ctx -> Just (Monocle.compose Context.cons1 ctx) Nothing -> Nothing (TupleLit items) -> outermostRedexArgs globals Context.tupleItem items 0 (ListLit items) -> outermostRedexArgs globals Context.listItem items 0 (IfThenElse e0 e1 e2) -> case outermostRedex globals e0 of Just ctx -> Just (Monocle.compose Context.if0 ctx) Nothing -> Nothing _ -> Nothing -- * try to reduce some argument by left to right order outermostRedexArgs : Binds -> (Int -> Context) -> List Expr -> Int -> Maybe Context outermostRedexArgs functions proj args i = case args of (arg::rest) -> case outermostRedex functions arg of Just ctx -> Just (Monocle.compose (proj i) ctx) Nothing -> outermostRedexArgs functions proj rest (i+1) [] -> Nothing reduceNext : Binds -> Expr -> Maybe (Expr,Info) reduceNext globals expr = let expr1 = AST.uneval expr in outermostRedex globals expr1 |> Maybe.andThen (\ctx -> redexCtx globals expr1 ctx) isNormalForm : Binds -> Expr -> Bool isNormalForm functions expr = case reduceNext functions expr of Just _ -> False Nothing -> True reduceFull : Binds -> Expr -> Maybe (Expr, Info) reduceFull globals expr = reduceNext globals expr |> Maybe.andThen (\(expr1,_) -> Just (reduceFullAux globals expr1, Prim "...")) reduceFullAux : Binds -> Expr -> Expr reduceFullAux globals expr = case reduceNext globals expr of Just (expr1,_) -> reduceFullAux globals expr1 Nothing -> expr -- check if an expression is a weak normal form isWeakNormalForm : Expr -> Bool isWeakNormalForm expr = case expr of App (Var ":") _ -> True App _ _ -> False Lam _ _ -> True Var _ -> False Number _ -> True Boolean _ -> True ListLit _ -> True TupleLit _ -> True _ -> False -- like List.range but with a variable step (delta) ranged : Int -> Int -> Int -> List Int ranged a b delta = if delta>0 then rangedUp a b delta else if delta<0 then rangedDown a b delta else [] rangedUp a b delta = if a <= b then a :: rangedUp (a+delta) b delta else [] rangedDown a b delta = if a >= b then a :: rangedDown (a+delta) b delta else []
true
{- Single-step evaluation of Haskelite programs PI:NAME:<NAME>END_PI, 2021 -} module Eval exposing (..) import AST exposing (Expr(..), Pattern(..), Decl(..), Info(..), Name, Subst) import Pretty import Dict exposing (Dict) import Context exposing (Context) import Monocle.Optional as Monocle -- * semantics -- global function bindings type alias Binds = Dict AST.Name (List Alt) -- alternatives equations for a single function type alias Alt = (List Pattern, Expr) -- Semantics of primitive operations: a function from global -- definitions and the stack of arguments after unwinding to an -- optional expression; a result of Nothing means that the function -- does not reduce; the string is an human readable explanation for -- the reduction (either the equation employed or some primitive -- operation). -- This needs globals because primitives may force the evaluation -- of arguments. type alias Prim = Binds -> List Expr -> Maybe (Expr, Info) -- transform a list of declarations into a dictionary for functions collectBindings : List Decl -> Binds -> Binds collectBindings decls accum = case decls of [] -> accum (Equation fun ps e :: rest) -> let -- info = Pretty.prettyDecl (Equation fun ps e) (alts1,rest1) = collectAlts fun rest accum1 = Dict.insert fun ((ps,e)::alts1) accum in collectBindings rest1 accum1 (_ :: rest) -> collectBindings rest accum -- collect all contiguous equations for a given name collectAlts : Name -> List Decl -> (List Alt, List Decl) collectAlts fun decls = case decls of [] -> ([], []) (TypeSig _ _ :: rest) -> ([], rest) (Comment _ :: rest) -> collectAlts fun rest (Equation f ps e :: rest) -> if f==fun then let (alts, rest1) = collectAlts fun rest in ((ps,e)::alts, rest1) else ([], decls) -- built-in operations primitives : Dict AST.Name Prim primitives = Dict.fromList [ (":", consPrim) , ("+", arithOp "+" (+)) , ("-", arithOp "-" (-)) , ("*", arithOp "*" (*)) , ("div", arithOp "div" (//)) , ("mod", arithOp "mod" (\x y -> modBy y x)) , ("/=", compareOp "/=" (/=)) , ("==", compareOp "==" (==)) , (">=", compareOp ">=" (>=)) , ("<=", compareOp "<=" (<=)) , (">", compareOp ">" (>)) , ("<", compareOp "<" (<)) , ("enumFrom", enumFrom) , ("enumFromThen", enumFromThen) , ("enumFromTo", enumFromTo) , ("enumFromThenTo", enumFromThenTo) , ("negate", arithNeg) ] mkCons : Expr -> Expr -> Expr mkCons e1 e2 = App (Var ":") [e1,e2] consPrim : Binds -> List Expr -> Maybe (Expr, Info) consPrim global args = case args of [e1, ListLit l] -> Just (Eval (ListLit (e1::l)), Prim "constructor") [e1, TupleLit _] -> Just (Fail "type error", Prim "constructor") [e1, Boolean _] -> Just (Fail "type error", Prim "constructor") [e1, Number _] -> Just (Fail "type error", Prim "construtor") [e1, Lam _ _] -> Just (Fail "type error", Prim "construtor") _ -> Nothing arithNeg : Binds -> List Expr -> Maybe (Expr, Info) arithNeg globals args = case args of [Number x] -> Just (Eval (Number (-x)), Prim "negate") [arg1] -> if isWeakNormalForm arg1 then Just (Fail "type error: operator requires numbers" , Prim "negate") else redex globals arg1 |> Maybe.andThen (\(narg1,info) -> Just (App (Var "negate") [narg1] , info)) _ -> if List.length args > 2 then Just (Fail "type error: wrong number of arguments" ,Prim "negate") else Nothing arithOp : Name -> (Int -> Int -> Int) -> Binds -> List Expr -> Maybe (Expr, Info) arithOp op func globals args = case args of [Number x, Number y] -> Just (Eval (Number (func x y)), Prim op) [arg1, arg2] -> if isWeakNormalForm arg1 && isWeakNormalForm arg2 then Just (Fail "type error: operator requires numbers" , Prim op) else case redex globals arg1 of Just (narg1, info) -> Just (InfixOp op narg1 arg2, info) Nothing -> case redex globals arg2 of Just (narg2, info) -> Just (InfixOp op arg1 narg2, info) Nothing -> Nothing _ -> if List.length args > 2 then Just (Fail "type error: wrong number of arguments", Prim op) else Nothing -- simple comparisons for numbers only compareOp : Name -> (Int -> Int -> Bool) -> Binds -> List Expr -> Maybe (Expr,Info) compareOp op func globals args = case args of [Number x, Number y] -> Just (Eval (Boolean (func x y)), Prim op) [arg1, arg2] -> if isWeakNormalForm arg1 && isWeakNormalForm arg2 then Just (Fail "type error: operator requires numbers", Prim op) else case redex globals arg1 of Just (narg1, info) -> Just (InfixOp op narg1 arg2, info) Nothing -> case redex globals arg2 of Just (narg2, info) -> Just (InfixOp op arg1 narg2, info) Nothing -> Nothing _ -> if List.length args > 2 then Just (Fail "type error: wrong number of arguments", Prim op) else Nothing enumFrom : Binds -> List Expr -> Maybe (Expr, Info) enumFrom globals args = case args of [Number a] -> Just (Eval (mkCons (Number a) (App (Var "enumFrom") [Number (a+1)])) , Prim "enumeration" ) [e1] -> redex globals e1 |> Maybe.andThen (\(ne1,info) -> Just (App (Var "enumFrom") [ne1] , info)) _ -> Nothing enumFromThen : Binds -> List Expr -> Maybe (Expr, Info) enumFromThen globals args = case args of [Number a1, Number a2] -> let a3 = 2*a2 - a1 in Just (Eval (mkCons (Number a1) (App (Var "enumFromThen") [Number a2, Number a3])) , Prim "enumeration" ) [e1, e2] -> case redex globals e1 of Just (ne1,info) -> Just (App (Var "enumFromThen") [ne1,e2] , info) Nothing -> redex globals e2 |> Maybe.andThen (\(ne2,info) -> Just (App (Var "enumFromThen") [e1,ne2] , info)) _ -> Nothing enumFromTo : Binds -> List Expr -> Maybe (Expr, Info) enumFromTo globals args = case args of [Number a, Number b] -> Just (Eval (ListLit <| List.map Number <| ranged a b 1) , Prim "enumeration" ) [e1, e2] -> case redex globals e1 of Just (ne1,info) -> Just (App (Var "enumFromTo") [ne1,e2] , info) Nothing -> redex globals e2 |> Maybe.andThen (\(ne2,info) -> Just (App (Var "enumFromTo") [e1,ne2] , info)) _ -> Nothing enumFromThenTo : Binds -> List Expr -> Maybe (Expr, Info) enumFromThenTo globals args = case args of [Number a1, Number a2, Number b] -> Just (Eval (ListLit <| List.map Number <| ranged a1 b (a2-a1)) , Prim "enumeration" ) [e1, e2, e3] -> case redex globals e1 of Just (ne1,info) -> Just (App (Var "enumFromThenTo") [ne1,e2,e3] , info) Nothing -> case redex globals e2 of Just (ne2,info) -> Just (App (Var "enumFromThenTo") [e1,ne2,e3], info) Nothing -> redex globals e3 |> Maybe.andThen (\(ne3,info) -> Just (App (Var "enumFromThenTo") [e1,e2,ne3], info)) _ -> Nothing -- apply a function specifified by a list of alterantives -- to a list of arguments -- result is Nothing if the expression can't be reduced yet dispatchAlts : Binds -> Name -> List Alt -> List Expr -> Maybe (Expr, Info) dispatchAlts globals fun alts args = case alts of [] -> Just (Fail "pattern match failure", Prim "error") ((ps,e)::alts1) -> let nps = List.length ps nargs = List.length args in if nargs < nps then Nothing else let args1 = List.take nps args args2 = List.drop nps args in case patternEvalList globals ps args1 [] of Just (nargs1,info) -> let ne = applyArgs (makeApp fun nargs1) args2 in Just (ne, info) Nothing -> case matchingList ps args1 Dict.empty of Nothing -> dispatchAlts globals fun alts1 args Just s -> let ne = applyArgs (Eval (AST.applySubst s e)) args2 info = Rewrite (Equation fun ps e) in Just (ne, info) dispatchBeta : List Name -> Expr -> List Expr -> Maybe (Expr, Info) dispatchBeta vars body args = let nvars = List.length vars nargs = List.length args in if nargs < nvars then Nothing else let args1 = List.take nvars args args2 = List.drop nvars args s = Dict.fromList (List.map2 Tuple.pair vars args1) ne = applyArgs (Eval (AST.applySubst s body)) args2 info = Prim "beta reduction" in Just (ne, info) makeApp : Name -> List Expr -> Expr makeApp fun args = case args of [arg1, arg2] -> if Pretty.isOperator fun then InfixOp fun arg1 arg2 else App (Var fun) args _ -> App (Var fun) args -- perform the next single step reduction -- to evaluate an expression to weak head normal form redex : Binds -> Expr -> Maybe (Expr,Info) redex globals expr = case expr of Var x -> redex globals (App (Var x) []) App e1 es -> case unwindArgs e1 es of (Lam xs e0, args) -> dispatchBeta xs e0 args (Var fun, args) -> case Dict.get fun globals of Just alts -> dispatchAlts globals fun alts args Nothing -> case Dict.get fun primitives of Just prim -> prim globals args Nothing -> Just (Fail "undefined name" , Prim "application") _ -> Just (Fail "invalid function", Prim "application") InfixOp op e1 e2 -> redex globals (App (Var op) [e1, e2]) IfThenElse e1 e2 e3 -> case e1 of Boolean True -> Just (Eval e2, Prim "if-True") Boolean False -> Just (Eval e3, Prim "if-False") _ -> if isWeakNormalForm e1 then Just (Fail "type error", Prim "if") else redex globals e1 |> Maybe.andThen (\(ne1,info) -> Just (IfThenElse ne1 e2 e3,info)) Eval e1 -> redex globals e1 _ -> Nothing -- unwind nested applications in a stack of arguments unwindArgs : Expr -> List Expr -> (Expr, List Expr) unwindArgs e args = case e of (App e1 es) -> unwindArgs e1 (es++args) _ -> (e, args) -- reverse the unwound stack of arguments back into an application applyArgs : Expr -> List Expr -> Expr applyArgs e0 args = case args of [] -> e0 _ -> App e0 args -- perform pattern matching matching : Pattern -> Expr -> Subst -> Maybe Subst matching p e s = case p of (VarP x) -> Just (Dict.insert x e s) (BangP x) -> Just (Dict.insert x e s) (NumberP n) -> case e of Number m -> if n==m then Just s else Nothing _ -> Nothing (BooleanP b) -> case e of Boolean c -> if b==c then Just s else Nothing _ -> Nothing (ListP []) -> case e of ListLit [] -> Just s _ -> Nothing (ListP (p1::ps)) -> case e of ListLit (e1::es) -> matching p1 e1 s |> Maybe.andThen (matching (ListP ps) (ListLit es)) App (Var ":") [e1, e2] -> matching p1 e1 s |> Maybe.andThen (matching (ListP ps) e2) _ -> Nothing (TupleP ps) -> case e of TupleLit es -> matchingList ps es s _ -> Nothing (ConsP p1 p2) -> case e of (App (Var ":") [e1, e2]) -> matching p1 e1 s |> Maybe.andThen (matching p2 e2) (ListLit (e1::e2)) -> matching p1 e1 s |> Maybe.andThen (matching p2 (ListLit e2)) _ -> Nothing matchingList : List Pattern -> List Expr -> Subst -> Maybe Subst matchingList ps es s = case (ps, es) of (p1::ps1, e1::es1) -> matching p1 e1 s |> Maybe.andThen (\s1 -> matchingList ps1 es1 s1) ([], []) -> Just s _ -> Nothing -- -- check if a pattern performs evaluation of subexpression -- returns Just (newexpr, info) if it forces the evaluation -- or Nothing otherwise -- patternEval : Binds -> Pattern -> Expr -> Maybe (Expr, Info) patternEval globals p e = case (p, e) of (VarP _, _) -> Nothing (NumberP _, Number _) -> Nothing (BooleanP _, Boolean _) -> Nothing (TupleP ps, TupleLit es) -> patternEvalList globals ps es [] |> Maybe.andThen (\(nes, info) -> Just (TupleLit nes, info)) (ListP ps, ListLit es) -> patternEvalList globals ps es [] |> Maybe.andThen (\(nes,info) -> Just (ListLit nes, info)) (ListP [], App (Var ":") _) -> Nothing (ListP (p1::ps), App (Var ":") [e1, e2]) -> case patternEval globals p1 e1 of Just (ne1,info) -> Just (App (Var ":") [ne1, e2], info) Nothing -> patternEval globals (ListP ps) e2 |> Maybe.andThen (\(ne2,info) -> Just (App (Var ":") [e1, ne2],info)) (ConsP p1 p2, ListLit []) -> Nothing (ConsP p1 p2, ListLit (e1::rest)) -> case patternEval globals p1 e1 of Just (ne1,info) -> Just (ListLit (ne1::rest),info) Nothing -> patternEval globals p2 (ListLit rest) |> Maybe.andThen (\(nrest_,info) -> case nrest_ of ListLit nrest -> Just (ListLit (e1::nrest), info) _ -> Nothing) (_, _) -> redex globals e patternEvalList : Binds -> List Pattern -> List Expr -> List Expr -> Maybe (List Expr,Info) patternEvalList globals patts exprs accum = case (patts, exprs) of (p1::ps, e1::es) -> case patternEval globals p1 e1 of Just (ne1,info) -> Just (List.reverse accum ++ (ne1::es), info) Nothing -> patternEvalList globals ps es (e1::accum) (_, _) -> Nothing -- * perform a single reduction under a context redexCtx : Binds -> Expr -> Context -> Maybe (Expr,Info) redexCtx functions expr ctx = ctx.getOption expr |> Maybe.andThen (\subexpr -> redex functions subexpr |> Maybe.andThen (\result -> case result of (Fail err, info) -> Just (Fail err, info) (new,info) -> Just (ctx.set new expr, info))) -- locate the next outermost-leftmost redex -- to evaluate an expression to head normal form; -- does not evaluate under lambdas or if branches outermostRedex : Binds -> Expr -> Maybe Context outermostRedex globals expr = case redex globals expr of Just _ -> Just Context.hole Nothing -> outermostRedexAux globals expr outermostRedexAux : Binds -> Expr -> Maybe Context outermostRedexAux globals expr = case expr of (App (Var ":") [e0, e1]) -> case outermostRedex globals e0 of Just ctx -> Just (Monocle.compose Context.cons0 ctx) Nothing -> case outermostRedex globals e1 of Just ctx -> Just (Monocle.compose Context.cons1 ctx) Nothing -> Nothing (TupleLit items) -> outermostRedexArgs globals Context.tupleItem items 0 (ListLit items) -> outermostRedexArgs globals Context.listItem items 0 (IfThenElse e0 e1 e2) -> case outermostRedex globals e0 of Just ctx -> Just (Monocle.compose Context.if0 ctx) Nothing -> Nothing _ -> Nothing -- * try to reduce some argument by left to right order outermostRedexArgs : Binds -> (Int -> Context) -> List Expr -> Int -> Maybe Context outermostRedexArgs functions proj args i = case args of (arg::rest) -> case outermostRedex functions arg of Just ctx -> Just (Monocle.compose (proj i) ctx) Nothing -> outermostRedexArgs functions proj rest (i+1) [] -> Nothing reduceNext : Binds -> Expr -> Maybe (Expr,Info) reduceNext globals expr = let expr1 = AST.uneval expr in outermostRedex globals expr1 |> Maybe.andThen (\ctx -> redexCtx globals expr1 ctx) isNormalForm : Binds -> Expr -> Bool isNormalForm functions expr = case reduceNext functions expr of Just _ -> False Nothing -> True reduceFull : Binds -> Expr -> Maybe (Expr, Info) reduceFull globals expr = reduceNext globals expr |> Maybe.andThen (\(expr1,_) -> Just (reduceFullAux globals expr1, Prim "...")) reduceFullAux : Binds -> Expr -> Expr reduceFullAux globals expr = case reduceNext globals expr of Just (expr1,_) -> reduceFullAux globals expr1 Nothing -> expr -- check if an expression is a weak normal form isWeakNormalForm : Expr -> Bool isWeakNormalForm expr = case expr of App (Var ":") _ -> True App _ _ -> False Lam _ _ -> True Var _ -> False Number _ -> True Boolean _ -> True ListLit _ -> True TupleLit _ -> True _ -> False -- like List.range but with a variable step (delta) ranged : Int -> Int -> Int -> List Int ranged a b delta = if delta>0 then rangedUp a b delta else if delta<0 then rangedDown a b delta else [] rangedUp a b delta = if a <= b then a :: rangedUp (a+delta) b delta else [] rangedDown a b delta = if a >= b then a :: rangedDown (a+delta) b delta else []
elm
[ { "context": "700\"\n )\n Gorman ->\n (\"0 0 10px #fff, 0 0", "end": 9485, "score": 0.6617767811, "start": 9481, "tag": "NAME", "value": "Gorm" }, { "context": "da6\"\n )\n Doherty ->\n (\"0 0 10px #fff, ", "end": 9834, "score": 0.7866408229, "start": 9832, "tag": "NAME", "value": "Do" } ]
src/Style.elm
lllllcf/Frotun-Chase
0
module Style exposing (..) import Css exposing (..) import Css.Animations exposing (custom, keyframes) import Html.Styled exposing (..) import Html.Styled.Attributes exposing (css) import Definition exposing (..) button1 : Attribute Msg button1 = css [ property "background-color" "#DC143C" , property "top" "0px" , property "position" "relative" , property "display" "block" , property "cursor" "pointer" , property "text-align" "center" , property "text-decoration" "none" , property "outline" "none" , property "color" "#fff" , property "border" "none" , property "border-radius" "15px" , property "box-shadow" "0 9px #8B0000" , property "-webkit-transition-duration" "0.2s" , property "transition-duration" "0.2s" , property "overflow" "hidden" , property "cursor" "url(./src/img/cursor.cur),move" , hover [ property "background" "#B22222" , property "display" "block" , property "position" "absolute" ] , active [ property "background-color" "#B22222" , property "box-shadow" "0 5px #800000" , property "transform" "translateY(4px)" , after [ property "padding" "0" , property "margin" "0" , property "opacity" "1" , property "transition" "0s" ] ] ] button2 : Attribute Msg button2 = css [ property "background-color" "#708090" , property "top" "0px" , property "position" "relative" , property "display" "block" , property "cursor" "pointer" , property "text-align" "center" , property "text-decoration" "none" , property "outline" "none" , property "color" "#fff" , property "border" "none" , property "border-radius" "15px" , property "box-shadow" "0 9px #696969" , property "-webkit-transition-duration" "0.2s" , property "transition-duration" "0.2s" , property "overflow" "hidden" , property "cursor" "url(./src/img/cursor.cur),move" , hover [ property "background" "#696969" , property "display" "block" , property "position" "absolute" ] , active [ property "background-color" "#696969" , property "box-shadow" "0 5px #2F4F4F" , property "transform" "translateY(4px)" , after [ property "padding" "0" , property "margin" "0" , property "opacity" "1" , property "transition" "0s" ] ] ] buttonYes : Attribute Msg buttonYes = css [ property "width" "220px" , property "height" "50px" , property "border" "none" , property "outline" "none" , property "color" "#fff" , property "background" "#111" , property "position" "relative" , property "z-index" "0" , property "border-radius" "10px" , property "cursor" "url(./src/img/cursor.cur),move" , before [ property "content" "''" , property "background" "linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000)" , property "position" "absolute" , property "top" "-2px" , property "left" "-2px" , property "background-size" "400%" , property "z-index" "-1" , property "filter" "blur(5px)" , property "width" "calc(100% + 4px)" , property "height" "calc(100% + 4px)" , animationName ( keyframes [ (0, [ custom "background-position" "0 0" ]) , (50, [ custom "background-position" "400% 0" ]) , (100, [ custom "background-position" "0 0" ]) ] ) , animationDuration (sec(30)) , property "animation-iteration-count" "infinite" , property "opacity" "0" , property "transition" "opacity .3s ease-in-out" , property "border-radius" "10px" ] , active [ property "color" "#000" ] , active [ after [ property "background" "transparent" ] ] , hover [ before [ property "opacity" "1" ] ] , after [ property "z-index" "-1" , property "content" "''" , property "position" "absolute" , property "width" "100%" , property "height" "100%" , property "background" "#111" , property "left" "0" , property "top" "0" , property "border-radius" "10-px" ] ] buttonNo : Attribute Msg buttonNo = css [ property "width" "220px" , property "height" "50px" , property "border" "none" , property "outline" "none" , property "color" "#111" , property "background" "#fff" , property "position" "relative" , property "z-index" "0" , property "border-radius" "10px" , property "cursor" "url(./src/img/cursor.cur),move" , before [ property "content" "''" , property "background" "linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000)" , property "position" "absolute" , property "top" "-2px" , property "left" "-2px" , property "background-size" "400%" , property "z-index" "-1" , property "filter" "blur(5px)" , property "width" "calc(100% + 4px)" , property "height" "calc(100% + 4px)" , animationName ( keyframes [ (0, [ custom "background-position" "0 0" ]) , (50, [ custom "background-position" "400% 0" ]) , (100, [ custom "background-position" "0 0" ]) ] ) , animationDuration (sec(30)) , property "animation-iteration-count" "infinite" , property "opacity" "0" , property "transition" "opacity .3s ease-in-out" , property "border-radius" "10px" ] , active [ property "color" "#fff" ] , active [ after [ property "background" "transparent" ] ] , hover [ before [ property "opacity" "1" ] ] , after [ property "z-index" "-1" , property "content" "''" , property "position" "absolute" , property "width" "100%" , property "height" "100%" , property "background" "#fff" , property "left" "0" , property "top" "0" , property "border-radius" "10-px" ] ] buttonSide : Attribute Msg buttonSide = css [ property "color" "!important" , property "text-transform" "uppercase" , property "text-decoration" "none" , property "background" "#ffffff" , property "display" "inline-block" , property "cursor" "url(./src/img/cursor.cur),move" , animationName (keyframes [(0, [custom "background-color" "#2ba805", custom "box-shadow" "0 0 5px #2ba805"]) ,(50, [custom "background-color" "#49e819", custom "box-shadow" "0 0 20px #49e819"]) ,(100, [custom "background-color" "#2ba805", custom "box-shadow" "0 0 5px #2ba805"]) ]) , property "animation-iteration-count" "infinite" , animationDuration (sec(1.3)) ] buttonTop : Attribute Msg buttonTop = css [ property "color" "white" , property "text-transform" "uppercase" , property "text-decoration" "none" , property "background" "#ffffff" , property "display" "inline-block" , property "cursor" "url(./src/img/cursor.cur),move" , animationName (keyframes [(0, [custom "background-color" "#8B0000", custom "box-shadow" "0 0 5px #8B0000"]) ,(50, [custom "background-color" "#B22222", custom "box-shadow" "0 0 20px #B22222"]) ,(100, [custom "background-color" "#8B0000", custom "box-shadow" "0 0 5px #8B0000"]) ]) , property "animation-iteration-count" "infinite" , animationDuration (sec(1.3)) ] glowing : Player -> Attribute Msg glowing player = let color = if player.exist then case player.character of Lance -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #DAA520, 0 0 40px #DAA520, 0 0 50px #DAA520, 0 0 60px #DAA520, 0 0 70px #DAA520" ,"0 0 20px #fff, 0 0 30px #FFD700, 0 0 40px #FFD700, 0 0 50px #FFD700, 0 0 60px #FFD700, 0 0 70px #FFD700, 0 0 80px #FFD700" ) Gorman -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #e60073, 0 0 40px #e60073, 0 0 50px #e60073, 0 0 60px #e60073, 0 0 70px #e60073" ,"0 0 20px #fff, 0 0 30px #ff4da6, 0 0 40px #ff4da6, 0 0 50px #ff4da6, 0 0 60px #ff4da6, 0 0 70px #ff4da6, 0 0 80px #ff4da6" ) Doherty -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #000080, 0 0 40px #000080, 0 0 50px #000080, 0 0 60px #000080, 0 0 70px #000080" ,"0 0 20px #fff, 0 0 30px #6495ED, 0 0 40px #6495ED, 0 0 50px #6495ED, 0 0 60px #6495ED, 0 0 70px #6495ED, 0 0 80px #6495ED" ) Blair -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #FF7F50, 0 0 40px #FF7F50, 0 0 50px #FF7F50, 0 0 60px #FF7F50, 0 0 70px #FF7F50" ,"0 0 20px #fff, 0 0 30px #FFA07A, 0 0 40px #FFA07A, 0 0 50px #FFA07A, 0 0 60px #FFA07A, 0 0 70px #FFA07A, 0 0 80px #FFA07A" ) _ -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #FF7F50, 0 0 40px #FF7F50, 0 0 50px #FF7F50, 0 0 60px #FF7F50, 0 0 70px #FF7F50" ,"0 0 20px #fff, 0 0 30px #FFA07A, 0 0 40px #FFA07A, 0 0 50px #FFA07A, 0 0 60px #FFA07A, 0 0 70px #FFA07A, 0 0 80px #FFA07A" ) else ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #8B0000, 0 0 40px #8B0000, 0 0 50px #8B0000, 0 0 60px #8B0000, 0 0 70px #8B0000" ,"0 0 20px #fff, 0 0 30px #FF0000, 0 0 40px #FF0000, 0 0 50px #FF0000, 0 0 60px #FF0000, 0 0 70px #FF0000, 0 0 80px #FF0000" ) in css [ animationName (keyframes [(0, [custom "text-shadow" (Tuple.first color)]) ,(100, [custom "text-shadow" (Tuple.second color)]) ]) , animationDuration (sec(1)) , property "animation-iteration-count" "infinite" , property "animation-timing-function" "ease-in-out" , property "animation-direction" "alternate" ]
59188
module Style exposing (..) import Css exposing (..) import Css.Animations exposing (custom, keyframes) import Html.Styled exposing (..) import Html.Styled.Attributes exposing (css) import Definition exposing (..) button1 : Attribute Msg button1 = css [ property "background-color" "#DC143C" , property "top" "0px" , property "position" "relative" , property "display" "block" , property "cursor" "pointer" , property "text-align" "center" , property "text-decoration" "none" , property "outline" "none" , property "color" "#fff" , property "border" "none" , property "border-radius" "15px" , property "box-shadow" "0 9px #8B0000" , property "-webkit-transition-duration" "0.2s" , property "transition-duration" "0.2s" , property "overflow" "hidden" , property "cursor" "url(./src/img/cursor.cur),move" , hover [ property "background" "#B22222" , property "display" "block" , property "position" "absolute" ] , active [ property "background-color" "#B22222" , property "box-shadow" "0 5px #800000" , property "transform" "translateY(4px)" , after [ property "padding" "0" , property "margin" "0" , property "opacity" "1" , property "transition" "0s" ] ] ] button2 : Attribute Msg button2 = css [ property "background-color" "#708090" , property "top" "0px" , property "position" "relative" , property "display" "block" , property "cursor" "pointer" , property "text-align" "center" , property "text-decoration" "none" , property "outline" "none" , property "color" "#fff" , property "border" "none" , property "border-radius" "15px" , property "box-shadow" "0 9px #696969" , property "-webkit-transition-duration" "0.2s" , property "transition-duration" "0.2s" , property "overflow" "hidden" , property "cursor" "url(./src/img/cursor.cur),move" , hover [ property "background" "#696969" , property "display" "block" , property "position" "absolute" ] , active [ property "background-color" "#696969" , property "box-shadow" "0 5px #2F4F4F" , property "transform" "translateY(4px)" , after [ property "padding" "0" , property "margin" "0" , property "opacity" "1" , property "transition" "0s" ] ] ] buttonYes : Attribute Msg buttonYes = css [ property "width" "220px" , property "height" "50px" , property "border" "none" , property "outline" "none" , property "color" "#fff" , property "background" "#111" , property "position" "relative" , property "z-index" "0" , property "border-radius" "10px" , property "cursor" "url(./src/img/cursor.cur),move" , before [ property "content" "''" , property "background" "linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000)" , property "position" "absolute" , property "top" "-2px" , property "left" "-2px" , property "background-size" "400%" , property "z-index" "-1" , property "filter" "blur(5px)" , property "width" "calc(100% + 4px)" , property "height" "calc(100% + 4px)" , animationName ( keyframes [ (0, [ custom "background-position" "0 0" ]) , (50, [ custom "background-position" "400% 0" ]) , (100, [ custom "background-position" "0 0" ]) ] ) , animationDuration (sec(30)) , property "animation-iteration-count" "infinite" , property "opacity" "0" , property "transition" "opacity .3s ease-in-out" , property "border-radius" "10px" ] , active [ property "color" "#000" ] , active [ after [ property "background" "transparent" ] ] , hover [ before [ property "opacity" "1" ] ] , after [ property "z-index" "-1" , property "content" "''" , property "position" "absolute" , property "width" "100%" , property "height" "100%" , property "background" "#111" , property "left" "0" , property "top" "0" , property "border-radius" "10-px" ] ] buttonNo : Attribute Msg buttonNo = css [ property "width" "220px" , property "height" "50px" , property "border" "none" , property "outline" "none" , property "color" "#111" , property "background" "#fff" , property "position" "relative" , property "z-index" "0" , property "border-radius" "10px" , property "cursor" "url(./src/img/cursor.cur),move" , before [ property "content" "''" , property "background" "linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000)" , property "position" "absolute" , property "top" "-2px" , property "left" "-2px" , property "background-size" "400%" , property "z-index" "-1" , property "filter" "blur(5px)" , property "width" "calc(100% + 4px)" , property "height" "calc(100% + 4px)" , animationName ( keyframes [ (0, [ custom "background-position" "0 0" ]) , (50, [ custom "background-position" "400% 0" ]) , (100, [ custom "background-position" "0 0" ]) ] ) , animationDuration (sec(30)) , property "animation-iteration-count" "infinite" , property "opacity" "0" , property "transition" "opacity .3s ease-in-out" , property "border-radius" "10px" ] , active [ property "color" "#fff" ] , active [ after [ property "background" "transparent" ] ] , hover [ before [ property "opacity" "1" ] ] , after [ property "z-index" "-1" , property "content" "''" , property "position" "absolute" , property "width" "100%" , property "height" "100%" , property "background" "#fff" , property "left" "0" , property "top" "0" , property "border-radius" "10-px" ] ] buttonSide : Attribute Msg buttonSide = css [ property "color" "!important" , property "text-transform" "uppercase" , property "text-decoration" "none" , property "background" "#ffffff" , property "display" "inline-block" , property "cursor" "url(./src/img/cursor.cur),move" , animationName (keyframes [(0, [custom "background-color" "#2ba805", custom "box-shadow" "0 0 5px #2ba805"]) ,(50, [custom "background-color" "#49e819", custom "box-shadow" "0 0 20px #49e819"]) ,(100, [custom "background-color" "#2ba805", custom "box-shadow" "0 0 5px #2ba805"]) ]) , property "animation-iteration-count" "infinite" , animationDuration (sec(1.3)) ] buttonTop : Attribute Msg buttonTop = css [ property "color" "white" , property "text-transform" "uppercase" , property "text-decoration" "none" , property "background" "#ffffff" , property "display" "inline-block" , property "cursor" "url(./src/img/cursor.cur),move" , animationName (keyframes [(0, [custom "background-color" "#8B0000", custom "box-shadow" "0 0 5px #8B0000"]) ,(50, [custom "background-color" "#B22222", custom "box-shadow" "0 0 20px #B22222"]) ,(100, [custom "background-color" "#8B0000", custom "box-shadow" "0 0 5px #8B0000"]) ]) , property "animation-iteration-count" "infinite" , animationDuration (sec(1.3)) ] glowing : Player -> Attribute Msg glowing player = let color = if player.exist then case player.character of Lance -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #DAA520, 0 0 40px #DAA520, 0 0 50px #DAA520, 0 0 60px #DAA520, 0 0 70px #DAA520" ,"0 0 20px #fff, 0 0 30px #FFD700, 0 0 40px #FFD700, 0 0 50px #FFD700, 0 0 60px #FFD700, 0 0 70px #FFD700, 0 0 80px #FFD700" ) <NAME>an -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #e60073, 0 0 40px #e60073, 0 0 50px #e60073, 0 0 60px #e60073, 0 0 70px #e60073" ,"0 0 20px #fff, 0 0 30px #ff4da6, 0 0 40px #ff4da6, 0 0 50px #ff4da6, 0 0 60px #ff4da6, 0 0 70px #ff4da6, 0 0 80px #ff4da6" ) <NAME>herty -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #000080, 0 0 40px #000080, 0 0 50px #000080, 0 0 60px #000080, 0 0 70px #000080" ,"0 0 20px #fff, 0 0 30px #6495ED, 0 0 40px #6495ED, 0 0 50px #6495ED, 0 0 60px #6495ED, 0 0 70px #6495ED, 0 0 80px #6495ED" ) Blair -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #FF7F50, 0 0 40px #FF7F50, 0 0 50px #FF7F50, 0 0 60px #FF7F50, 0 0 70px #FF7F50" ,"0 0 20px #fff, 0 0 30px #FFA07A, 0 0 40px #FFA07A, 0 0 50px #FFA07A, 0 0 60px #FFA07A, 0 0 70px #FFA07A, 0 0 80px #FFA07A" ) _ -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #FF7F50, 0 0 40px #FF7F50, 0 0 50px #FF7F50, 0 0 60px #FF7F50, 0 0 70px #FF7F50" ,"0 0 20px #fff, 0 0 30px #FFA07A, 0 0 40px #FFA07A, 0 0 50px #FFA07A, 0 0 60px #FFA07A, 0 0 70px #FFA07A, 0 0 80px #FFA07A" ) else ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #8B0000, 0 0 40px #8B0000, 0 0 50px #8B0000, 0 0 60px #8B0000, 0 0 70px #8B0000" ,"0 0 20px #fff, 0 0 30px #FF0000, 0 0 40px #FF0000, 0 0 50px #FF0000, 0 0 60px #FF0000, 0 0 70px #FF0000, 0 0 80px #FF0000" ) in css [ animationName (keyframes [(0, [custom "text-shadow" (Tuple.first color)]) ,(100, [custom "text-shadow" (Tuple.second color)]) ]) , animationDuration (sec(1)) , property "animation-iteration-count" "infinite" , property "animation-timing-function" "ease-in-out" , property "animation-direction" "alternate" ]
true
module Style exposing (..) import Css exposing (..) import Css.Animations exposing (custom, keyframes) import Html.Styled exposing (..) import Html.Styled.Attributes exposing (css) import Definition exposing (..) button1 : Attribute Msg button1 = css [ property "background-color" "#DC143C" , property "top" "0px" , property "position" "relative" , property "display" "block" , property "cursor" "pointer" , property "text-align" "center" , property "text-decoration" "none" , property "outline" "none" , property "color" "#fff" , property "border" "none" , property "border-radius" "15px" , property "box-shadow" "0 9px #8B0000" , property "-webkit-transition-duration" "0.2s" , property "transition-duration" "0.2s" , property "overflow" "hidden" , property "cursor" "url(./src/img/cursor.cur),move" , hover [ property "background" "#B22222" , property "display" "block" , property "position" "absolute" ] , active [ property "background-color" "#B22222" , property "box-shadow" "0 5px #800000" , property "transform" "translateY(4px)" , after [ property "padding" "0" , property "margin" "0" , property "opacity" "1" , property "transition" "0s" ] ] ] button2 : Attribute Msg button2 = css [ property "background-color" "#708090" , property "top" "0px" , property "position" "relative" , property "display" "block" , property "cursor" "pointer" , property "text-align" "center" , property "text-decoration" "none" , property "outline" "none" , property "color" "#fff" , property "border" "none" , property "border-radius" "15px" , property "box-shadow" "0 9px #696969" , property "-webkit-transition-duration" "0.2s" , property "transition-duration" "0.2s" , property "overflow" "hidden" , property "cursor" "url(./src/img/cursor.cur),move" , hover [ property "background" "#696969" , property "display" "block" , property "position" "absolute" ] , active [ property "background-color" "#696969" , property "box-shadow" "0 5px #2F4F4F" , property "transform" "translateY(4px)" , after [ property "padding" "0" , property "margin" "0" , property "opacity" "1" , property "transition" "0s" ] ] ] buttonYes : Attribute Msg buttonYes = css [ property "width" "220px" , property "height" "50px" , property "border" "none" , property "outline" "none" , property "color" "#fff" , property "background" "#111" , property "position" "relative" , property "z-index" "0" , property "border-radius" "10px" , property "cursor" "url(./src/img/cursor.cur),move" , before [ property "content" "''" , property "background" "linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000)" , property "position" "absolute" , property "top" "-2px" , property "left" "-2px" , property "background-size" "400%" , property "z-index" "-1" , property "filter" "blur(5px)" , property "width" "calc(100% + 4px)" , property "height" "calc(100% + 4px)" , animationName ( keyframes [ (0, [ custom "background-position" "0 0" ]) , (50, [ custom "background-position" "400% 0" ]) , (100, [ custom "background-position" "0 0" ]) ] ) , animationDuration (sec(30)) , property "animation-iteration-count" "infinite" , property "opacity" "0" , property "transition" "opacity .3s ease-in-out" , property "border-radius" "10px" ] , active [ property "color" "#000" ] , active [ after [ property "background" "transparent" ] ] , hover [ before [ property "opacity" "1" ] ] , after [ property "z-index" "-1" , property "content" "''" , property "position" "absolute" , property "width" "100%" , property "height" "100%" , property "background" "#111" , property "left" "0" , property "top" "0" , property "border-radius" "10-px" ] ] buttonNo : Attribute Msg buttonNo = css [ property "width" "220px" , property "height" "50px" , property "border" "none" , property "outline" "none" , property "color" "#111" , property "background" "#fff" , property "position" "relative" , property "z-index" "0" , property "border-radius" "10px" , property "cursor" "url(./src/img/cursor.cur),move" , before [ property "content" "''" , property "background" "linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000)" , property "position" "absolute" , property "top" "-2px" , property "left" "-2px" , property "background-size" "400%" , property "z-index" "-1" , property "filter" "blur(5px)" , property "width" "calc(100% + 4px)" , property "height" "calc(100% + 4px)" , animationName ( keyframes [ (0, [ custom "background-position" "0 0" ]) , (50, [ custom "background-position" "400% 0" ]) , (100, [ custom "background-position" "0 0" ]) ] ) , animationDuration (sec(30)) , property "animation-iteration-count" "infinite" , property "opacity" "0" , property "transition" "opacity .3s ease-in-out" , property "border-radius" "10px" ] , active [ property "color" "#fff" ] , active [ after [ property "background" "transparent" ] ] , hover [ before [ property "opacity" "1" ] ] , after [ property "z-index" "-1" , property "content" "''" , property "position" "absolute" , property "width" "100%" , property "height" "100%" , property "background" "#fff" , property "left" "0" , property "top" "0" , property "border-radius" "10-px" ] ] buttonSide : Attribute Msg buttonSide = css [ property "color" "!important" , property "text-transform" "uppercase" , property "text-decoration" "none" , property "background" "#ffffff" , property "display" "inline-block" , property "cursor" "url(./src/img/cursor.cur),move" , animationName (keyframes [(0, [custom "background-color" "#2ba805", custom "box-shadow" "0 0 5px #2ba805"]) ,(50, [custom "background-color" "#49e819", custom "box-shadow" "0 0 20px #49e819"]) ,(100, [custom "background-color" "#2ba805", custom "box-shadow" "0 0 5px #2ba805"]) ]) , property "animation-iteration-count" "infinite" , animationDuration (sec(1.3)) ] buttonTop : Attribute Msg buttonTop = css [ property "color" "white" , property "text-transform" "uppercase" , property "text-decoration" "none" , property "background" "#ffffff" , property "display" "inline-block" , property "cursor" "url(./src/img/cursor.cur),move" , animationName (keyframes [(0, [custom "background-color" "#8B0000", custom "box-shadow" "0 0 5px #8B0000"]) ,(50, [custom "background-color" "#B22222", custom "box-shadow" "0 0 20px #B22222"]) ,(100, [custom "background-color" "#8B0000", custom "box-shadow" "0 0 5px #8B0000"]) ]) , property "animation-iteration-count" "infinite" , animationDuration (sec(1.3)) ] glowing : Player -> Attribute Msg glowing player = let color = if player.exist then case player.character of Lance -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #DAA520, 0 0 40px #DAA520, 0 0 50px #DAA520, 0 0 60px #DAA520, 0 0 70px #DAA520" ,"0 0 20px #fff, 0 0 30px #FFD700, 0 0 40px #FFD700, 0 0 50px #FFD700, 0 0 60px #FFD700, 0 0 70px #FFD700, 0 0 80px #FFD700" ) PI:NAME:<NAME>END_PIan -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #e60073, 0 0 40px #e60073, 0 0 50px #e60073, 0 0 60px #e60073, 0 0 70px #e60073" ,"0 0 20px #fff, 0 0 30px #ff4da6, 0 0 40px #ff4da6, 0 0 50px #ff4da6, 0 0 60px #ff4da6, 0 0 70px #ff4da6, 0 0 80px #ff4da6" ) PI:NAME:<NAME>END_PIherty -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #000080, 0 0 40px #000080, 0 0 50px #000080, 0 0 60px #000080, 0 0 70px #000080" ,"0 0 20px #fff, 0 0 30px #6495ED, 0 0 40px #6495ED, 0 0 50px #6495ED, 0 0 60px #6495ED, 0 0 70px #6495ED, 0 0 80px #6495ED" ) Blair -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #FF7F50, 0 0 40px #FF7F50, 0 0 50px #FF7F50, 0 0 60px #FF7F50, 0 0 70px #FF7F50" ,"0 0 20px #fff, 0 0 30px #FFA07A, 0 0 40px #FFA07A, 0 0 50px #FFA07A, 0 0 60px #FFA07A, 0 0 70px #FFA07A, 0 0 80px #FFA07A" ) _ -> ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #FF7F50, 0 0 40px #FF7F50, 0 0 50px #FF7F50, 0 0 60px #FF7F50, 0 0 70px #FF7F50" ,"0 0 20px #fff, 0 0 30px #FFA07A, 0 0 40px #FFA07A, 0 0 50px #FFA07A, 0 0 60px #FFA07A, 0 0 70px #FFA07A, 0 0 80px #FFA07A" ) else ("0 0 10px #fff, 0 0 20px #fff, 0 0 30px #8B0000, 0 0 40px #8B0000, 0 0 50px #8B0000, 0 0 60px #8B0000, 0 0 70px #8B0000" ,"0 0 20px #fff, 0 0 30px #FF0000, 0 0 40px #FF0000, 0 0 50px #FF0000, 0 0 60px #FF0000, 0 0 70px #FF0000, 0 0 80px #FF0000" ) in css [ animationName (keyframes [(0, [custom "text-shadow" (Tuple.first color)]) ,(100, [custom "text-shadow" (Tuple.second color)]) ]) , animationDuration (sec(1)) , property "animation-iteration-count" "infinite" , property "animation-timing-function" "ease-in-out" , property "animation-direction" "alternate" ]
elm
[ { "context": "bes\n\n\nprefixSyllabe : String\nprefixSyllabe =\n \"dozmarbinwansamlitsighidfidlissogdirwacsabwissibrigsoldopmodfoglidhopdardorlorhodfolrintogsilmirholpaslacrovlivdalsatlibtabhanticpidtorbolfosdotlosdilforpilramtirwintadbicdifrocwidbisdasmidloprilnardapmolsanlocnovsitnidtipsicropwitnatpanminritpodmottamtolsavposnapnopsomfinfonbanmorworsipronnorbotwicsocwatdolmagpicdavbidbaltimtasmalligsivtagpadsaldivdactansidfabtarmonranniswolmispallasdismaprabtobrollatlonnodnavfignomnibpagsopralbilhaddocridmocpacravripfaltodtiltinhapmicfanpattaclabmogsimsonpinlomrictapfirhasbosbatpochactidhavsaplindibhosdabbitbarracparloddosbortochilmactomdigfilfasmithobharmighinradmashalraglagfadtopmophabnilnosmilfopfamdatnoldinhatnacrisfotribhocnimlarfitwalrapsarnalmoslandondanladdovrivbacpollaptalpitnambonrostonfodponsovnocsorlavmatmipfip\"\n\n\nsuffixSyllabe : String\nsuffixSyllabe =\n \"zo", "end": 1249, "score": 0.9824842811, "start": 481, "tag": "KEY", "value": "dozmarbinwansamlitsighidfidlissogdirwacsabwissibrigsoldopmodfoglidhopdardorlorhodfolrintogsilmirholpaslacrovlivdalsatlibtabhanticpidtorbolfosdotlosdilforpilramtirwintadbicdifrocwidbisdasmidloprilnardapmolsanlocnovsitnidtipsicropwitnatpanminritpodmottamtolsavposnapnopsomfinfonbanmorworsipronnorbotwicsocwatdolmagpicdavbidbaltimtasmalligsivtagpadsaldivdactansidfabtarmonranniswolmispallasdismaprabtobrollatlonnodnavfignomnibpagsopralbilhaddocridmocpacravripfaltodtiltinhapmicfanpattaclabmogsimsonpinlomrictapfirhasbosbatpochactidhavsaplindibhosdabbitbarracparloddosbortochilmactomdigfilfasmithobharmighinradmashalraglagfadtopmophabnilnosmilfopfamdatnoldinhatnacrisfotribhocnimlarfitwalrapsarnalmoslandondanladdovrivbacpollaptalpitnambonrostonfodponsovnocsorlavmatmipfip" }, { "context": "ughecryttyvsydnexlunmeplutseppesdelsulpedtemledtulmetwenbynhexfebpyldulhetmevruttylwydtepbesdexsefwycburderneppurrysrebdennutsubpetrulsynregtydsupsemwynrecmegnetsecmulnymtevwebsummutnyxrextebfushepbenmuswyxsymselrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpelsyptermebsetdutdegtexsurfeltudnuxruxrenwytnubmedlytdusnebrumtynseglyxpunresredfunrevrefmectedrusbexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermertenlusnussyltecmexpubrymtucfyllepdebbermughuttunbylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmylwedducfurfexnulluclennerlexrupnedlecrydlydfenwelnydhusrelrudneshesfetdesretdunlernyrsebhulrylludremlysfynwerrycsugnysnyllyndyndemluxfedsedbecmunlyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\"\n\n\nisValidSyllabe validstr str =\n let\n ", "end": 2065, "score": 0.9958003163, "start": 1426, "tag": "KEY", "value": "metwenbynhexfebpyldulhetmevruttylwydtepbesdexsefwycburderneppurrysrebdennutsubpetrulsynregtydsupsemwynrecmegnetsecmulnymtevwebsummutnyxrextebfushepbenmuswyxsymselrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpelsyptermebsetdutdegtexsurfeltudnuxruxrenwytnubmedlytdusnebrumtynseglyxpunresredfunrevrefmectedrusbexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermertenlusnussyltecmexpubrymtucfyllepdebbermughuttunbylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmylwedducfurfexnulluclennerlexrupnedlecrydlydfenwelnydhusrelrudneshesfetdesretdunlernyrsebhulrylludremlysfynwerrycsugnysnyllyndyndemluxfedsedbecmunlyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes" } ]
src/Urb/Validator.elm
mikolajpp/elm-urbit
6
module Urb.Validator exposing (validPartsFromStr) {-| Validation utilities. Since Data between Urbit and frontend is passed using JSON, we need abilitity to establish constraints on certain data structures, such as ship names etc. @docs validPartsFromStr -} import Http import Json.Decode as D import Regex import List exposing (..) import Dict exposing (Dict) import String.Interpolate exposing (interpolate) -- Prefix syllabes prefixSyllabe : String prefixSyllabe = "dozmarbinwansamlitsighidfidlissogdirwacsabwissibrigsoldopmodfoglidhopdardorlorhodfolrintogsilmirholpaslacrovlivdalsatlibtabhanticpidtorbolfosdotlosdilforpilramtirwintadbicdifrocwidbisdasmidloprilnardapmolsanlocnovsitnidtipsicropwitnatpanminritpodmottamtolsavposnapnopsomfinfonbanmorworsipronnorbotwicsocwatdolmagpicdavbidbaltimtasmalligsivtagpadsaldivdactansidfabtarmonranniswolmispallasdismaprabtobrollatlonnodnavfignomnibpagsopralbilhaddocridmocpacravripfaltodtiltinhapmicfanpattaclabmogsimsonpinlomrictapfirhasbosbatpochactidhavsaplindibhosdabbitbarracparloddosbortochilmactomdigfilfasmithobharmighinradmashalraglagfadtopmophabnilnosmilfopfamdatnoldinhatnacrisfotribhocnimlarfitwalrapsarnalmoslandondanladdovrivbacpollaptalpitnambonrostonfodponsovnocsorlavmatmipfip" suffixSyllabe : String suffixSyllabe = "zodnecbudwessevpersutletfulpensytdurwepserwylsunrypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnexlunmeplutseppesdelsulpedtemledtulmetwenbynhexfebpyldulhetmevruttylwydtepbesdexsefwycburderneppurrysrebdennutsubpetrulsynregtydsupsemwynrecmegnetsecmulnymtevwebsummutnyxrextebfushepbenmuswyxsymselrucdecwexsyrwetdylmynmesdetbetbeltuxtugmyrpelsyptermebsetdutdegtexsurfeltudnuxruxrenwytnubmedlytdusnebrumtynseglyxpunresredfunrevrefmectedrusbexlebduxrynnumpyxrygryxfeptyrtustyclegnemfermertenlusnussyltecmexpubrymtucfyllepdebbermughuttunbylsudpemdevlurdefbusbeprunmelpexdytbyttyplevmylwedducfurfexnulluclennerlexrupnedlecrydlydfenwelnydhusrelrudneshesfetdesretdunlernyrsebhulrylludremlysfynwerrycsugnysnyllyndyndemluxfedsedbecmunlyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes" isValidSyllabe validstr str = let regx = Maybe.withDefault Regex.never <| Regex.fromString str indexes = map .index (Regex.findAtMost 1 regx validstr) in case (head indexes) of Just x -> (modBy 3 x) == 0 Nothing -> False isValidPrefix = isValidSyllabe prefixSyllabe isValidSuffix = isValidSyllabe suffixSyllabe validPart : String -> Result String String validPart str = case String.length str of -- Single suffix 3 -> Ok str -- Prefix + Suffix 6 -> let prefix = String.left 3 str suffix = String.dropLeft 3 str in if (isValidPrefix prefix) && (isValidSuffix suffix) then Ok str else Err (interpolate "Part malformed: `{0}'" [ str ]) _ -> Err (interpolate "Part has invalid length: `{0}'" [ str ]) -- Check that every 4 parts there was a separator (empty field) isPartsFormatValid parts = let len = List.length parts seps = List.length (List.filter (\s -> String.length s == 0) parts) trueLen = len - seps in if trueLen < 4 then if seps > 0 then False else True else let whole = case (modBy 4 trueLen) of 0 -> 1 _ -> 0 in if (trueLen // 4 - whole) == seps then True else False {-| Exctracts parts from Urbit address string -} validPartsFromStr : String -> Result (List String) (List String) validPartsFromStr str = let parts = String.split "-" str vparts = List.map validPart (List.filter (\s -> String.length s > 0) parts) errors = List.map (\s -> case s of Err erstr -> erstr _ -> "" ) vparts in if (not (isPartsFormatValid parts)) then Err [ (interpolate "Incorrect parts format: `{0}'" [ str ]) ] else if (String.length (List.foldl (++) "" errors)) == 0 then Ok (List.map (\p -> case p of Ok pp -> pp _ -> "" ) vparts ) else Err errors
1005
module Urb.Validator exposing (validPartsFromStr) {-| Validation utilities. Since Data between Urbit and frontend is passed using JSON, we need abilitity to establish constraints on certain data structures, such as ship names etc. @docs validPartsFromStr -} import Http import Json.Decode as D import Regex import List exposing (..) import Dict exposing (Dict) import String.Interpolate exposing (interpolate) -- Prefix syllabes prefixSyllabe : String prefixSyllabe = "<KEY>" suffixSyllabe : String suffixSyllabe = "zodnecbudwessevpersutletfulpensytdurwepserwylsunrypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnexlunmeplutseppesdelsulpedtemledtul<KEY>" isValidSyllabe validstr str = let regx = Maybe.withDefault Regex.never <| Regex.fromString str indexes = map .index (Regex.findAtMost 1 regx validstr) in case (head indexes) of Just x -> (modBy 3 x) == 0 Nothing -> False isValidPrefix = isValidSyllabe prefixSyllabe isValidSuffix = isValidSyllabe suffixSyllabe validPart : String -> Result String String validPart str = case String.length str of -- Single suffix 3 -> Ok str -- Prefix + Suffix 6 -> let prefix = String.left 3 str suffix = String.dropLeft 3 str in if (isValidPrefix prefix) && (isValidSuffix suffix) then Ok str else Err (interpolate "Part malformed: `{0}'" [ str ]) _ -> Err (interpolate "Part has invalid length: `{0}'" [ str ]) -- Check that every 4 parts there was a separator (empty field) isPartsFormatValid parts = let len = List.length parts seps = List.length (List.filter (\s -> String.length s == 0) parts) trueLen = len - seps in if trueLen < 4 then if seps > 0 then False else True else let whole = case (modBy 4 trueLen) of 0 -> 1 _ -> 0 in if (trueLen // 4 - whole) == seps then True else False {-| Exctracts parts from Urbit address string -} validPartsFromStr : String -> Result (List String) (List String) validPartsFromStr str = let parts = String.split "-" str vparts = List.map validPart (List.filter (\s -> String.length s > 0) parts) errors = List.map (\s -> case s of Err erstr -> erstr _ -> "" ) vparts in if (not (isPartsFormatValid parts)) then Err [ (interpolate "Incorrect parts format: `{0}'" [ str ]) ] else if (String.length (List.foldl (++) "" errors)) == 0 then Ok (List.map (\p -> case p of Ok pp -> pp _ -> "" ) vparts ) else Err errors
true
module Urb.Validator exposing (validPartsFromStr) {-| Validation utilities. Since Data between Urbit and frontend is passed using JSON, we need abilitity to establish constraints on certain data structures, such as ship names etc. @docs validPartsFromStr -} import Http import Json.Decode as D import Regex import List exposing (..) import Dict exposing (Dict) import String.Interpolate exposing (interpolate) -- Prefix syllabes prefixSyllabe : String prefixSyllabe = "PI:KEY:<KEY>END_PI" suffixSyllabe : String suffixSyllabe = "zodnecbudwessevpersutletfulpensytdurwepserwylsunrypsyxdyrnuphebpeglupdepdysputlughecryttyvsydnexlunmeplutseppesdelsulpedtemledtulPI:KEY:<KEY>END_PI" isValidSyllabe validstr str = let regx = Maybe.withDefault Regex.never <| Regex.fromString str indexes = map .index (Regex.findAtMost 1 regx validstr) in case (head indexes) of Just x -> (modBy 3 x) == 0 Nothing -> False isValidPrefix = isValidSyllabe prefixSyllabe isValidSuffix = isValidSyllabe suffixSyllabe validPart : String -> Result String String validPart str = case String.length str of -- Single suffix 3 -> Ok str -- Prefix + Suffix 6 -> let prefix = String.left 3 str suffix = String.dropLeft 3 str in if (isValidPrefix prefix) && (isValidSuffix suffix) then Ok str else Err (interpolate "Part malformed: `{0}'" [ str ]) _ -> Err (interpolate "Part has invalid length: `{0}'" [ str ]) -- Check that every 4 parts there was a separator (empty field) isPartsFormatValid parts = let len = List.length parts seps = List.length (List.filter (\s -> String.length s == 0) parts) trueLen = len - seps in if trueLen < 4 then if seps > 0 then False else True else let whole = case (modBy 4 trueLen) of 0 -> 1 _ -> 0 in if (trueLen // 4 - whole) == seps then True else False {-| Exctracts parts from Urbit address string -} validPartsFromStr : String -> Result (List String) (List String) validPartsFromStr str = let parts = String.split "-" str vparts = List.map validPart (List.filter (\s -> String.length s > 0) parts) errors = List.map (\s -> case s of Err erstr -> erstr _ -> "" ) vparts in if (not (isPartsFormatValid parts)) then Err [ (interpolate "Incorrect parts format: `{0}'" [ str ]) ] else if (String.length (List.foldl (++) "" errors)) == 0 then Ok (List.map (\p -> case p of Ok pp -> pp _ -> "" ) vparts ) else Err errors
elm
[ { "context": " : String\n , username : String\n , password : String\n , host : List String\n , port_ : Int\n , ", "end": 925, "score": 0.9820247889, "start": 919, "tag": "PASSWORD", "value": "String" } ]
elm-stuff/packages/sporto/erl/10.0.2/src/Erl.elm
jigargosar/elm-simple-gtd
24
module Erl exposing (addQuery, clearQuery, extractHash, extractHost, extractPath, extractPort, extractProtocol, extractQuery, new, parse, removeQuery, setQuery, appendPathSegments, toString, queryToString, Url, Query) {-| Library for parsing and constructing URLs # Types @docs Url, Query # Parse @docs parse # Parse helpers @docs extractHash, extractHost, extractPath, extractProtocol, extractPort, extractQuery # Construct @docs new # Mutation helpers @docs addQuery, setQuery, removeQuery, clearQuery, appendPathSegments # Serialize @docs toString # Serialization helpers @docs queryToString -} import Dict import Http import Regex import String exposing (..) -- TYPES {-| A Dict that holds keys and values for the query string -} type alias Query = Dict.Dict String String {-| Record that holds url attributes -} type alias Url = { protocol : String , username : String , password : String , host : List String , port_ : Int , path : List String , hasLeadingSlash : Bool , hasTrailingSlash : Bool , hash : String , query : Query } -- UTILS notEmpty : String -> Bool notEmpty str = not (isEmpty str) -- "aa#bb" --> "bb" rightFrom : String -> String -> String rightFrom delimiter str = let parts = split delimiter str in case List.length parts of 0 -> "" 1 -> "" _ -> parts |> List.reverse |> List.head |> Maybe.withDefault "" rightFromOrSame : String -> String -> String rightFromOrSame delimiter str = let parts = split delimiter str in parts |> List.reverse |> List.head |> Maybe.withDefault "" -- "a/b" -> "a" -- "a" => "a" -- "/b" => "" leftFromOrSame : String -> String -> String leftFromOrSame delimiter str = let parts = split delimiter str in parts |> List.head |> Maybe.withDefault "" -- "a/b" -> "a" -- "/b" -> "" -- "a" -> "" leftFrom : String -> String -> String leftFrom delimiter str = let parts = split delimiter str head = List.head parts in case List.length parts of 0 -> "" 1 -> "" _ -> head |> Maybe.withDefault "" -- PROTOCOL {-| Extract the protocol from the url -} extractProtocol : String -> String extractProtocol str = let parts = split "://" str in case List.length parts of 1 -> "" _ -> Maybe.withDefault "" (List.head parts) -- HOST {-| Extract the host from the url -} -- valid host: a-z 0-9 and - extractHost : String -> String extractHost str = let dotsRx = "((\\w|-)+\\.)+(\\w|-)+" localhostRx = "localhost" rx = "(" ++ dotsRx ++ "|" ++ localhostRx ++ ")" in str |> rightFromOrSame "//" |> leftFromOrSame "/" |> Regex.find (Regex.AtMost 1) (Regex.regex rx) |> List.map .match |> List.head |> Maybe.withDefault "" parseHost : String -> List String parseHost str = str |> split "." host : String -> List String host str = parseHost (extractHost str) -- PORT {-| Extract the port from the url If no port is included in the url then Erl will attempt to add a default port: Http -> 80 Https -> 443 FTP -> 21 SFTP -> 22 -} extractPort : String -> Int extractPort str = let rx = Regex.regex ":\\d+" res = Regex.find (Regex.AtMost 1) rx str in res |> List.map .match |> List.head |> Maybe.withDefault "" |> String.dropLeft 1 |> toInt |> \result -> case result of Ok port_ -> port_ _ -> case extractProtocol str of "http" -> 80 "https" -> 443 "ftp" -> 21 "sftp" -> 22 _ -> 0 -- PATH {-| Extract the path from the url -} extractPath : String -> String extractPath str = let host = extractHost str in str |> rightFromOrSame "//" |> leftFromOrSame "?" |> leftFromOrSame "#" |> Regex.replace (Regex.AtMost 1) (Regex.regex host) (\_ -> "") |> Regex.replace (Regex.AtMost 1) (Regex.regex ":\\d+") (\_ -> "") parsePath : String -> List String parsePath str = str |> split "/" |> List.filter notEmpty |> List.map Http.decodeUri |> List.map (Maybe.withDefault "") pathFromAll : String -> List String pathFromAll str = parsePath (extractPath str) hasLeadingSlashFromAll : String -> Bool hasLeadingSlashFromAll str = Regex.contains (Regex.regex "^/") (extractPath str) hasTrailingSlashFromAll : String -> Bool hasTrailingSlashFromAll str = Regex.contains (Regex.regex "/$") (extractPath str) -- FRAGMENT {-| Extract the hash (hash) from the url -} extractHash : String -> String extractHash str = str |> split "#" |> List.drop 1 |> List.head |> Maybe.withDefault "" hashFromAll : String -> String hashFromAll str = extractHash str -- QUERY {-| Extract the query string from the url -} extractQuery : String -> String extractQuery str = str |> split "?" |> List.drop 1 |> List.head |> Maybe.withDefault "" |> split "#" |> List.head |> Maybe.withDefault "" -- "a=1" --> ("a", "1") queryStringElementToTuple : String -> ( String, String ) queryStringElementToTuple element = let splitted = split "=" element first = Maybe.withDefault "" (List.head splitted) firstDecoded = Http.decodeUri first |> Maybe.withDefault "" second = Maybe.withDefault "" (List.head (List.drop 1 splitted)) secondDecoded = Http.decodeUri second |> Maybe.withDefault "" in ( firstDecoded, secondDecoded ) -- "a=1&b=2" --> [("a", "1"), ("b", "2")] queryTuples : String -> List ( String, String ) queryTuples queryString = let splitted = split "&" queryString in if String.isEmpty queryString then [] else List.map queryStringElementToTuple splitted parseQuery : String -> Query parseQuery str = Dict.fromList (queryTuples str) queryFromAll : String -> Query queryFromAll all = all |> extractQuery |> parseQuery {-| Parse a url string, returns an Erl.Url record Erl.parse "http://api.example.com/users/1#x/1?a=1" == Erl.Url{...} -} parse : String -> Url parse str = { host = (host str) , hash = (hashFromAll str) , password = "" , path = (pathFromAll str) , hasLeadingSlash = (hasLeadingSlashFromAll str) , hasTrailingSlash = (hasTrailingSlashFromAll str) , port_ = (extractPort str) , protocol = (extractProtocol str) , query = (queryFromAll str) , username = "" } -- TO STRING {-| Convert to a string only the query component of an url, this includes '?' Erl.queryToString url == "?a=1&b=2" -} queryToString : Url -> String queryToString url = let tuples = Dict.toList url.query encodedTuples = List.map (\( x, y ) -> ( Http.encodeUri x, Http.encodeUri y )) tuples parts = List.map (\( a, b ) -> a ++ "=" ++ b) encodedTuples in if Dict.isEmpty url.query then "" else "?" ++ (join "&" parts) protocolComponent : Url -> String protocolComponent url = case url.protocol of "" -> "" _ -> url.protocol ++ "://" hostComponent : Url -> String hostComponent url = Http.encodeUri (join "." url.host) portComponent : Url -> String portComponent url = case url.port_ of 0 -> "" 80 -> "" _ -> ":" ++ (Basics.toString url.port_) pathComponent : Url -> String pathComponent url = let encoded = List.map Http.encodeUri url.path leadingSlash = if hostComponent url /= "" || url.hasLeadingSlash then "/" else "" in if (List.length url.path) == 0 then "" else leadingSlash ++ (join "/" encoded) trailingSlashComponent : Url -> String trailingSlashComponent url = if url.hasTrailingSlash == True then "/" else "" {-| Convert to a string the hash component of an url, this includes '#' queryToString url == "#a/b" -} hashToString : Url -> String hashToString url = if String.isEmpty url.hash then "" else "#" ++ url.hash {-| Generate an empty Erl.Url record Erl.new == { protocol = "" , username = "" , password = "" , host = [] , path = [] , hasLeadingSlash = False , hasTrailingSlash = False , port_ = 0 , hash = "" , query = Dict.empty } -} new : Url new = { protocol = "" , username = "" , password = "" , host = [] , path = [] , hasLeadingSlash = False , hasTrailingSlash = False , port_ = 0 , hash = "" , query = Dict.empty } {-| Clears the current query string Erl.clearQuery url -} clearQuery : Url -> Url clearQuery url = { url | query = Dict.empty } {-| Set key/value in query string Erl.addQuery key value url -} addQuery : String -> String -> Url -> Url addQuery key val url = let updated = if String.isEmpty val then Dict.remove key url.query else Dict.insert key val url.query in { url | query = updated } {-| Set key/value in query string, removes any existing ones Erl.setQuery key value url -} setQuery : String -> String -> Url -> Url setQuery key val url = let updated = Dict.singleton key val in { url | query = updated } {-| Removes key from query string Erl.removeQuery key url -} removeQuery : String -> Url -> Url removeQuery key url = let updated = Dict.remove key url.query in { url | query = updated } {-| Append some path segments to a url Erl.appendPathSegments ["hello", "world"] url -} appendPathSegments : List String -> Url -> Url appendPathSegments segments url = let newPath = List.append url.path segments in { url | path = newPath } {-| Generate url string from an Erl.Url record url = { protocol = "http", , username = "", , password = "", , host = ["www", "foo", "com"], , path = ["users", "1"], , hasLeadingSlash = False , hasTrailingSlash = False , port_ = 2000, , hash = "a/b", , query = Dict.empty |> Dict.insert "q" "1" |> Dict.insert "k" "2" } Erl.toString url == "http://www.foo.com:2000/users/1?k=2&q=1#a/b" -} toString : Url -> String toString url = let protocol_ = protocolComponent url host_ = hostComponent url port_ = portComponent url path_ = pathComponent url trailingSlash_ = trailingSlashComponent url query_ = queryToString url hash = hashToString url in protocol_ ++ host_ ++ port_ ++ path_ ++ trailingSlash_ ++ query_ ++ hash
13201
module Erl exposing (addQuery, clearQuery, extractHash, extractHost, extractPath, extractPort, extractProtocol, extractQuery, new, parse, removeQuery, setQuery, appendPathSegments, toString, queryToString, Url, Query) {-| Library for parsing and constructing URLs # Types @docs Url, Query # Parse @docs parse # Parse helpers @docs extractHash, extractHost, extractPath, extractProtocol, extractPort, extractQuery # Construct @docs new # Mutation helpers @docs addQuery, setQuery, removeQuery, clearQuery, appendPathSegments # Serialize @docs toString # Serialization helpers @docs queryToString -} import Dict import Http import Regex import String exposing (..) -- TYPES {-| A Dict that holds keys and values for the query string -} type alias Query = Dict.Dict String String {-| Record that holds url attributes -} type alias Url = { protocol : String , username : String , password : <PASSWORD> , host : List String , port_ : Int , path : List String , hasLeadingSlash : Bool , hasTrailingSlash : Bool , hash : String , query : Query } -- UTILS notEmpty : String -> Bool notEmpty str = not (isEmpty str) -- "aa#bb" --> "bb" rightFrom : String -> String -> String rightFrom delimiter str = let parts = split delimiter str in case List.length parts of 0 -> "" 1 -> "" _ -> parts |> List.reverse |> List.head |> Maybe.withDefault "" rightFromOrSame : String -> String -> String rightFromOrSame delimiter str = let parts = split delimiter str in parts |> List.reverse |> List.head |> Maybe.withDefault "" -- "a/b" -> "a" -- "a" => "a" -- "/b" => "" leftFromOrSame : String -> String -> String leftFromOrSame delimiter str = let parts = split delimiter str in parts |> List.head |> Maybe.withDefault "" -- "a/b" -> "a" -- "/b" -> "" -- "a" -> "" leftFrom : String -> String -> String leftFrom delimiter str = let parts = split delimiter str head = List.head parts in case List.length parts of 0 -> "" 1 -> "" _ -> head |> Maybe.withDefault "" -- PROTOCOL {-| Extract the protocol from the url -} extractProtocol : String -> String extractProtocol str = let parts = split "://" str in case List.length parts of 1 -> "" _ -> Maybe.withDefault "" (List.head parts) -- HOST {-| Extract the host from the url -} -- valid host: a-z 0-9 and - extractHost : String -> String extractHost str = let dotsRx = "((\\w|-)+\\.)+(\\w|-)+" localhostRx = "localhost" rx = "(" ++ dotsRx ++ "|" ++ localhostRx ++ ")" in str |> rightFromOrSame "//" |> leftFromOrSame "/" |> Regex.find (Regex.AtMost 1) (Regex.regex rx) |> List.map .match |> List.head |> Maybe.withDefault "" parseHost : String -> List String parseHost str = str |> split "." host : String -> List String host str = parseHost (extractHost str) -- PORT {-| Extract the port from the url If no port is included in the url then Erl will attempt to add a default port: Http -> 80 Https -> 443 FTP -> 21 SFTP -> 22 -} extractPort : String -> Int extractPort str = let rx = Regex.regex ":\\d+" res = Regex.find (Regex.AtMost 1) rx str in res |> List.map .match |> List.head |> Maybe.withDefault "" |> String.dropLeft 1 |> toInt |> \result -> case result of Ok port_ -> port_ _ -> case extractProtocol str of "http" -> 80 "https" -> 443 "ftp" -> 21 "sftp" -> 22 _ -> 0 -- PATH {-| Extract the path from the url -} extractPath : String -> String extractPath str = let host = extractHost str in str |> rightFromOrSame "//" |> leftFromOrSame "?" |> leftFromOrSame "#" |> Regex.replace (Regex.AtMost 1) (Regex.regex host) (\_ -> "") |> Regex.replace (Regex.AtMost 1) (Regex.regex ":\\d+") (\_ -> "") parsePath : String -> List String parsePath str = str |> split "/" |> List.filter notEmpty |> List.map Http.decodeUri |> List.map (Maybe.withDefault "") pathFromAll : String -> List String pathFromAll str = parsePath (extractPath str) hasLeadingSlashFromAll : String -> Bool hasLeadingSlashFromAll str = Regex.contains (Regex.regex "^/") (extractPath str) hasTrailingSlashFromAll : String -> Bool hasTrailingSlashFromAll str = Regex.contains (Regex.regex "/$") (extractPath str) -- FRAGMENT {-| Extract the hash (hash) from the url -} extractHash : String -> String extractHash str = str |> split "#" |> List.drop 1 |> List.head |> Maybe.withDefault "" hashFromAll : String -> String hashFromAll str = extractHash str -- QUERY {-| Extract the query string from the url -} extractQuery : String -> String extractQuery str = str |> split "?" |> List.drop 1 |> List.head |> Maybe.withDefault "" |> split "#" |> List.head |> Maybe.withDefault "" -- "a=1" --> ("a", "1") queryStringElementToTuple : String -> ( String, String ) queryStringElementToTuple element = let splitted = split "=" element first = Maybe.withDefault "" (List.head splitted) firstDecoded = Http.decodeUri first |> Maybe.withDefault "" second = Maybe.withDefault "" (List.head (List.drop 1 splitted)) secondDecoded = Http.decodeUri second |> Maybe.withDefault "" in ( firstDecoded, secondDecoded ) -- "a=1&b=2" --> [("a", "1"), ("b", "2")] queryTuples : String -> List ( String, String ) queryTuples queryString = let splitted = split "&" queryString in if String.isEmpty queryString then [] else List.map queryStringElementToTuple splitted parseQuery : String -> Query parseQuery str = Dict.fromList (queryTuples str) queryFromAll : String -> Query queryFromAll all = all |> extractQuery |> parseQuery {-| Parse a url string, returns an Erl.Url record Erl.parse "http://api.example.com/users/1#x/1?a=1" == Erl.Url{...} -} parse : String -> Url parse str = { host = (host str) , hash = (hashFromAll str) , password = "" , path = (pathFromAll str) , hasLeadingSlash = (hasLeadingSlashFromAll str) , hasTrailingSlash = (hasTrailingSlashFromAll str) , port_ = (extractPort str) , protocol = (extractProtocol str) , query = (queryFromAll str) , username = "" } -- TO STRING {-| Convert to a string only the query component of an url, this includes '?' Erl.queryToString url == "?a=1&b=2" -} queryToString : Url -> String queryToString url = let tuples = Dict.toList url.query encodedTuples = List.map (\( x, y ) -> ( Http.encodeUri x, Http.encodeUri y )) tuples parts = List.map (\( a, b ) -> a ++ "=" ++ b) encodedTuples in if Dict.isEmpty url.query then "" else "?" ++ (join "&" parts) protocolComponent : Url -> String protocolComponent url = case url.protocol of "" -> "" _ -> url.protocol ++ "://" hostComponent : Url -> String hostComponent url = Http.encodeUri (join "." url.host) portComponent : Url -> String portComponent url = case url.port_ of 0 -> "" 80 -> "" _ -> ":" ++ (Basics.toString url.port_) pathComponent : Url -> String pathComponent url = let encoded = List.map Http.encodeUri url.path leadingSlash = if hostComponent url /= "" || url.hasLeadingSlash then "/" else "" in if (List.length url.path) == 0 then "" else leadingSlash ++ (join "/" encoded) trailingSlashComponent : Url -> String trailingSlashComponent url = if url.hasTrailingSlash == True then "/" else "" {-| Convert to a string the hash component of an url, this includes '#' queryToString url == "#a/b" -} hashToString : Url -> String hashToString url = if String.isEmpty url.hash then "" else "#" ++ url.hash {-| Generate an empty Erl.Url record Erl.new == { protocol = "" , username = "" , password = "" , host = [] , path = [] , hasLeadingSlash = False , hasTrailingSlash = False , port_ = 0 , hash = "" , query = Dict.empty } -} new : Url new = { protocol = "" , username = "" , password = "" , host = [] , path = [] , hasLeadingSlash = False , hasTrailingSlash = False , port_ = 0 , hash = "" , query = Dict.empty } {-| Clears the current query string Erl.clearQuery url -} clearQuery : Url -> Url clearQuery url = { url | query = Dict.empty } {-| Set key/value in query string Erl.addQuery key value url -} addQuery : String -> String -> Url -> Url addQuery key val url = let updated = if String.isEmpty val then Dict.remove key url.query else Dict.insert key val url.query in { url | query = updated } {-| Set key/value in query string, removes any existing ones Erl.setQuery key value url -} setQuery : String -> String -> Url -> Url setQuery key val url = let updated = Dict.singleton key val in { url | query = updated } {-| Removes key from query string Erl.removeQuery key url -} removeQuery : String -> Url -> Url removeQuery key url = let updated = Dict.remove key url.query in { url | query = updated } {-| Append some path segments to a url Erl.appendPathSegments ["hello", "world"] url -} appendPathSegments : List String -> Url -> Url appendPathSegments segments url = let newPath = List.append url.path segments in { url | path = newPath } {-| Generate url string from an Erl.Url record url = { protocol = "http", , username = "", , password = "", , host = ["www", "foo", "com"], , path = ["users", "1"], , hasLeadingSlash = False , hasTrailingSlash = False , port_ = 2000, , hash = "a/b", , query = Dict.empty |> Dict.insert "q" "1" |> Dict.insert "k" "2" } Erl.toString url == "http://www.foo.com:2000/users/1?k=2&q=1#a/b" -} toString : Url -> String toString url = let protocol_ = protocolComponent url host_ = hostComponent url port_ = portComponent url path_ = pathComponent url trailingSlash_ = trailingSlashComponent url query_ = queryToString url hash = hashToString url in protocol_ ++ host_ ++ port_ ++ path_ ++ trailingSlash_ ++ query_ ++ hash
true
module Erl exposing (addQuery, clearQuery, extractHash, extractHost, extractPath, extractPort, extractProtocol, extractQuery, new, parse, removeQuery, setQuery, appendPathSegments, toString, queryToString, Url, Query) {-| Library for parsing and constructing URLs # Types @docs Url, Query # Parse @docs parse # Parse helpers @docs extractHash, extractHost, extractPath, extractProtocol, extractPort, extractQuery # Construct @docs new # Mutation helpers @docs addQuery, setQuery, removeQuery, clearQuery, appendPathSegments # Serialize @docs toString # Serialization helpers @docs queryToString -} import Dict import Http import Regex import String exposing (..) -- TYPES {-| A Dict that holds keys and values for the query string -} type alias Query = Dict.Dict String String {-| Record that holds url attributes -} type alias Url = { protocol : String , username : String , password : PI:PASSWORD:<PASSWORD>END_PI , host : List String , port_ : Int , path : List String , hasLeadingSlash : Bool , hasTrailingSlash : Bool , hash : String , query : Query } -- UTILS notEmpty : String -> Bool notEmpty str = not (isEmpty str) -- "aa#bb" --> "bb" rightFrom : String -> String -> String rightFrom delimiter str = let parts = split delimiter str in case List.length parts of 0 -> "" 1 -> "" _ -> parts |> List.reverse |> List.head |> Maybe.withDefault "" rightFromOrSame : String -> String -> String rightFromOrSame delimiter str = let parts = split delimiter str in parts |> List.reverse |> List.head |> Maybe.withDefault "" -- "a/b" -> "a" -- "a" => "a" -- "/b" => "" leftFromOrSame : String -> String -> String leftFromOrSame delimiter str = let parts = split delimiter str in parts |> List.head |> Maybe.withDefault "" -- "a/b" -> "a" -- "/b" -> "" -- "a" -> "" leftFrom : String -> String -> String leftFrom delimiter str = let parts = split delimiter str head = List.head parts in case List.length parts of 0 -> "" 1 -> "" _ -> head |> Maybe.withDefault "" -- PROTOCOL {-| Extract the protocol from the url -} extractProtocol : String -> String extractProtocol str = let parts = split "://" str in case List.length parts of 1 -> "" _ -> Maybe.withDefault "" (List.head parts) -- HOST {-| Extract the host from the url -} -- valid host: a-z 0-9 and - extractHost : String -> String extractHost str = let dotsRx = "((\\w|-)+\\.)+(\\w|-)+" localhostRx = "localhost" rx = "(" ++ dotsRx ++ "|" ++ localhostRx ++ ")" in str |> rightFromOrSame "//" |> leftFromOrSame "/" |> Regex.find (Regex.AtMost 1) (Regex.regex rx) |> List.map .match |> List.head |> Maybe.withDefault "" parseHost : String -> List String parseHost str = str |> split "." host : String -> List String host str = parseHost (extractHost str) -- PORT {-| Extract the port from the url If no port is included in the url then Erl will attempt to add a default port: Http -> 80 Https -> 443 FTP -> 21 SFTP -> 22 -} extractPort : String -> Int extractPort str = let rx = Regex.regex ":\\d+" res = Regex.find (Regex.AtMost 1) rx str in res |> List.map .match |> List.head |> Maybe.withDefault "" |> String.dropLeft 1 |> toInt |> \result -> case result of Ok port_ -> port_ _ -> case extractProtocol str of "http" -> 80 "https" -> 443 "ftp" -> 21 "sftp" -> 22 _ -> 0 -- PATH {-| Extract the path from the url -} extractPath : String -> String extractPath str = let host = extractHost str in str |> rightFromOrSame "//" |> leftFromOrSame "?" |> leftFromOrSame "#" |> Regex.replace (Regex.AtMost 1) (Regex.regex host) (\_ -> "") |> Regex.replace (Regex.AtMost 1) (Regex.regex ":\\d+") (\_ -> "") parsePath : String -> List String parsePath str = str |> split "/" |> List.filter notEmpty |> List.map Http.decodeUri |> List.map (Maybe.withDefault "") pathFromAll : String -> List String pathFromAll str = parsePath (extractPath str) hasLeadingSlashFromAll : String -> Bool hasLeadingSlashFromAll str = Regex.contains (Regex.regex "^/") (extractPath str) hasTrailingSlashFromAll : String -> Bool hasTrailingSlashFromAll str = Regex.contains (Regex.regex "/$") (extractPath str) -- FRAGMENT {-| Extract the hash (hash) from the url -} extractHash : String -> String extractHash str = str |> split "#" |> List.drop 1 |> List.head |> Maybe.withDefault "" hashFromAll : String -> String hashFromAll str = extractHash str -- QUERY {-| Extract the query string from the url -} extractQuery : String -> String extractQuery str = str |> split "?" |> List.drop 1 |> List.head |> Maybe.withDefault "" |> split "#" |> List.head |> Maybe.withDefault "" -- "a=1" --> ("a", "1") queryStringElementToTuple : String -> ( String, String ) queryStringElementToTuple element = let splitted = split "=" element first = Maybe.withDefault "" (List.head splitted) firstDecoded = Http.decodeUri first |> Maybe.withDefault "" second = Maybe.withDefault "" (List.head (List.drop 1 splitted)) secondDecoded = Http.decodeUri second |> Maybe.withDefault "" in ( firstDecoded, secondDecoded ) -- "a=1&b=2" --> [("a", "1"), ("b", "2")] queryTuples : String -> List ( String, String ) queryTuples queryString = let splitted = split "&" queryString in if String.isEmpty queryString then [] else List.map queryStringElementToTuple splitted parseQuery : String -> Query parseQuery str = Dict.fromList (queryTuples str) queryFromAll : String -> Query queryFromAll all = all |> extractQuery |> parseQuery {-| Parse a url string, returns an Erl.Url record Erl.parse "http://api.example.com/users/1#x/1?a=1" == Erl.Url{...} -} parse : String -> Url parse str = { host = (host str) , hash = (hashFromAll str) , password = "" , path = (pathFromAll str) , hasLeadingSlash = (hasLeadingSlashFromAll str) , hasTrailingSlash = (hasTrailingSlashFromAll str) , port_ = (extractPort str) , protocol = (extractProtocol str) , query = (queryFromAll str) , username = "" } -- TO STRING {-| Convert to a string only the query component of an url, this includes '?' Erl.queryToString url == "?a=1&b=2" -} queryToString : Url -> String queryToString url = let tuples = Dict.toList url.query encodedTuples = List.map (\( x, y ) -> ( Http.encodeUri x, Http.encodeUri y )) tuples parts = List.map (\( a, b ) -> a ++ "=" ++ b) encodedTuples in if Dict.isEmpty url.query then "" else "?" ++ (join "&" parts) protocolComponent : Url -> String protocolComponent url = case url.protocol of "" -> "" _ -> url.protocol ++ "://" hostComponent : Url -> String hostComponent url = Http.encodeUri (join "." url.host) portComponent : Url -> String portComponent url = case url.port_ of 0 -> "" 80 -> "" _ -> ":" ++ (Basics.toString url.port_) pathComponent : Url -> String pathComponent url = let encoded = List.map Http.encodeUri url.path leadingSlash = if hostComponent url /= "" || url.hasLeadingSlash then "/" else "" in if (List.length url.path) == 0 then "" else leadingSlash ++ (join "/" encoded) trailingSlashComponent : Url -> String trailingSlashComponent url = if url.hasTrailingSlash == True then "/" else "" {-| Convert to a string the hash component of an url, this includes '#' queryToString url == "#a/b" -} hashToString : Url -> String hashToString url = if String.isEmpty url.hash then "" else "#" ++ url.hash {-| Generate an empty Erl.Url record Erl.new == { protocol = "" , username = "" , password = "" , host = [] , path = [] , hasLeadingSlash = False , hasTrailingSlash = False , port_ = 0 , hash = "" , query = Dict.empty } -} new : Url new = { protocol = "" , username = "" , password = "" , host = [] , path = [] , hasLeadingSlash = False , hasTrailingSlash = False , port_ = 0 , hash = "" , query = Dict.empty } {-| Clears the current query string Erl.clearQuery url -} clearQuery : Url -> Url clearQuery url = { url | query = Dict.empty } {-| Set key/value in query string Erl.addQuery key value url -} addQuery : String -> String -> Url -> Url addQuery key val url = let updated = if String.isEmpty val then Dict.remove key url.query else Dict.insert key val url.query in { url | query = updated } {-| Set key/value in query string, removes any existing ones Erl.setQuery key value url -} setQuery : String -> String -> Url -> Url setQuery key val url = let updated = Dict.singleton key val in { url | query = updated } {-| Removes key from query string Erl.removeQuery key url -} removeQuery : String -> Url -> Url removeQuery key url = let updated = Dict.remove key url.query in { url | query = updated } {-| Append some path segments to a url Erl.appendPathSegments ["hello", "world"] url -} appendPathSegments : List String -> Url -> Url appendPathSegments segments url = let newPath = List.append url.path segments in { url | path = newPath } {-| Generate url string from an Erl.Url record url = { protocol = "http", , username = "", , password = "", , host = ["www", "foo", "com"], , path = ["users", "1"], , hasLeadingSlash = False , hasTrailingSlash = False , port_ = 2000, , hash = "a/b", , query = Dict.empty |> Dict.insert "q" "1" |> Dict.insert "k" "2" } Erl.toString url == "http://www.foo.com:2000/users/1?k=2&q=1#a/b" -} toString : Url -> String toString url = let protocol_ = protocolComponent url host_ = hostComponent url port_ = portComponent url path_ = pathComponent url trailingSlash_ = trailingSlashComponent url query_ = queryToString url hash = hashToString url in protocol_ ++ host_ ++ port_ ++ path_ ++ trailingSlash_ ++ query_ ++ hash
elm
[ { "context": "\n , ( \"Yacute\", 221 )\n , ( \"THORN\", 222 )\n , ( \"szlig\", 223 )\n ", "end": 10487, "score": 0.9871874452, "start": 10482, "tag": "NAME", "value": "THORN" }, { "context": " , ( \"aring\", 229 )\n , ( \"aelig\", 230 )\n , ( \"ccedil\", 231 )\n ", "end": 10737, "score": 0.6768096685, "start": 10735, "tag": "NAME", "value": "ig" }, { "context": " , ( \"aelig\", 230 )\n , ( \"ccedil\", 231 )\n , ( \"egrave\", 232 )\n ", "end": 10769, "score": 0.7106183767, "start": 10765, "tag": "NAME", "value": "edil" }, { "context": "\n , ( \"divide\", 247 )\n , ( \"oslash\", 248 )\n , ( \"ugrave\", 249 )\n ", "end": 11301, "score": 0.6853521466, "start": 11295, "tag": "NAME", "value": "oslash" }, { "context": " )\n , ( \"yuml\", 255 )\n , ( \"Amacr\", 256 )\n , ( \"amacr\", 257 )\n ", "end": 11550, "score": 0.9996128082, "start": 11545, "tag": "NAME", "value": "Amacr" }, { "context": ")\n , ( \"Amacr\", 256 )\n , ( \"amacr\", 257 )\n , ( \"Abreve\", 258 )\n ", "end": 11581, "score": 0.9887639284, "start": 11576, "tag": "NAME", "value": "amacr" }, { "context": ")\n , ( \"amacr\", 257 )\n , ( \"Abreve\", 258 )\n , ( \"abreve\", 259 )\n ", "end": 11613, "score": 0.9992912412, "start": 11607, "tag": "NAME", "value": "Abreve" }, { "context": "\n , ( \"Abreve\", 258 )\n , ( \"abreve\", 259 )\n , ( \"Aogon\", 260 )\n ", "end": 11645, "score": 0.9988397956, "start": 11639, "tag": "NAME", "value": "abreve" }, { "context": "\n , ( \"abreve\", 259 )\n , ( \"Aogon\", 260 )\n , ( \"aogon\", 261 )\n ", "end": 11676, "score": 0.9996030927, "start": 11671, "tag": "NAME", "value": "Aogon" }, { "context": ")\n , ( \"Aogon\", 260 )\n , ( \"aogon\", 261 )\n , ( \"Cacute\", 262 )\n ", "end": 11707, "score": 0.9978640676, "start": 11702, "tag": "NAME", "value": "aogon" }, { "context": ")\n , ( \"aogon\", 261 )\n , ( \"Cacute\", 262 )\n , ( \"cacute\", 263 )\n ", "end": 11739, "score": 0.9953759909, "start": 11733, "tag": "NAME", "value": "Cacute" }, { "context": " , ( \"Cacute\", 262 )\n , ( \"cacute\", 263 )\n , ( \"Ccirc\", 264 )\n ", "end": 11771, "score": 0.6758944392, "start": 11766, "tag": "NAME", "value": "acute" }, { "context": "\n , ( \"cacute\", 263 )\n , ( \"Ccirc\", 264 )\n , ( \"ccirc\", 265 )\n ", "end": 11802, "score": 0.899799943, "start": 11797, "tag": "NAME", "value": "Ccirc" }, { "context": ")\n , ( \"Ccirc\", 264 )\n , ( \"ccirc\", 265 )\n , ( \"Cdod\", 266 )\n ", "end": 11833, "score": 0.8897665143, "start": 11828, "tag": "NAME", "value": "ccirc" }, { "context": ")\n , ( \"ccirc\", 265 )\n , ( \"Cdod\", 266 )\n , ( \"cdot\", 267 )\n ", "end": 11863, "score": 0.9992750883, "start": 11859, "tag": "NAME", "value": "Cdod" }, { "context": " )\n , ( \"Cdod\", 266 )\n , ( \"cdot\", 267 )\n , ( \"Ccaron\", 268 )\n ", "end": 11893, "score": 0.9887586832, "start": 11889, "tag": "NAME", "value": "cdot" }, { "context": " )\n , ( \"cdot\", 267 )\n , ( \"Ccaron\", 268 )\n , ( \"ccaron\", 269 )\n ", "end": 11925, "score": 0.9996632934, "start": 11919, "tag": "NAME", "value": "Ccaron" }, { "context": "\n , ( \"Ccaron\", 268 )\n , ( \"ccaron\", 269 )\n , ( \"Dcaron\", 270 )\n ", "end": 11957, "score": 0.9981338978, "start": 11951, "tag": "NAME", "value": "ccaron" }, { "context": "\n , ( \"ccaron\", 269 )\n , ( \"Dcaron\", 270 )\n , ( \"dcaron\", 271 )\n ", "end": 11989, "score": 0.9996420741, "start": 11983, "tag": "NAME", "value": "Dcaron" }, { "context": "\n , ( \"Dcaron\", 270 )\n , ( \"dcaron\", 271 )\n , ( \"Dstork\", 272 )\n ", "end": 12021, "score": 0.998996377, "start": 12015, "tag": "NAME", "value": "dcaron" }, { "context": "\n , ( \"dcaron\", 271 )\n , ( \"Dstork\", 272 )\n , ( \"dstork\", 273 )\n ", "end": 12053, "score": 0.9990030527, "start": 12047, "tag": "NAME", "value": "Dstork" }, { "context": "\n , ( \"Dstork\", 272 )\n , ( \"dstork\", 273 )\n , ( \"Emacr\", 274 )\n ", "end": 12085, "score": 0.9952553511, "start": 12079, "tag": "NAME", "value": "dstork" }, { "context": "\n , ( \"dstork\", 273 )\n , ( \"Emacr\", 274 )\n , ( \"emacr\", 275 )\n ", "end": 12116, "score": 0.9994934201, "start": 12111, "tag": "NAME", "value": "Emacr" }, { "context": ")\n , ( \"Emacr\", 274 )\n , ( \"emacr\", 275 )\n , ( \"Edot\", 278 )\n ", "end": 12147, "score": 0.9960035086, "start": 12142, "tag": "NAME", "value": "emacr" }, { "context": ")\n , ( \"emacr\", 275 )\n , ( \"Edot\", 278 )\n , ( \"edot\", 279 )\n ", "end": 12177, "score": 0.9988822937, "start": 12173, "tag": "NAME", "value": "Edot" }, { "context": "\n , ( \"Edot\", 278 )\n , ( \"edot\", 279 )\n , ( \"Eogon\", 280 )\n ", "end": 12207, "score": 0.5924134254, "start": 12205, "tag": "NAME", "value": "ot" }, { "context": " )\n , ( \"edot\", 279 )\n , ( \"Eogon\", 280 )\n , ( \"eogon\", 281 )\n ", "end": 12238, "score": 0.9994217753, "start": 12233, "tag": "NAME", "value": "Eogon" }, { "context": ")\n , ( \"Eogon\", 280 )\n , ( \"eogon\", 281 )\n , ( \"Ecaron\", 282 )\n ", "end": 12269, "score": 0.9919217229, "start": 12264, "tag": "NAME", "value": "eogon" }, { "context": ")\n , ( \"eogon\", 281 )\n , ( \"Ecaron\", 282 )\n , ( \"ecaron\", 283 )\n ", "end": 12301, "score": 0.9996595383, "start": 12295, "tag": "NAME", "value": "Ecaron" }, { "context": "\n , ( \"Ecaron\", 282 )\n , ( \"ecaron\", 283 )\n , ( \"Gcirc\", 284 )\n ", "end": 12333, "score": 0.9954553246, "start": 12327, "tag": "NAME", "value": "ecaron" }, { "context": "\n , ( \"ecaron\", 283 )\n , ( \"Gcirc\", 284 )\n , ( \"gcirc\", 285 )\n ", "end": 12364, "score": 0.9912209511, "start": 12359, "tag": "NAME", "value": "Gcirc" }, { "context": ")\n , ( \"Gcirc\", 284 )\n , ( \"gcirc\", 285 )\n , ( \"Gbreve\", 286 )\n ", "end": 12395, "score": 0.708283782, "start": 12390, "tag": "NAME", "value": "gcirc" }, { "context": ")\n , ( \"gcirc\", 285 )\n , ( \"Gbreve\", 286 )\n , ( \"gbreve\", 287 )\n ", "end": 12427, "score": 0.9993460774, "start": 12421, "tag": "NAME", "value": "Gbreve" }, { "context": "\n , ( \"Gbreve\", 286 )\n , ( \"gbreve\", 287 )\n , ( \"Gdot\", 288 )\n ", "end": 12459, "score": 0.9957005382, "start": 12453, "tag": "NAME", "value": "gbreve" }, { "context": "\n , ( \"gbreve\", 287 )\n , ( \"Gdot\", 288 )\n , ( \"gdot\", 289 )\n ", "end": 12489, "score": 0.996722579, "start": 12485, "tag": "NAME", "value": "Gdot" }, { "context": " )\n , ( \"Gdot\", 288 )\n , ( \"gdot\", 289 )\n , ( \"Gcedil\", 290 )\n ", "end": 12519, "score": 0.9580534697, "start": 12515, "tag": "NAME", "value": "gdot" }, { "context": " )\n , ( \"gdot\", 289 )\n , ( \"Gcedil\", 290 )\n , ( \"gcedil\", 291 )\n ", "end": 12551, "score": 0.9995775223, "start": 12545, "tag": "NAME", "value": "Gcedil" }, { "context": "\n , ( \"Gcedil\", 290 )\n , ( \"gcedil\", 291 )\n , ( \"Hcirc\", 292 )\n ", "end": 12583, "score": 0.9678845406, "start": 12577, "tag": "NAME", "value": "gcedil" }, { "context": "\n , ( \"gcedil\", 291 )\n , ( \"Hcirc\", 292 )\n , ( \"hcirc\", 293 )\n ", "end": 12614, "score": 0.9977309108, "start": 12609, "tag": "NAME", "value": "Hcirc" }, { "context": ")\n , ( \"Hcirc\", 292 )\n , ( \"hcirc\", 293 )\n , ( \"Hstork\", 294 )\n ", "end": 12645, "score": 0.8027238846, "start": 12640, "tag": "NAME", "value": "hcirc" }, { "context": ")\n , ( \"hcirc\", 293 )\n , ( \"Hstork\", 294 )\n , ( \"hstork\", 295 )\n ", "end": 12677, "score": 0.9977855682, "start": 12671, "tag": "NAME", "value": "Hstork" }, { "context": "\n , ( \"Hstork\", 294 )\n , ( \"hstork\", 295 )\n , ( \"Itilde\", 296 )\n ", "end": 12709, "score": 0.9267372489, "start": 12703, "tag": "NAME", "value": "hstork" }, { "context": "\n , ( \"hstork\", 295 )\n , ( \"Itilde\", 296 )\n , ( \"itilde\", 297 )\n ", "end": 12741, "score": 0.9991916418, "start": 12735, "tag": "NAME", "value": "Itilde" }, { "context": "\n , ( \"Itilde\", 296 )\n , ( \"itilde\", 297 )\n , ( \"Imacr\", 298 )\n ", "end": 12773, "score": 0.9831454754, "start": 12767, "tag": "NAME", "value": "itilde" }, { "context": "\n , ( \"itilde\", 297 )\n , ( \"Imacr\", 298 )\n , ( \"imacr\", 299 )\n ", "end": 12804, "score": 0.9988219142, "start": 12799, "tag": "NAME", "value": "Imacr" }, { "context": ")\n , ( \"Imacr\", 298 )\n , ( \"imacr\", 299 )\n , ( \"Iogon\", 302 )\n ", "end": 12835, "score": 0.9859569669, "start": 12830, "tag": "NAME", "value": "imacr" }, { "context": ")\n , ( \"imacr\", 299 )\n , ( \"Iogon\", 302 )\n , ( \"iogon\", 303 )\n ", "end": 12866, "score": 0.9994611144, "start": 12861, "tag": "NAME", "value": "Iogon" }, { "context": ")\n , ( \"Iogon\", 302 )\n , ( \"iogon\", 303 )\n , ( \"Idot\", 304 )\n ", "end": 12897, "score": 0.9953209162, "start": 12892, "tag": "NAME", "value": "iogon" }, { "context": ")\n , ( \"iogon\", 303 )\n , ( \"Idot\", 304 )\n , ( \"inodot\", 305 )\n ", "end": 12927, "score": 0.998585403, "start": 12923, "tag": "NAME", "value": "Idot" }, { "context": " )\n , ( \"Idot\", 304 )\n , ( \"inodot\", 305 )\n , ( \"IJlog\", 306 )\n ", "end": 12959, "score": 0.7617451549, "start": 12953, "tag": "NAME", "value": "inodot" }, { "context": "\n , ( \"inodot\", 305 )\n , ( \"IJlog\", 306 )\n , ( \"ijlig\", 307 )\n ", "end": 12990, "score": 0.992359519, "start": 12985, "tag": "NAME", "value": "IJlog" }, { "context": ")\n , ( \"IJlog\", 306 )\n , ( \"ijlig\", 307 )\n , ( \"Jcirc\", 308 )\n ", "end": 13021, "score": 0.8110989928, "start": 13016, "tag": "NAME", "value": "ijlig" }, { "context": ")\n , ( \"ijlig\", 307 )\n , ( \"Jcirc\", 308 )\n , ( \"jcirc\", 309 )\n ", "end": 13052, "score": 0.9968686104, "start": 13047, "tag": "NAME", "value": "Jcirc" }, { "context": ")\n , ( \"Jcirc\", 308 )\n , ( \"jcirc\", 309 )\n , ( \"Kcedil\", 310 )\n ", "end": 13083, "score": 0.9534862041, "start": 13078, "tag": "NAME", "value": "jcirc" }, { "context": ")\n , ( \"jcirc\", 309 )\n , ( \"Kcedil\", 310 )\n , ( \"kcedil\", 311 )\n ", "end": 13115, "score": 0.9995864034, "start": 13109, "tag": "NAME", "value": "Kcedil" }, { "context": "\n , ( \"Kcedil\", 310 )\n , ( \"kcedil\", 311 )\n , ( \"kgreen\", 312 )\n ", "end": 13147, "score": 0.9937235713, "start": 13141, "tag": "NAME", "value": "kcedil" }, { "context": "\n , ( \"kcedil\", 311 )\n , ( \"kgreen\", 312 )\n , ( \"Lacute\", 313 )\n ", "end": 13179, "score": 0.867228508, "start": 13173, "tag": "NAME", "value": "kgreen" }, { "context": "\n , ( \"kgreen\", 312 )\n , ( \"Lacute\", 313 )\n , ( \"lacute\", 314 )\n ", "end": 13211, "score": 0.9952001572, "start": 13205, "tag": "NAME", "value": "Lacute" }, { "context": "\n , ( \"Lacute\", 313 )\n , ( \"lacute\", 314 )\n , ( \"Lcedil\", 315 )\n ", "end": 13243, "score": 0.6596598625, "start": 13237, "tag": "NAME", "value": "lacute" }, { "context": "\n , ( \"lacute\", 314 )\n , ( \"Lcedil\", 315 )\n , ( \"lcedil\", 316 )\n ", "end": 13275, "score": 0.9991777539, "start": 13269, "tag": "NAME", "value": "Lcedil" }, { "context": "\n , ( \"Lcedil\", 315 )\n , ( \"lcedil\", 316 )\n , ( \"Lcaron\", 317 )\n ", "end": 13307, "score": 0.9723520279, "start": 13301, "tag": "NAME", "value": "lcedil" }, { "context": "\n , ( \"lcedil\", 316 )\n , ( \"Lcaron\", 317 )\n , ( \"lcaron\", 318 )\n ", "end": 13339, "score": 0.9995756149, "start": 13333, "tag": "NAME", "value": "Lcaron" }, { "context": "\n , ( \"Lcaron\", 317 )\n , ( \"lcaron\", 318 )\n , ( \"Lmodot\", 319 )\n ", "end": 13371, "score": 0.9874164462, "start": 13365, "tag": "NAME", "value": "lcaron" }, { "context": "\n , ( \"lcaron\", 318 )\n , ( \"Lmodot\", 319 )\n , ( \"lmidot\", 320 )\n ", "end": 13403, "score": 0.9965379238, "start": 13397, "tag": "NAME", "value": "Lmodot" }, { "context": "\n , ( \"Lmodot\", 319 )\n , ( \"lmidot\", 320 )\n , ( \"Lstork\", 321 )\n ", "end": 13435, "score": 0.7987267375, "start": 13429, "tag": "NAME", "value": "lmidot" }, { "context": "\n , ( \"lmidot\", 320 )\n , ( \"Lstork\", 321 )\n , ( \"lstork\", 322 )\n ", "end": 13467, "score": 0.9949961901, "start": 13461, "tag": "NAME", "value": "Lstork" }, { "context": "\n , ( \"Lstork\", 321 )\n , ( \"lstork\", 322 )\n , ( \"Nacute\", 323 )\n ", "end": 13499, "score": 0.8241442442, "start": 13493, "tag": "NAME", "value": "lstork" }, { "context": "\n , ( \"lstork\", 322 )\n , ( \"Nacute\", 323 )\n , ( \"nacute\", 324 )\n ", "end": 13531, "score": 0.9936606884, "start": 13525, "tag": "NAME", "value": "Nacute" }, { "context": "\n , ( \"Nacute\", 323 )\n , ( \"nacute\", 324 )\n , ( \"Ncedil\", 325 )\n ", "end": 13563, "score": 0.6697736382, "start": 13557, "tag": "NAME", "value": "nacute" }, { "context": "\n , ( \"nacute\", 324 )\n , ( \"Ncedil\", 325 )\n , ( \"ncedil\", 326 )\n ", "end": 13595, "score": 0.9995592237, "start": 13589, "tag": "NAME", "value": "Ncedil" }, { "context": "\n , ( \"Ncedil\", 325 )\n , ( \"ncedil\", 326 )\n , ( \"Ncaron\", 327 )\n ", "end": 13627, "score": 0.821044445, "start": 13621, "tag": "NAME", "value": "ncedil" }, { "context": "\n , ( \"ncedil\", 326 )\n , ( \"Ncaron\", 327 )\n , ( \"ncaron\", 328 )\n ", "end": 13659, "score": 0.9994357228, "start": 13653, "tag": "NAME", "value": "Ncaron" }, { "context": "\n , ( \"Ncaron\", 327 )\n , ( \"ncaron\", 328 )\n , ( \"napos\", 329 )\n ", "end": 13691, "score": 0.9696490765, "start": 13685, "tag": "NAME", "value": "ncaron" }, { "context": "\n , ( \"ncaron\", 328 )\n , ( \"napos\", 329 )\n , ( \"ENG\", 330 )\n ", "end": 13722, "score": 0.9632483721, "start": 13717, "tag": "NAME", "value": "napos" }, { "context": ")\n , ( \"napos\", 329 )\n , ( \"ENG\", 330 )\n , ( \"eng\", 331 )\n ", "end": 13751, "score": 0.8550843, "start": 13748, "tag": "NAME", "value": "ENG" }, { "context": "9 )\n , ( \"ENG\", 330 )\n , ( \"eng\", 331 )\n , ( \"Omacr\", 332 )\n ", "end": 13780, "score": 0.9409588575, "start": 13777, "tag": "NAME", "value": "eng" }, { "context": "0 )\n , ( \"eng\", 331 )\n , ( \"Omacr\", 332 )\n , ( \"omacr\", 333 )\n ", "end": 13811, "score": 0.9995276928, "start": 13806, "tag": "NAME", "value": "Omacr" }, { "context": ")\n , ( \"Omacr\", 332 )\n , ( \"omacr\", 333 )\n , ( \"Odblac\", 336 )\n ", "end": 13842, "score": 0.9989007711, "start": 13837, "tag": "NAME", "value": "omacr" }, { "context": ")\n , ( \"omacr\", 333 )\n , ( \"Odblac\", 336 )\n , ( \"odblac\", 337 )\n ", "end": 13874, "score": 0.9993948936, "start": 13868, "tag": "NAME", "value": "Odblac" }, { "context": "\n , ( \"Odblac\", 336 )\n , ( \"odblac\", 337 )\n , ( \"OEling\", 338 )\n ", "end": 13906, "score": 0.9990680218, "start": 13900, "tag": "NAME", "value": "odblac" }, { "context": "\n , ( \"odblac\", 337 )\n , ( \"OEling\", 338 )\n , ( \"oelig\", 339 )\n ", "end": 13938, "score": 0.9992558956, "start": 13932, "tag": "NAME", "value": "OEling" }, { "context": "\n , ( \"OEling\", 338 )\n , ( \"oelig\", 339 )\n , ( \"Racute\", 340 )\n ", "end": 13969, "score": 0.9948604107, "start": 13964, "tag": "NAME", "value": "oelig" }, { "context": ")\n , ( \"oelig\", 339 )\n , ( \"Racute\", 340 )\n , ( \"racute\", 341 )\n ", "end": 14001, "score": 0.9992051721, "start": 13995, "tag": "NAME", "value": "Racute" }, { "context": "\n , ( \"Racute\", 340 )\n , ( \"racute\", 341 )\n , ( \"Rcedil\", 342 )\n ", "end": 14033, "score": 0.9964263439, "start": 14027, "tag": "NAME", "value": "racute" }, { "context": "\n , ( \"racute\", 341 )\n , ( \"Rcedil\", 342 )\n , ( \"rcedil\", 343 )\n ", "end": 14065, "score": 0.9996041656, "start": 14059, "tag": "NAME", "value": "Rcedil" }, { "context": "\n , ( \"Rcedil\", 342 )\n , ( \"rcedil\", 343 )\n , ( \"Rcaron\", 344 )\n ", "end": 14097, "score": 0.9987333417, "start": 14091, "tag": "NAME", "value": "rcedil" }, { "context": "\n , ( \"rcedil\", 343 )\n , ( \"Rcaron\", 344 )\n , ( \"rcaron\", 345 )\n ", "end": 14129, "score": 0.9996350408, "start": 14123, "tag": "NAME", "value": "Rcaron" }, { "context": "\n , ( \"Rcaron\", 344 )\n , ( \"rcaron\", 345 )\n , ( \"Sacute\", 346 )\n ", "end": 14161, "score": 0.9994236827, "start": 14155, "tag": "NAME", "value": "rcaron" }, { "context": "\n , ( \"rcaron\", 345 )\n , ( \"Sacute\", 346 )\n , ( \"sacute\", 347 )\n ", "end": 14193, "score": 0.9994366169, "start": 14187, "tag": "NAME", "value": "Sacute" }, { "context": "\n , ( \"Sacute\", 346 )\n , ( \"sacute\", 347 )\n , ( \"Scirc\", 348 )\n ", "end": 14225, "score": 0.9984259605, "start": 14219, "tag": "NAME", "value": "sacute" }, { "context": "\n , ( \"sacute\", 347 )\n , ( \"Scirc\", 348 )\n , ( \"scirc\", 349 )\n ", "end": 14256, "score": 0.9994972944, "start": 14251, "tag": "NAME", "value": "Scirc" }, { "context": ")\n , ( \"Scirc\", 348 )\n , ( \"scirc\", 349 )\n , ( \"Scedil\", 350 )\n ", "end": 14287, "score": 0.9991847873, "start": 14282, "tag": "NAME", "value": "scirc" }, { "context": ")\n , ( \"scirc\", 349 )\n , ( \"Scedil\", 350 )\n , ( \"scedil\", 351 )\n ", "end": 14319, "score": 0.9996474385, "start": 14313, "tag": "NAME", "value": "Scedil" }, { "context": "\n , ( \"Scedil\", 350 )\n , ( \"scedil\", 351 )\n , ( \"Scaron\", 352 )\n ", "end": 14351, "score": 0.9990015626, "start": 14345, "tag": "NAME", "value": "scedil" }, { "context": "\n , ( \"scedil\", 351 )\n , ( \"Scaron\", 352 )\n , ( \"scaron\", 353 )\n ", "end": 14383, "score": 0.9994819164, "start": 14377, "tag": "NAME", "value": "Scaron" }, { "context": "\n , ( \"Scaron\", 352 )\n , ( \"scaron\", 353 )\n , ( \"Tcedil\", 354 )\n ", "end": 14415, "score": 0.9985556602, "start": 14409, "tag": "NAME", "value": "scaron" }, { "context": "\n , ( \"scaron\", 353 )\n , ( \"Tcedil\", 354 )\n , ( \"tcedil\", 355 )\n ", "end": 14447, "score": 0.9996312261, "start": 14441, "tag": "NAME", "value": "Tcedil" }, { "context": "\n , ( \"Tcedil\", 354 )\n , ( \"tcedil\", 355 )\n , ( \"Tcaron\", 356 )\n ", "end": 14479, "score": 0.9978262782, "start": 14473, "tag": "NAME", "value": "tcedil" }, { "context": "\n , ( \"tcedil\", 355 )\n , ( \"Tcaron\", 356 )\n , ( \"tcaron\", 357 )\n ", "end": 14511, "score": 0.9995886683, "start": 14505, "tag": "NAME", "value": "Tcaron" }, { "context": "\n , ( \"Tcaron\", 356 )\n , ( \"tcaron\", 357 )\n , ( \"Tstork\", 358 )\n ", "end": 14543, "score": 0.9972460866, "start": 14537, "tag": "NAME", "value": "tcaron" }, { "context": "\n , ( \"tcaron\", 357 )\n , ( \"Tstork\", 358 )\n , ( \"tstork\", 359 )\n ", "end": 14575, "score": 0.9994053245, "start": 14569, "tag": "NAME", "value": "Tstork" }, { "context": "\n , ( \"Tstork\", 358 )\n , ( \"tstork\", 359 )\n , ( \"Utilde\", 360 )\n ", "end": 14607, "score": 0.9993207455, "start": 14601, "tag": "NAME", "value": "tstork" }, { "context": "\n , ( \"tstork\", 359 )\n , ( \"Utilde\", 360 )\n , ( \"utilde\", 361 )\n ", "end": 14639, "score": 0.9994613528, "start": 14633, "tag": "NAME", "value": "Utilde" }, { "context": "\n , ( \"Utilde\", 360 )\n , ( \"utilde\", 361 )\n , ( \"Umacr\", 362 )\n ", "end": 14671, "score": 0.9989594221, "start": 14665, "tag": "NAME", "value": "utilde" }, { "context": "\n , ( \"utilde\", 361 )\n , ( \"Umacr\", 362 )\n , ( \"umacr\", 363 )\n ", "end": 14702, "score": 0.9995173812, "start": 14697, "tag": "NAME", "value": "Umacr" }, { "context": ")\n , ( \"Umacr\", 362 )\n , ( \"umacr\", 363 )\n , ( \"Ubreve\", 364 )\n ", "end": 14733, "score": 0.9990413189, "start": 14728, "tag": "NAME", "value": "umacr" }, { "context": ")\n , ( \"umacr\", 363 )\n , ( \"Ubreve\", 364 )\n , ( \"ubreve\", 365 )\n ", "end": 14765, "score": 0.9995797276, "start": 14759, "tag": "NAME", "value": "Ubreve" }, { "context": "\n , ( \"Ubreve\", 364 )\n , ( \"ubreve\", 365 )\n , ( \"Uring\", 366 )\n ", "end": 14797, "score": 0.999083221, "start": 14791, "tag": "NAME", "value": "ubreve" }, { "context": "\n , ( \"ubreve\", 365 )\n , ( \"Uring\", 366 )\n , ( \"uring\", 367 )\n ", "end": 14828, "score": 0.999627769, "start": 14823, "tag": "NAME", "value": "Uring" }, { "context": ")\n , ( \"Uring\", 366 )\n , ( \"uring\", 367 )\n , ( \"Udblac\", 368 )\n ", "end": 14859, "score": 0.9987159967, "start": 14854, "tag": "NAME", "value": "uring" }, { "context": ")\n , ( \"uring\", 367 )\n , ( \"Udblac\", 368 )\n , ( \"udblac\", 369 )\n ", "end": 14891, "score": 0.9996373653, "start": 14885, "tag": "NAME", "value": "Udblac" }, { "context": "\n , ( \"Udblac\", 368 )\n , ( \"udblac\", 369 )\n , ( \"Uogon\", 370 )\n ", "end": 14923, "score": 0.9982361197, "start": 14917, "tag": "NAME", "value": "udblac" }, { "context": "\n , ( \"udblac\", 369 )\n , ( \"Uogon\", 370 )\n , ( \"uogon\", 371 )\n ", "end": 14954, "score": 0.9992883205, "start": 14949, "tag": "NAME", "value": "Uogon" }, { "context": ")\n , ( \"Uogon\", 370 )\n , ( \"uogon\", 371 )\n , ( \"Wcirc\", 372 )\n ", "end": 14985, "score": 0.996371448, "start": 14980, "tag": "NAME", "value": "uogon" }, { "context": ")\n , ( \"uogon\", 371 )\n , ( \"Wcirc\", 372 )\n , ( \"wcirc\", 373 )\n ", "end": 15016, "score": 0.995261848, "start": 15011, "tag": "NAME", "value": "Wcirc" }, { "context": " )\n , ( \"zdot\", 380 )\n , ( \"Zcaron\", 381 )\n , ( \"zcaron\", 382 )\n ", "end": 15295, "score": 0.9756512642, "start": 15289, "tag": "NAME", "value": "Zcaron" }, { "context": "\n , ( \"Theta\", 920 )\n , ( \"Iota\", 921 )\n , ( \"Kappa\", 922 )\n ", "end": 15788, "score": 0.5346705317, "start": 15785, "tag": "NAME", "value": "ota" }, { "context": "25 )\n , ( \"Xi\", 926 )\n , ( \"Omicron\", 927 )\n , ( \"Pi\", 928 )\n ,", "end": 15968, "score": 0.7158322334, "start": 15961, "tag": "NAME", "value": "Omicron" }, { "context": "1 )\n , ( \"piv\", 982 )\n , ( \"Gammad\", 988 )\n , ( \"gammad\", 989 )\n ", "end": 17155, "score": 0.9809238315, "start": 17149, "tag": "NAME", "value": "Gammad" }, { "context": " , ( \"Gammad\", 988 )\n , ( \"gammad\", 989 )\n , ( \"varkappa\", 1008 )\n ", "end": 17187, "score": 0.4192994237, "start": 17184, "tag": "USERNAME", "value": "mad" } ]
src/ElmEscapeHtml.elm
elm-review-bot/elm-html-to-unicode
5
module ElmEscapeHtml exposing (escape, unescape) {-| This library allows to escape html string and unescape named and numeric character references (e.g. &gt;, &#62;, &x3e;) to the corresponding unicode characters #Definition @docs escape, unescape -} import Char import Dict import Result import String {-| Escapes a string converting characters that could be used to inject XSS vectors (<http://wonko.com/post/html-escaping>). At the moment we escape &, <, >, ", ', \`, , !, @, $, %, (, ), =, +, {, }, [ and ] for example escape "&<>\"" == "&amp;&lt;&gt;&quot;" -} escape : String -> String escape = convert escapeChars {-| Unescapes a string, converting all named and numeric character references (e.g. &gt;, &#62;, &x3e;) to their corresponding unicode characters. for example unescape "&quot;&amp;&lt;&gt;" == "\"&<>" -} unescape : String -> String unescape = convert unescapeChars {- Helper function that applies a converting function to a string as a list of characters -} convert : (List Char -> List Char) -> String -> String convert convertChars string = string |> String.toList |> convertChars |> List.map String.fromChar |> String.concat {- escapes the characters one by one -} escapeChars : List Char -> List Char escapeChars list = list |> List.map escapeChar |> List.concat {- function that actually performs the escaping of a single character -} escapeChar : Char -> List Char escapeChar char = Maybe.withDefault [ char ] (Dict.get char escapeDictionary) {- dictionary that keeps track of the characters that need to be escaped -} escapeDictionary : Dict.Dict Char (List Char) escapeDictionary = Dict.fromList <| List.map (\( char, string ) -> ( char, String.toList string )) [ ( '&', "&amp;" ) , ( '<', "&lt;" ) , ( '>', "&gt;" ) , ( '"', "&quot;" ) , ( '\'', "&#39;" ) , ( '`', "&#96;" ) , ( ' ', "&#32;" ) , ( '!', "&#33;" ) , ( '@', "&#64;" ) , ( '$', "&#36;" ) , ( '%', "&#37;" ) , ( '(', "&#40;" ) , ( ')', "&#41;" ) , ( '=', "&#61;" ) , ( '+', "&#43;" ) , ( '{', "&#123;" ) , ( '}', "&#125;" ) , ( '[', "&#91;" ) , ( ']', "&#93;" ) ] {- unescapes the characters one by one -} unescapeChars : List Char -> List Char unescapeChars list = parser list [] [] {- recursive function that perform the parsing of a list of characters, keeping track of what still need to be parsed, what constitutes the list of characters considered for the unencoding, and what has already been parsed @par list of characters to parsed @par list of characters that are on hold to create the next character @par list of characters already parsed @ret parsed list of characters -} parser : List Char -> List Char -> List Char -> List Char parser charsToBeParsed charsOnParsing charsParsed = case charsToBeParsed of [] -> charsParsed head :: tail -> if head == '&' then parser tail [ head ] charsParsed else if head == ';' then parser tail [] (List.append charsParsed (unicodeConverter head charsOnParsing)) else if not (List.isEmpty charsOnParsing) then parser tail (List.append charsOnParsing [ head ]) charsParsed else parser tail [] (List.append charsParsed [ head ]) {- unencodes the next char considering what other characters are expecting to be parsed. At the moment called only when post is equal to ';' -} unicodeConverter : Char -> List Char -> List Char unicodeConverter post list = case list of [] -> [ post ] head :: tail -> noAmpUnicodeConverter head post tail {- unencodes the next char considering what other characters are expecting to be parsed, isolating the first of these characters At the moment called with pre = '&' and post = ';', to delimitate an encoded character @par character to prepend if the conversion is not possible @par character to append if the conversion is not possible @par list of characters to convert @ret parsed list of characters -} noAmpUnicodeConverter : Char -> Char -> List Char -> List Char noAmpUnicodeConverter pre post list = case list of [] -> [ pre, post ] '#' :: tail -> convertNumericalCode [ pre, '#' ] [ post ] tail head :: tail -> convertFriendlyCode [ pre ] [ post ] (head :: tail) {- unencodes a list of characters representing a numerically encoded character @par list of characters to prepend if the conversion is not possible @par list of characters to append if the conversion is not possible @par list of characters to convert @ret parsed list of characters -} convertNumericalCode : List Char -> List Char -> List Char -> List Char convertNumericalCode pre post list = case list of [] -> List.concat [ pre, post ] 'x' :: tail -> convertHexadecimalCode (List.append pre [ 'x' ]) post tail anyOtherList -> convertDecimalCode pre post anyOtherList {- helper function to create unescaping functions -} convertCode : (String -> Maybe a) -> (a -> List Char) -> List Char -> List Char -> List Char -> List Char convertCode mayber lister pre post list = let string = String.fromList list maybe = mayber string in case maybe of Nothing -> List.concat [ pre, list, post ] Just something -> lister something {- Convert String to Int assuming base 16. I include this here until elm-parseint is upgraded to Elm 0.19 -} parseIntHex : String -> Maybe Int parseIntHex string = parseIntR (String.reverse string) parseIntR : String -> Maybe Int parseIntR string = case String.uncons string of Nothing -> Just 0 Just ( c, tail ) -> intFromChar c |> Maybe.andThen (\ci -> parseIntR tail |> Maybe.andThen (\ri -> Just (ci + ri * 16)) ) intFromChar : Char -> Maybe Int intFromChar c = let toInt = if isBetween '0' '9' c then Just (charOffset '0' c) else if isBetween 'a' 'z' c then Just (10 + charOffset 'a' c) else if isBetween 'A' 'Z' c then Just (10 + charOffset 'A' c) else Nothing validInt i = if i < 16 then Just i else Nothing in toInt |> Maybe.andThen validInt isBetween : Char -> Char -> Char -> Bool isBetween lower upper c = let ci = Char.toCode c in Char.toCode lower <= ci && ci <= Char.toCode upper charOffset : Char -> Char -> Int charOffset basis c = Char.toCode c - Char.toCode basis {- unencodes a list of characters representing a hexadecimally encoded character -} convertHexadecimalCode : List Char -> List Char -> List Char -> List Char convertHexadecimalCode = convertCode parseIntHex (\int -> [ Char.fromCode int ]) {- unencodes a list of characters representing a decimally encoded character -} convertDecimalCode : List Char -> List Char -> List Char -> List Char convertDecimalCode = convertCode String.toInt (\int -> [ Char.fromCode int ]) {- unencodes a list of characters representing a friendly encoded character -} convertFriendlyCode : List Char -> List Char -> List Char -> List Char convertFriendlyCode = convertCode convertFriendlyCodeToChar (\char -> [ char ]) {- unencodes a string looking in the friendlyConverterDictionary -} convertFriendlyCodeToChar : String -> Maybe Char convertFriendlyCodeToChar string = Dict.get string friendlyConverterDictionary {- dictionary to keep track of the sequence of characters that represent a friendly html encoded character -} friendlyConverterDictionary : Dict.Dict String Char friendlyConverterDictionary = Dict.fromList <| List.map (\( a, b ) -> ( a, Char.fromCode b )) [ ( "quot", 34 ) , ( "amp", 38 ) , ( "lt", 60 ) , ( "gt", 62 ) , ( "nbsp", 160 ) , ( "iexcl", 161 ) , ( "cent", 162 ) , ( "pound", 163 ) , ( "curren", 164 ) , ( "yen", 165 ) , ( "brvbar", 166 ) , ( "sect", 167 ) , ( "uml", 168 ) , ( "copy", 169 ) , ( "ordf", 170 ) , ( "laquo", 171 ) , ( "not", 172 ) , ( "shy", 173 ) , ( "reg", 174 ) , ( "macr", 175 ) , ( "deg", 176 ) , ( "plusmn", 177 ) , ( "sup2", 178 ) , ( "sup3", 179 ) , ( "acute", 180 ) , ( "micro", 181 ) , ( "para", 182 ) , ( "middot", 183 ) , ( "cedil", 184 ) , ( "sup1", 185 ) , ( "ordm", 186 ) , ( "raquo", 187 ) , ( "frac14", 188 ) , ( "frac12", 189 ) , ( "frac34", 190 ) , ( "iquest", 191 ) , ( "Agrave", 192 ) , ( "Aacute", 193 ) , ( "Acirc", 194 ) , ( "Atilde", 195 ) , ( "Auml", 196 ) , ( "Aring", 197 ) , ( "AElig", 198 ) , ( "Ccedil", 199 ) , ( "Egrave", 200 ) , ( "Eacute", 201 ) , ( "Ecirc", 202 ) , ( "Euml", 203 ) , ( "Igrave", 204 ) , ( "Iacute", 205 ) , ( "Icirc", 206 ) , ( "Iuml", 207 ) , ( "ETH", 208 ) , ( "Ntilde", 209 ) , ( "Ograve", 210 ) , ( "Oacute", 211 ) , ( "Ocirc", 212 ) , ( "Otilde", 213 ) , ( "Ouml", 214 ) , ( "times", 215 ) , ( "Oslash", 216 ) , ( "Ugrave", 217 ) , ( "Uacute", 218 ) , ( "Ucirc", 219 ) , ( "Uuml", 220 ) , ( "Yacute", 221 ) , ( "THORN", 222 ) , ( "szlig", 223 ) , ( "agrave", 224 ) , ( "aacute", 225 ) , ( "acirc", 226 ) , ( "atilde", 227 ) , ( "auml", 228 ) , ( "aring", 229 ) , ( "aelig", 230 ) , ( "ccedil", 231 ) , ( "egrave", 232 ) , ( "eacute", 233 ) , ( "ecirc", 234 ) , ( "euml", 235 ) , ( "igrave", 236 ) , ( "iacute", 237 ) , ( "icirc", 238 ) , ( "iuml", 239 ) , ( "eth", 240 ) , ( "ntilde", 241 ) , ( "ograve", 242 ) , ( "oacute", 243 ) , ( "ocirc", 244 ) , ( "otilde", 245 ) , ( "ouml", 246 ) , ( "divide", 247 ) , ( "oslash", 248 ) , ( "ugrave", 249 ) , ( "uacute", 250 ) , ( "ucirc", 251 ) , ( "uuml", 252 ) , ( "yacute", 253 ) , ( "thorn", 254 ) , ( "yuml", 255 ) , ( "Amacr", 256 ) , ( "amacr", 257 ) , ( "Abreve", 258 ) , ( "abreve", 259 ) , ( "Aogon", 260 ) , ( "aogon", 261 ) , ( "Cacute", 262 ) , ( "cacute", 263 ) , ( "Ccirc", 264 ) , ( "ccirc", 265 ) , ( "Cdod", 266 ) , ( "cdot", 267 ) , ( "Ccaron", 268 ) , ( "ccaron", 269 ) , ( "Dcaron", 270 ) , ( "dcaron", 271 ) , ( "Dstork", 272 ) , ( "dstork", 273 ) , ( "Emacr", 274 ) , ( "emacr", 275 ) , ( "Edot", 278 ) , ( "edot", 279 ) , ( "Eogon", 280 ) , ( "eogon", 281 ) , ( "Ecaron", 282 ) , ( "ecaron", 283 ) , ( "Gcirc", 284 ) , ( "gcirc", 285 ) , ( "Gbreve", 286 ) , ( "gbreve", 287 ) , ( "Gdot", 288 ) , ( "gdot", 289 ) , ( "Gcedil", 290 ) , ( "gcedil", 291 ) , ( "Hcirc", 292 ) , ( "hcirc", 293 ) , ( "Hstork", 294 ) , ( "hstork", 295 ) , ( "Itilde", 296 ) , ( "itilde", 297 ) , ( "Imacr", 298 ) , ( "imacr", 299 ) , ( "Iogon", 302 ) , ( "iogon", 303 ) , ( "Idot", 304 ) , ( "inodot", 305 ) , ( "IJlog", 306 ) , ( "ijlig", 307 ) , ( "Jcirc", 308 ) , ( "jcirc", 309 ) , ( "Kcedil", 310 ) , ( "kcedil", 311 ) , ( "kgreen", 312 ) , ( "Lacute", 313 ) , ( "lacute", 314 ) , ( "Lcedil", 315 ) , ( "lcedil", 316 ) , ( "Lcaron", 317 ) , ( "lcaron", 318 ) , ( "Lmodot", 319 ) , ( "lmidot", 320 ) , ( "Lstork", 321 ) , ( "lstork", 322 ) , ( "Nacute", 323 ) , ( "nacute", 324 ) , ( "Ncedil", 325 ) , ( "ncedil", 326 ) , ( "Ncaron", 327 ) , ( "ncaron", 328 ) , ( "napos", 329 ) , ( "ENG", 330 ) , ( "eng", 331 ) , ( "Omacr", 332 ) , ( "omacr", 333 ) , ( "Odblac", 336 ) , ( "odblac", 337 ) , ( "OEling", 338 ) , ( "oelig", 339 ) , ( "Racute", 340 ) , ( "racute", 341 ) , ( "Rcedil", 342 ) , ( "rcedil", 343 ) , ( "Rcaron", 344 ) , ( "rcaron", 345 ) , ( "Sacute", 346 ) , ( "sacute", 347 ) , ( "Scirc", 348 ) , ( "scirc", 349 ) , ( "Scedil", 350 ) , ( "scedil", 351 ) , ( "Scaron", 352 ) , ( "scaron", 353 ) , ( "Tcedil", 354 ) , ( "tcedil", 355 ) , ( "Tcaron", 356 ) , ( "tcaron", 357 ) , ( "Tstork", 358 ) , ( "tstork", 359 ) , ( "Utilde", 360 ) , ( "utilde", 361 ) , ( "Umacr", 362 ) , ( "umacr", 363 ) , ( "Ubreve", 364 ) , ( "ubreve", 365 ) , ( "Uring", 366 ) , ( "uring", 367 ) , ( "Udblac", 368 ) , ( "udblac", 369 ) , ( "Uogon", 370 ) , ( "uogon", 371 ) , ( "Wcirc", 372 ) , ( "wcirc", 373 ) , ( "Ycirc", 374 ) , ( "ycirc", 375 ) , ( "Yuml", 376 ) , ( "Zacute", 377 ) , ( "zacute", 378 ) , ( "Zdot", 379 ) , ( "zdot", 380 ) , ( "Zcaron", 381 ) , ( "zcaron", 382 ) , ( "fnof", 402 ) , ( "imped", 437 ) , ( "gacute", 501 ) , ( "jmath", 567 ) , ( "circ", 710 ) , ( "tilde", 732 ) , ( "Alpha", 913 ) , ( "Beta", 914 ) , ( "Gamma", 915 ) , ( "Delta", 916 ) , ( "Epsilon", 917 ) , ( "Zeta", 918 ) , ( "Eta", 919 ) , ( "Theta", 920 ) , ( "Iota", 921 ) , ( "Kappa", 922 ) , ( "Lambda", 923 ) , ( "Mu", 924 ) , ( "Nu", 925 ) , ( "Xi", 926 ) , ( "Omicron", 927 ) , ( "Pi", 928 ) , ( "Rho", 929 ) , ( "Sigma", 931 ) , ( "Tau", 932 ) , ( "Upsilon", 933 ) , ( "Phi", 934 ) , ( "Chi", 935 ) , ( "Psi", 936 ) , ( "Omega", 937 ) , ( "alpha", 945 ) , ( "beta", 946 ) , ( "gamma", 947 ) , ( "delta", 948 ) , ( "epsilon", 949 ) , ( "zeta", 950 ) , ( "eta", 951 ) , ( "theta", 952 ) , ( "iota", 953 ) , ( "kappa", 954 ) , ( "lambda", 955 ) , ( "mu", 956 ) , ( "nu", 957 ) , ( "xi", 958 ) , ( "omicron", 959 ) , ( "pi", 960 ) , ( "rho", 961 ) , ( "sigmaf", 962 ) , ( "sigma", 963 ) , ( "tau", 934 ) , ( "upsilon", 965 ) , ( "phi", 966 ) , ( "chi", 967 ) , ( "psi", 968 ) , ( "omega", 969 ) , ( "thetasym", 977 ) , ( "upsih", 978 ) , ( "straightphi", 981 ) , ( "piv", 982 ) , ( "Gammad", 988 ) , ( "gammad", 989 ) , ( "varkappa", 1008 ) , ( "varrho", 1009 ) , ( "straightepsilon", 1013 ) , ( "backepsilon", 1014 ) , ( "ensp", 8194 ) , ( "emsp", 8195 ) , ( "thinsp", 8201 ) , ( "zwnj", 8204 ) , ( "zwj", 8205 ) , ( "lrm", 8206 ) , ( "rlm", 8207 ) , ( "ndash", 8211 ) , ( "mdash", 8212 ) , ( "lsquo", 8216 ) , ( "rsquo", 8217 ) , ( "sbquo", 8218 ) , ( "ldquo", 8220 ) , ( "rdquo", 8221 ) , ( "bdquo", 8222 ) , ( "dagger", 8224 ) , ( "Dagger", 8225 ) , ( "bull", 8226 ) , ( "hellip", 8230 ) , ( "permil", 8240 ) , ( "prime", 8242 ) , ( "Prime", 8243 ) , ( "lsaquo", 8249 ) , ( "rsaquo", 8250 ) , ( "oline", 8254 ) , ( "frasl", 8260 ) , ( "sigma", 963 ) , ( "euro", 8364 ) , ( "image", 8465 ) , ( "weierp", 8472 ) , ( "real", 8476 ) , ( "trade", 8482 ) , ( "alefsym", 8501 ) , ( "larr", 8592 ) , ( "uarr", 8593 ) , ( "rarr", 8594 ) , ( "darr", 8595 ) , ( "harr", 8596 ) , ( "crarr", 8629 ) , ( "lArr", 8656 ) , ( "uArr", 8657 ) , ( "rArr", 8658 ) , ( "dArr", 8659 ) , ( "hArr", 8660 ) , ( "forall", 8704 ) , ( "part", 8706 ) , ( "exist", 8707 ) , ( "empty", 8709 ) , ( "nabla", 8711 ) , ( "isin", 8712 ) , ( "notin", 8713 ) , ( "ni", 8715 ) , ( "prod", 8719 ) , ( "sum", 8721 ) , ( "minus", 8722 ) , ( "lowast", 8727 ) , ( "radic", 8730 ) , ( "prop", 8733 ) , ( "infin", 8734 ) , ( "ang", 8736 ) , ( "and", 8743 ) , ( "or", 8744 ) , ( "cap", 8745 ) , ( "cup", 8746 ) , ( "int", 8747 ) , ( "there4", 8756 ) , ( "sim", 8764 ) , ( "cong", 8773 ) , ( "asymp", 8776 ) , ( "ne", 8800 ) , ( "equiv", 8801 ) , ( "le", 8804 ) , ( "ge", 8805 ) , ( "sub", 8834 ) , ( "sup", 8835 ) , ( "nsub", 8836 ) , ( "sube", 8838 ) , ( "supe", 8839 ) , ( "oplus", 8853 ) , ( "otimes", 8855 ) , ( "perp", 8869 ) , ( "sdot", 8901 ) , ( "loz", 9674 ) , ( "spades", 9824 ) , ( "clubs", 9827 ) , ( "hearts", 9829 ) , ( "diams", 9830 ) ]
38436
module ElmEscapeHtml exposing (escape, unescape) {-| This library allows to escape html string and unescape named and numeric character references (e.g. &gt;, &#62;, &x3e;) to the corresponding unicode characters #Definition @docs escape, unescape -} import Char import Dict import Result import String {-| Escapes a string converting characters that could be used to inject XSS vectors (<http://wonko.com/post/html-escaping>). At the moment we escape &, <, >, ", ', \`, , !, @, $, %, (, ), =, +, {, }, [ and ] for example escape "&<>\"" == "&amp;&lt;&gt;&quot;" -} escape : String -> String escape = convert escapeChars {-| Unescapes a string, converting all named and numeric character references (e.g. &gt;, &#62;, &x3e;) to their corresponding unicode characters. for example unescape "&quot;&amp;&lt;&gt;" == "\"&<>" -} unescape : String -> String unescape = convert unescapeChars {- Helper function that applies a converting function to a string as a list of characters -} convert : (List Char -> List Char) -> String -> String convert convertChars string = string |> String.toList |> convertChars |> List.map String.fromChar |> String.concat {- escapes the characters one by one -} escapeChars : List Char -> List Char escapeChars list = list |> List.map escapeChar |> List.concat {- function that actually performs the escaping of a single character -} escapeChar : Char -> List Char escapeChar char = Maybe.withDefault [ char ] (Dict.get char escapeDictionary) {- dictionary that keeps track of the characters that need to be escaped -} escapeDictionary : Dict.Dict Char (List Char) escapeDictionary = Dict.fromList <| List.map (\( char, string ) -> ( char, String.toList string )) [ ( '&', "&amp;" ) , ( '<', "&lt;" ) , ( '>', "&gt;" ) , ( '"', "&quot;" ) , ( '\'', "&#39;" ) , ( '`', "&#96;" ) , ( ' ', "&#32;" ) , ( '!', "&#33;" ) , ( '@', "&#64;" ) , ( '$', "&#36;" ) , ( '%', "&#37;" ) , ( '(', "&#40;" ) , ( ')', "&#41;" ) , ( '=', "&#61;" ) , ( '+', "&#43;" ) , ( '{', "&#123;" ) , ( '}', "&#125;" ) , ( '[', "&#91;" ) , ( ']', "&#93;" ) ] {- unescapes the characters one by one -} unescapeChars : List Char -> List Char unescapeChars list = parser list [] [] {- recursive function that perform the parsing of a list of characters, keeping track of what still need to be parsed, what constitutes the list of characters considered for the unencoding, and what has already been parsed @par list of characters to parsed @par list of characters that are on hold to create the next character @par list of characters already parsed @ret parsed list of characters -} parser : List Char -> List Char -> List Char -> List Char parser charsToBeParsed charsOnParsing charsParsed = case charsToBeParsed of [] -> charsParsed head :: tail -> if head == '&' then parser tail [ head ] charsParsed else if head == ';' then parser tail [] (List.append charsParsed (unicodeConverter head charsOnParsing)) else if not (List.isEmpty charsOnParsing) then parser tail (List.append charsOnParsing [ head ]) charsParsed else parser tail [] (List.append charsParsed [ head ]) {- unencodes the next char considering what other characters are expecting to be parsed. At the moment called only when post is equal to ';' -} unicodeConverter : Char -> List Char -> List Char unicodeConverter post list = case list of [] -> [ post ] head :: tail -> noAmpUnicodeConverter head post tail {- unencodes the next char considering what other characters are expecting to be parsed, isolating the first of these characters At the moment called with pre = '&' and post = ';', to delimitate an encoded character @par character to prepend if the conversion is not possible @par character to append if the conversion is not possible @par list of characters to convert @ret parsed list of characters -} noAmpUnicodeConverter : Char -> Char -> List Char -> List Char noAmpUnicodeConverter pre post list = case list of [] -> [ pre, post ] '#' :: tail -> convertNumericalCode [ pre, '#' ] [ post ] tail head :: tail -> convertFriendlyCode [ pre ] [ post ] (head :: tail) {- unencodes a list of characters representing a numerically encoded character @par list of characters to prepend if the conversion is not possible @par list of characters to append if the conversion is not possible @par list of characters to convert @ret parsed list of characters -} convertNumericalCode : List Char -> List Char -> List Char -> List Char convertNumericalCode pre post list = case list of [] -> List.concat [ pre, post ] 'x' :: tail -> convertHexadecimalCode (List.append pre [ 'x' ]) post tail anyOtherList -> convertDecimalCode pre post anyOtherList {- helper function to create unescaping functions -} convertCode : (String -> Maybe a) -> (a -> List Char) -> List Char -> List Char -> List Char -> List Char convertCode mayber lister pre post list = let string = String.fromList list maybe = mayber string in case maybe of Nothing -> List.concat [ pre, list, post ] Just something -> lister something {- Convert String to Int assuming base 16. I include this here until elm-parseint is upgraded to Elm 0.19 -} parseIntHex : String -> Maybe Int parseIntHex string = parseIntR (String.reverse string) parseIntR : String -> Maybe Int parseIntR string = case String.uncons string of Nothing -> Just 0 Just ( c, tail ) -> intFromChar c |> Maybe.andThen (\ci -> parseIntR tail |> Maybe.andThen (\ri -> Just (ci + ri * 16)) ) intFromChar : Char -> Maybe Int intFromChar c = let toInt = if isBetween '0' '9' c then Just (charOffset '0' c) else if isBetween 'a' 'z' c then Just (10 + charOffset 'a' c) else if isBetween 'A' 'Z' c then Just (10 + charOffset 'A' c) else Nothing validInt i = if i < 16 then Just i else Nothing in toInt |> Maybe.andThen validInt isBetween : Char -> Char -> Char -> Bool isBetween lower upper c = let ci = Char.toCode c in Char.toCode lower <= ci && ci <= Char.toCode upper charOffset : Char -> Char -> Int charOffset basis c = Char.toCode c - Char.toCode basis {- unencodes a list of characters representing a hexadecimally encoded character -} convertHexadecimalCode : List Char -> List Char -> List Char -> List Char convertHexadecimalCode = convertCode parseIntHex (\int -> [ Char.fromCode int ]) {- unencodes a list of characters representing a decimally encoded character -} convertDecimalCode : List Char -> List Char -> List Char -> List Char convertDecimalCode = convertCode String.toInt (\int -> [ Char.fromCode int ]) {- unencodes a list of characters representing a friendly encoded character -} convertFriendlyCode : List Char -> List Char -> List Char -> List Char convertFriendlyCode = convertCode convertFriendlyCodeToChar (\char -> [ char ]) {- unencodes a string looking in the friendlyConverterDictionary -} convertFriendlyCodeToChar : String -> Maybe Char convertFriendlyCodeToChar string = Dict.get string friendlyConverterDictionary {- dictionary to keep track of the sequence of characters that represent a friendly html encoded character -} friendlyConverterDictionary : Dict.Dict String Char friendlyConverterDictionary = Dict.fromList <| List.map (\( a, b ) -> ( a, Char.fromCode b )) [ ( "quot", 34 ) , ( "amp", 38 ) , ( "lt", 60 ) , ( "gt", 62 ) , ( "nbsp", 160 ) , ( "iexcl", 161 ) , ( "cent", 162 ) , ( "pound", 163 ) , ( "curren", 164 ) , ( "yen", 165 ) , ( "brvbar", 166 ) , ( "sect", 167 ) , ( "uml", 168 ) , ( "copy", 169 ) , ( "ordf", 170 ) , ( "laquo", 171 ) , ( "not", 172 ) , ( "shy", 173 ) , ( "reg", 174 ) , ( "macr", 175 ) , ( "deg", 176 ) , ( "plusmn", 177 ) , ( "sup2", 178 ) , ( "sup3", 179 ) , ( "acute", 180 ) , ( "micro", 181 ) , ( "para", 182 ) , ( "middot", 183 ) , ( "cedil", 184 ) , ( "sup1", 185 ) , ( "ordm", 186 ) , ( "raquo", 187 ) , ( "frac14", 188 ) , ( "frac12", 189 ) , ( "frac34", 190 ) , ( "iquest", 191 ) , ( "Agrave", 192 ) , ( "Aacute", 193 ) , ( "Acirc", 194 ) , ( "Atilde", 195 ) , ( "Auml", 196 ) , ( "Aring", 197 ) , ( "AElig", 198 ) , ( "Ccedil", 199 ) , ( "Egrave", 200 ) , ( "Eacute", 201 ) , ( "Ecirc", 202 ) , ( "Euml", 203 ) , ( "Igrave", 204 ) , ( "Iacute", 205 ) , ( "Icirc", 206 ) , ( "Iuml", 207 ) , ( "ETH", 208 ) , ( "Ntilde", 209 ) , ( "Ograve", 210 ) , ( "Oacute", 211 ) , ( "Ocirc", 212 ) , ( "Otilde", 213 ) , ( "Ouml", 214 ) , ( "times", 215 ) , ( "Oslash", 216 ) , ( "Ugrave", 217 ) , ( "Uacute", 218 ) , ( "Ucirc", 219 ) , ( "Uuml", 220 ) , ( "Yacute", 221 ) , ( "<NAME>", 222 ) , ( "szlig", 223 ) , ( "agrave", 224 ) , ( "aacute", 225 ) , ( "acirc", 226 ) , ( "atilde", 227 ) , ( "auml", 228 ) , ( "aring", 229 ) , ( "ael<NAME>", 230 ) , ( "cc<NAME>", 231 ) , ( "egrave", 232 ) , ( "eacute", 233 ) , ( "ecirc", 234 ) , ( "euml", 235 ) , ( "igrave", 236 ) , ( "iacute", 237 ) , ( "icirc", 238 ) , ( "iuml", 239 ) , ( "eth", 240 ) , ( "ntilde", 241 ) , ( "ograve", 242 ) , ( "oacute", 243 ) , ( "ocirc", 244 ) , ( "otilde", 245 ) , ( "ouml", 246 ) , ( "divide", 247 ) , ( "<NAME>", 248 ) , ( "ugrave", 249 ) , ( "uacute", 250 ) , ( "ucirc", 251 ) , ( "uuml", 252 ) , ( "yacute", 253 ) , ( "thorn", 254 ) , ( "yuml", 255 ) , ( "<NAME>", 256 ) , ( "<NAME>", 257 ) , ( "<NAME>", 258 ) , ( "<NAME>", 259 ) , ( "<NAME>", 260 ) , ( "<NAME>", 261 ) , ( "<NAME>", 262 ) , ( "c<NAME>", 263 ) , ( "<NAME>", 264 ) , ( "<NAME>", 265 ) , ( "<NAME>", 266 ) , ( "<NAME>", 267 ) , ( "<NAME>", 268 ) , ( "<NAME>", 269 ) , ( "<NAME>", 270 ) , ( "<NAME>", 271 ) , ( "<NAME>", 272 ) , ( "<NAME>", 273 ) , ( "<NAME>", 274 ) , ( "<NAME>", 275 ) , ( "<NAME>", 278 ) , ( "ed<NAME>", 279 ) , ( "<NAME>", 280 ) , ( "<NAME>", 281 ) , ( "<NAME>", 282 ) , ( "<NAME>", 283 ) , ( "<NAME>", 284 ) , ( "<NAME>", 285 ) , ( "<NAME>", 286 ) , ( "<NAME>", 287 ) , ( "<NAME>", 288 ) , ( "<NAME>", 289 ) , ( "<NAME>", 290 ) , ( "<NAME>", 291 ) , ( "<NAME>", 292 ) , ( "<NAME>", 293 ) , ( "<NAME>", 294 ) , ( "<NAME>", 295 ) , ( "<NAME>", 296 ) , ( "<NAME>", 297 ) , ( "<NAME>", 298 ) , ( "<NAME>", 299 ) , ( "<NAME>", 302 ) , ( "<NAME>", 303 ) , ( "<NAME>", 304 ) , ( "<NAME>", 305 ) , ( "<NAME>", 306 ) , ( "<NAME>", 307 ) , ( "<NAME>", 308 ) , ( "<NAME>", 309 ) , ( "<NAME>", 310 ) , ( "<NAME>", 311 ) , ( "<NAME>", 312 ) , ( "<NAME>", 313 ) , ( "<NAME>", 314 ) , ( "<NAME>", 315 ) , ( "<NAME>", 316 ) , ( "<NAME>", 317 ) , ( "<NAME>", 318 ) , ( "<NAME>", 319 ) , ( "<NAME>", 320 ) , ( "<NAME>", 321 ) , ( "<NAME>", 322 ) , ( "<NAME>", 323 ) , ( "<NAME>", 324 ) , ( "<NAME>", 325 ) , ( "<NAME>", 326 ) , ( "<NAME>", 327 ) , ( "<NAME>", 328 ) , ( "<NAME>", 329 ) , ( "<NAME>", 330 ) , ( "<NAME>", 331 ) , ( "<NAME>", 332 ) , ( "<NAME>", 333 ) , ( "<NAME>", 336 ) , ( "<NAME>", 337 ) , ( "<NAME>", 338 ) , ( "<NAME>", 339 ) , ( "<NAME>", 340 ) , ( "<NAME>", 341 ) , ( "<NAME>", 342 ) , ( "<NAME>", 343 ) , ( "<NAME>", 344 ) , ( "<NAME>", 345 ) , ( "<NAME>", 346 ) , ( "<NAME>", 347 ) , ( "<NAME>", 348 ) , ( "<NAME>", 349 ) , ( "<NAME>", 350 ) , ( "<NAME>", 351 ) , ( "<NAME>", 352 ) , ( "<NAME>", 353 ) , ( "<NAME>", 354 ) , ( "<NAME>", 355 ) , ( "<NAME>", 356 ) , ( "<NAME>", 357 ) , ( "<NAME>", 358 ) , ( "<NAME>", 359 ) , ( "<NAME>", 360 ) , ( "<NAME>", 361 ) , ( "<NAME>", 362 ) , ( "<NAME>", 363 ) , ( "<NAME>", 364 ) , ( "<NAME>", 365 ) , ( "<NAME>", 366 ) , ( "<NAME>", 367 ) , ( "<NAME>", 368 ) , ( "<NAME>", 369 ) , ( "<NAME>", 370 ) , ( "<NAME>", 371 ) , ( "<NAME>", 372 ) , ( "wcirc", 373 ) , ( "Ycirc", 374 ) , ( "ycirc", 375 ) , ( "Yuml", 376 ) , ( "Zacute", 377 ) , ( "zacute", 378 ) , ( "Zdot", 379 ) , ( "zdot", 380 ) , ( "<NAME>", 381 ) , ( "zcaron", 382 ) , ( "fnof", 402 ) , ( "imped", 437 ) , ( "gacute", 501 ) , ( "jmath", 567 ) , ( "circ", 710 ) , ( "tilde", 732 ) , ( "Alpha", 913 ) , ( "Beta", 914 ) , ( "Gamma", 915 ) , ( "Delta", 916 ) , ( "Epsilon", 917 ) , ( "Zeta", 918 ) , ( "Eta", 919 ) , ( "Theta", 920 ) , ( "I<NAME>", 921 ) , ( "Kappa", 922 ) , ( "Lambda", 923 ) , ( "Mu", 924 ) , ( "Nu", 925 ) , ( "Xi", 926 ) , ( "<NAME>", 927 ) , ( "Pi", 928 ) , ( "Rho", 929 ) , ( "Sigma", 931 ) , ( "Tau", 932 ) , ( "Upsilon", 933 ) , ( "Phi", 934 ) , ( "Chi", 935 ) , ( "Psi", 936 ) , ( "Omega", 937 ) , ( "alpha", 945 ) , ( "beta", 946 ) , ( "gamma", 947 ) , ( "delta", 948 ) , ( "epsilon", 949 ) , ( "zeta", 950 ) , ( "eta", 951 ) , ( "theta", 952 ) , ( "iota", 953 ) , ( "kappa", 954 ) , ( "lambda", 955 ) , ( "mu", 956 ) , ( "nu", 957 ) , ( "xi", 958 ) , ( "omicron", 959 ) , ( "pi", 960 ) , ( "rho", 961 ) , ( "sigmaf", 962 ) , ( "sigma", 963 ) , ( "tau", 934 ) , ( "upsilon", 965 ) , ( "phi", 966 ) , ( "chi", 967 ) , ( "psi", 968 ) , ( "omega", 969 ) , ( "thetasym", 977 ) , ( "upsih", 978 ) , ( "straightphi", 981 ) , ( "piv", 982 ) , ( "<NAME>", 988 ) , ( "gammad", 989 ) , ( "varkappa", 1008 ) , ( "varrho", 1009 ) , ( "straightepsilon", 1013 ) , ( "backepsilon", 1014 ) , ( "ensp", 8194 ) , ( "emsp", 8195 ) , ( "thinsp", 8201 ) , ( "zwnj", 8204 ) , ( "zwj", 8205 ) , ( "lrm", 8206 ) , ( "rlm", 8207 ) , ( "ndash", 8211 ) , ( "mdash", 8212 ) , ( "lsquo", 8216 ) , ( "rsquo", 8217 ) , ( "sbquo", 8218 ) , ( "ldquo", 8220 ) , ( "rdquo", 8221 ) , ( "bdquo", 8222 ) , ( "dagger", 8224 ) , ( "Dagger", 8225 ) , ( "bull", 8226 ) , ( "hellip", 8230 ) , ( "permil", 8240 ) , ( "prime", 8242 ) , ( "Prime", 8243 ) , ( "lsaquo", 8249 ) , ( "rsaquo", 8250 ) , ( "oline", 8254 ) , ( "frasl", 8260 ) , ( "sigma", 963 ) , ( "euro", 8364 ) , ( "image", 8465 ) , ( "weierp", 8472 ) , ( "real", 8476 ) , ( "trade", 8482 ) , ( "alefsym", 8501 ) , ( "larr", 8592 ) , ( "uarr", 8593 ) , ( "rarr", 8594 ) , ( "darr", 8595 ) , ( "harr", 8596 ) , ( "crarr", 8629 ) , ( "lArr", 8656 ) , ( "uArr", 8657 ) , ( "rArr", 8658 ) , ( "dArr", 8659 ) , ( "hArr", 8660 ) , ( "forall", 8704 ) , ( "part", 8706 ) , ( "exist", 8707 ) , ( "empty", 8709 ) , ( "nabla", 8711 ) , ( "isin", 8712 ) , ( "notin", 8713 ) , ( "ni", 8715 ) , ( "prod", 8719 ) , ( "sum", 8721 ) , ( "minus", 8722 ) , ( "lowast", 8727 ) , ( "radic", 8730 ) , ( "prop", 8733 ) , ( "infin", 8734 ) , ( "ang", 8736 ) , ( "and", 8743 ) , ( "or", 8744 ) , ( "cap", 8745 ) , ( "cup", 8746 ) , ( "int", 8747 ) , ( "there4", 8756 ) , ( "sim", 8764 ) , ( "cong", 8773 ) , ( "asymp", 8776 ) , ( "ne", 8800 ) , ( "equiv", 8801 ) , ( "le", 8804 ) , ( "ge", 8805 ) , ( "sub", 8834 ) , ( "sup", 8835 ) , ( "nsub", 8836 ) , ( "sube", 8838 ) , ( "supe", 8839 ) , ( "oplus", 8853 ) , ( "otimes", 8855 ) , ( "perp", 8869 ) , ( "sdot", 8901 ) , ( "loz", 9674 ) , ( "spades", 9824 ) , ( "clubs", 9827 ) , ( "hearts", 9829 ) , ( "diams", 9830 ) ]
true
module ElmEscapeHtml exposing (escape, unescape) {-| This library allows to escape html string and unescape named and numeric character references (e.g. &gt;, &#62;, &x3e;) to the corresponding unicode characters #Definition @docs escape, unescape -} import Char import Dict import Result import String {-| Escapes a string converting characters that could be used to inject XSS vectors (<http://wonko.com/post/html-escaping>). At the moment we escape &, <, >, ", ', \`, , !, @, $, %, (, ), =, +, {, }, [ and ] for example escape "&<>\"" == "&amp;&lt;&gt;&quot;" -} escape : String -> String escape = convert escapeChars {-| Unescapes a string, converting all named and numeric character references (e.g. &gt;, &#62;, &x3e;) to their corresponding unicode characters. for example unescape "&quot;&amp;&lt;&gt;" == "\"&<>" -} unescape : String -> String unescape = convert unescapeChars {- Helper function that applies a converting function to a string as a list of characters -} convert : (List Char -> List Char) -> String -> String convert convertChars string = string |> String.toList |> convertChars |> List.map String.fromChar |> String.concat {- escapes the characters one by one -} escapeChars : List Char -> List Char escapeChars list = list |> List.map escapeChar |> List.concat {- function that actually performs the escaping of a single character -} escapeChar : Char -> List Char escapeChar char = Maybe.withDefault [ char ] (Dict.get char escapeDictionary) {- dictionary that keeps track of the characters that need to be escaped -} escapeDictionary : Dict.Dict Char (List Char) escapeDictionary = Dict.fromList <| List.map (\( char, string ) -> ( char, String.toList string )) [ ( '&', "&amp;" ) , ( '<', "&lt;" ) , ( '>', "&gt;" ) , ( '"', "&quot;" ) , ( '\'', "&#39;" ) , ( '`', "&#96;" ) , ( ' ', "&#32;" ) , ( '!', "&#33;" ) , ( '@', "&#64;" ) , ( '$', "&#36;" ) , ( '%', "&#37;" ) , ( '(', "&#40;" ) , ( ')', "&#41;" ) , ( '=', "&#61;" ) , ( '+', "&#43;" ) , ( '{', "&#123;" ) , ( '}', "&#125;" ) , ( '[', "&#91;" ) , ( ']', "&#93;" ) ] {- unescapes the characters one by one -} unescapeChars : List Char -> List Char unescapeChars list = parser list [] [] {- recursive function that perform the parsing of a list of characters, keeping track of what still need to be parsed, what constitutes the list of characters considered for the unencoding, and what has already been parsed @par list of characters to parsed @par list of characters that are on hold to create the next character @par list of characters already parsed @ret parsed list of characters -} parser : List Char -> List Char -> List Char -> List Char parser charsToBeParsed charsOnParsing charsParsed = case charsToBeParsed of [] -> charsParsed head :: tail -> if head == '&' then parser tail [ head ] charsParsed else if head == ';' then parser tail [] (List.append charsParsed (unicodeConverter head charsOnParsing)) else if not (List.isEmpty charsOnParsing) then parser tail (List.append charsOnParsing [ head ]) charsParsed else parser tail [] (List.append charsParsed [ head ]) {- unencodes the next char considering what other characters are expecting to be parsed. At the moment called only when post is equal to ';' -} unicodeConverter : Char -> List Char -> List Char unicodeConverter post list = case list of [] -> [ post ] head :: tail -> noAmpUnicodeConverter head post tail {- unencodes the next char considering what other characters are expecting to be parsed, isolating the first of these characters At the moment called with pre = '&' and post = ';', to delimitate an encoded character @par character to prepend if the conversion is not possible @par character to append if the conversion is not possible @par list of characters to convert @ret parsed list of characters -} noAmpUnicodeConverter : Char -> Char -> List Char -> List Char noAmpUnicodeConverter pre post list = case list of [] -> [ pre, post ] '#' :: tail -> convertNumericalCode [ pre, '#' ] [ post ] tail head :: tail -> convertFriendlyCode [ pre ] [ post ] (head :: tail) {- unencodes a list of characters representing a numerically encoded character @par list of characters to prepend if the conversion is not possible @par list of characters to append if the conversion is not possible @par list of characters to convert @ret parsed list of characters -} convertNumericalCode : List Char -> List Char -> List Char -> List Char convertNumericalCode pre post list = case list of [] -> List.concat [ pre, post ] 'x' :: tail -> convertHexadecimalCode (List.append pre [ 'x' ]) post tail anyOtherList -> convertDecimalCode pre post anyOtherList {- helper function to create unescaping functions -} convertCode : (String -> Maybe a) -> (a -> List Char) -> List Char -> List Char -> List Char -> List Char convertCode mayber lister pre post list = let string = String.fromList list maybe = mayber string in case maybe of Nothing -> List.concat [ pre, list, post ] Just something -> lister something {- Convert String to Int assuming base 16. I include this here until elm-parseint is upgraded to Elm 0.19 -} parseIntHex : String -> Maybe Int parseIntHex string = parseIntR (String.reverse string) parseIntR : String -> Maybe Int parseIntR string = case String.uncons string of Nothing -> Just 0 Just ( c, tail ) -> intFromChar c |> Maybe.andThen (\ci -> parseIntR tail |> Maybe.andThen (\ri -> Just (ci + ri * 16)) ) intFromChar : Char -> Maybe Int intFromChar c = let toInt = if isBetween '0' '9' c then Just (charOffset '0' c) else if isBetween 'a' 'z' c then Just (10 + charOffset 'a' c) else if isBetween 'A' 'Z' c then Just (10 + charOffset 'A' c) else Nothing validInt i = if i < 16 then Just i else Nothing in toInt |> Maybe.andThen validInt isBetween : Char -> Char -> Char -> Bool isBetween lower upper c = let ci = Char.toCode c in Char.toCode lower <= ci && ci <= Char.toCode upper charOffset : Char -> Char -> Int charOffset basis c = Char.toCode c - Char.toCode basis {- unencodes a list of characters representing a hexadecimally encoded character -} convertHexadecimalCode : List Char -> List Char -> List Char -> List Char convertHexadecimalCode = convertCode parseIntHex (\int -> [ Char.fromCode int ]) {- unencodes a list of characters representing a decimally encoded character -} convertDecimalCode : List Char -> List Char -> List Char -> List Char convertDecimalCode = convertCode String.toInt (\int -> [ Char.fromCode int ]) {- unencodes a list of characters representing a friendly encoded character -} convertFriendlyCode : List Char -> List Char -> List Char -> List Char convertFriendlyCode = convertCode convertFriendlyCodeToChar (\char -> [ char ]) {- unencodes a string looking in the friendlyConverterDictionary -} convertFriendlyCodeToChar : String -> Maybe Char convertFriendlyCodeToChar string = Dict.get string friendlyConverterDictionary {- dictionary to keep track of the sequence of characters that represent a friendly html encoded character -} friendlyConverterDictionary : Dict.Dict String Char friendlyConverterDictionary = Dict.fromList <| List.map (\( a, b ) -> ( a, Char.fromCode b )) [ ( "quot", 34 ) , ( "amp", 38 ) , ( "lt", 60 ) , ( "gt", 62 ) , ( "nbsp", 160 ) , ( "iexcl", 161 ) , ( "cent", 162 ) , ( "pound", 163 ) , ( "curren", 164 ) , ( "yen", 165 ) , ( "brvbar", 166 ) , ( "sect", 167 ) , ( "uml", 168 ) , ( "copy", 169 ) , ( "ordf", 170 ) , ( "laquo", 171 ) , ( "not", 172 ) , ( "shy", 173 ) , ( "reg", 174 ) , ( "macr", 175 ) , ( "deg", 176 ) , ( "plusmn", 177 ) , ( "sup2", 178 ) , ( "sup3", 179 ) , ( "acute", 180 ) , ( "micro", 181 ) , ( "para", 182 ) , ( "middot", 183 ) , ( "cedil", 184 ) , ( "sup1", 185 ) , ( "ordm", 186 ) , ( "raquo", 187 ) , ( "frac14", 188 ) , ( "frac12", 189 ) , ( "frac34", 190 ) , ( "iquest", 191 ) , ( "Agrave", 192 ) , ( "Aacute", 193 ) , ( "Acirc", 194 ) , ( "Atilde", 195 ) , ( "Auml", 196 ) , ( "Aring", 197 ) , ( "AElig", 198 ) , ( "Ccedil", 199 ) , ( "Egrave", 200 ) , ( "Eacute", 201 ) , ( "Ecirc", 202 ) , ( "Euml", 203 ) , ( "Igrave", 204 ) , ( "Iacute", 205 ) , ( "Icirc", 206 ) , ( "Iuml", 207 ) , ( "ETH", 208 ) , ( "Ntilde", 209 ) , ( "Ograve", 210 ) , ( "Oacute", 211 ) , ( "Ocirc", 212 ) , ( "Otilde", 213 ) , ( "Ouml", 214 ) , ( "times", 215 ) , ( "Oslash", 216 ) , ( "Ugrave", 217 ) , ( "Uacute", 218 ) , ( "Ucirc", 219 ) , ( "Uuml", 220 ) , ( "Yacute", 221 ) , ( "PI:NAME:<NAME>END_PI", 222 ) , ( "szlig", 223 ) , ( "agrave", 224 ) , ( "aacute", 225 ) , ( "acirc", 226 ) , ( "atilde", 227 ) , ( "auml", 228 ) , ( "aring", 229 ) , ( "aelPI:NAME:<NAME>END_PI", 230 ) , ( "ccPI:NAME:<NAME>END_PI", 231 ) , ( "egrave", 232 ) , ( "eacute", 233 ) , ( "ecirc", 234 ) , ( "euml", 235 ) , ( "igrave", 236 ) , ( "iacute", 237 ) , ( "icirc", 238 ) , ( "iuml", 239 ) , ( "eth", 240 ) , ( "ntilde", 241 ) , ( "ograve", 242 ) , ( "oacute", 243 ) , ( "ocirc", 244 ) , ( "otilde", 245 ) , ( "ouml", 246 ) , ( "divide", 247 ) , ( "PI:NAME:<NAME>END_PI", 248 ) , ( "ugrave", 249 ) , ( "uacute", 250 ) , ( "ucirc", 251 ) , ( "uuml", 252 ) , ( "yacute", 253 ) , ( "thorn", 254 ) , ( "yuml", 255 ) , ( "PI:NAME:<NAME>END_PI", 256 ) , ( "PI:NAME:<NAME>END_PI", 257 ) , ( "PI:NAME:<NAME>END_PI", 258 ) , ( "PI:NAME:<NAME>END_PI", 259 ) , ( "PI:NAME:<NAME>END_PI", 260 ) , ( "PI:NAME:<NAME>END_PI", 261 ) , ( "PI:NAME:<NAME>END_PI", 262 ) , ( "cPI:NAME:<NAME>END_PI", 263 ) , ( "PI:NAME:<NAME>END_PI", 264 ) , ( "PI:NAME:<NAME>END_PI", 265 ) , ( "PI:NAME:<NAME>END_PI", 266 ) , ( "PI:NAME:<NAME>END_PI", 267 ) , ( "PI:NAME:<NAME>END_PI", 268 ) , ( "PI:NAME:<NAME>END_PI", 269 ) , ( "PI:NAME:<NAME>END_PI", 270 ) , ( "PI:NAME:<NAME>END_PI", 271 ) , ( "PI:NAME:<NAME>END_PI", 272 ) , ( "PI:NAME:<NAME>END_PI", 273 ) , ( "PI:NAME:<NAME>END_PI", 274 ) , ( "PI:NAME:<NAME>END_PI", 275 ) , ( "PI:NAME:<NAME>END_PI", 278 ) , ( "edPI:NAME:<NAME>END_PI", 279 ) , ( "PI:NAME:<NAME>END_PI", 280 ) , ( "PI:NAME:<NAME>END_PI", 281 ) , ( "PI:NAME:<NAME>END_PI", 282 ) , ( "PI:NAME:<NAME>END_PI", 283 ) , ( "PI:NAME:<NAME>END_PI", 284 ) , ( "PI:NAME:<NAME>END_PI", 285 ) , ( "PI:NAME:<NAME>END_PI", 286 ) , ( "PI:NAME:<NAME>END_PI", 287 ) , ( "PI:NAME:<NAME>END_PI", 288 ) , ( "PI:NAME:<NAME>END_PI", 289 ) , ( "PI:NAME:<NAME>END_PI", 290 ) , ( "PI:NAME:<NAME>END_PI", 291 ) , ( "PI:NAME:<NAME>END_PI", 292 ) , ( "PI:NAME:<NAME>END_PI", 293 ) , ( "PI:NAME:<NAME>END_PI", 294 ) , ( "PI:NAME:<NAME>END_PI", 295 ) , ( "PI:NAME:<NAME>END_PI", 296 ) , ( "PI:NAME:<NAME>END_PI", 297 ) , ( "PI:NAME:<NAME>END_PI", 298 ) , ( "PI:NAME:<NAME>END_PI", 299 ) , ( "PI:NAME:<NAME>END_PI", 302 ) , ( "PI:NAME:<NAME>END_PI", 303 ) , ( "PI:NAME:<NAME>END_PI", 304 ) , ( "PI:NAME:<NAME>END_PI", 305 ) , ( "PI:NAME:<NAME>END_PI", 306 ) , ( "PI:NAME:<NAME>END_PI", 307 ) , ( "PI:NAME:<NAME>END_PI", 308 ) , ( "PI:NAME:<NAME>END_PI", 309 ) , ( "PI:NAME:<NAME>END_PI", 310 ) , ( "PI:NAME:<NAME>END_PI", 311 ) , ( "PI:NAME:<NAME>END_PI", 312 ) , ( "PI:NAME:<NAME>END_PI", 313 ) , ( "PI:NAME:<NAME>END_PI", 314 ) , ( "PI:NAME:<NAME>END_PI", 315 ) , ( "PI:NAME:<NAME>END_PI", 316 ) , ( "PI:NAME:<NAME>END_PI", 317 ) , ( "PI:NAME:<NAME>END_PI", 318 ) , ( "PI:NAME:<NAME>END_PI", 319 ) , ( "PI:NAME:<NAME>END_PI", 320 ) , ( "PI:NAME:<NAME>END_PI", 321 ) , ( "PI:NAME:<NAME>END_PI", 322 ) , ( "PI:NAME:<NAME>END_PI", 323 ) , ( "PI:NAME:<NAME>END_PI", 324 ) , ( "PI:NAME:<NAME>END_PI", 325 ) , ( "PI:NAME:<NAME>END_PI", 326 ) , ( "PI:NAME:<NAME>END_PI", 327 ) , ( "PI:NAME:<NAME>END_PI", 328 ) , ( "PI:NAME:<NAME>END_PI", 329 ) , ( "PI:NAME:<NAME>END_PI", 330 ) , ( "PI:NAME:<NAME>END_PI", 331 ) , ( "PI:NAME:<NAME>END_PI", 332 ) , ( "PI:NAME:<NAME>END_PI", 333 ) , ( "PI:NAME:<NAME>END_PI", 336 ) , ( "PI:NAME:<NAME>END_PI", 337 ) , ( "PI:NAME:<NAME>END_PI", 338 ) , ( "PI:NAME:<NAME>END_PI", 339 ) , ( "PI:NAME:<NAME>END_PI", 340 ) , ( "PI:NAME:<NAME>END_PI", 341 ) , ( "PI:NAME:<NAME>END_PI", 342 ) , ( "PI:NAME:<NAME>END_PI", 343 ) , ( "PI:NAME:<NAME>END_PI", 344 ) , ( "PI:NAME:<NAME>END_PI", 345 ) , ( "PI:NAME:<NAME>END_PI", 346 ) , ( "PI:NAME:<NAME>END_PI", 347 ) , ( "PI:NAME:<NAME>END_PI", 348 ) , ( "PI:NAME:<NAME>END_PI", 349 ) , ( "PI:NAME:<NAME>END_PI", 350 ) , ( "PI:NAME:<NAME>END_PI", 351 ) , ( "PI:NAME:<NAME>END_PI", 352 ) , ( "PI:NAME:<NAME>END_PI", 353 ) , ( "PI:NAME:<NAME>END_PI", 354 ) , ( "PI:NAME:<NAME>END_PI", 355 ) , ( "PI:NAME:<NAME>END_PI", 356 ) , ( "PI:NAME:<NAME>END_PI", 357 ) , ( "PI:NAME:<NAME>END_PI", 358 ) , ( "PI:NAME:<NAME>END_PI", 359 ) , ( "PI:NAME:<NAME>END_PI", 360 ) , ( "PI:NAME:<NAME>END_PI", 361 ) , ( "PI:NAME:<NAME>END_PI", 362 ) , ( "PI:NAME:<NAME>END_PI", 363 ) , ( "PI:NAME:<NAME>END_PI", 364 ) , ( "PI:NAME:<NAME>END_PI", 365 ) , ( "PI:NAME:<NAME>END_PI", 366 ) , ( "PI:NAME:<NAME>END_PI", 367 ) , ( "PI:NAME:<NAME>END_PI", 368 ) , ( "PI:NAME:<NAME>END_PI", 369 ) , ( "PI:NAME:<NAME>END_PI", 370 ) , ( "PI:NAME:<NAME>END_PI", 371 ) , ( "PI:NAME:<NAME>END_PI", 372 ) , ( "wcirc", 373 ) , ( "Ycirc", 374 ) , ( "ycirc", 375 ) , ( "Yuml", 376 ) , ( "Zacute", 377 ) , ( "zacute", 378 ) , ( "Zdot", 379 ) , ( "zdot", 380 ) , ( "PI:NAME:<NAME>END_PI", 381 ) , ( "zcaron", 382 ) , ( "fnof", 402 ) , ( "imped", 437 ) , ( "gacute", 501 ) , ( "jmath", 567 ) , ( "circ", 710 ) , ( "tilde", 732 ) , ( "Alpha", 913 ) , ( "Beta", 914 ) , ( "Gamma", 915 ) , ( "Delta", 916 ) , ( "Epsilon", 917 ) , ( "Zeta", 918 ) , ( "Eta", 919 ) , ( "Theta", 920 ) , ( "IPI:NAME:<NAME>END_PI", 921 ) , ( "Kappa", 922 ) , ( "Lambda", 923 ) , ( "Mu", 924 ) , ( "Nu", 925 ) , ( "Xi", 926 ) , ( "PI:NAME:<NAME>END_PI", 927 ) , ( "Pi", 928 ) , ( "Rho", 929 ) , ( "Sigma", 931 ) , ( "Tau", 932 ) , ( "Upsilon", 933 ) , ( "Phi", 934 ) , ( "Chi", 935 ) , ( "Psi", 936 ) , ( "Omega", 937 ) , ( "alpha", 945 ) , ( "beta", 946 ) , ( "gamma", 947 ) , ( "delta", 948 ) , ( "epsilon", 949 ) , ( "zeta", 950 ) , ( "eta", 951 ) , ( "theta", 952 ) , ( "iota", 953 ) , ( "kappa", 954 ) , ( "lambda", 955 ) , ( "mu", 956 ) , ( "nu", 957 ) , ( "xi", 958 ) , ( "omicron", 959 ) , ( "pi", 960 ) , ( "rho", 961 ) , ( "sigmaf", 962 ) , ( "sigma", 963 ) , ( "tau", 934 ) , ( "upsilon", 965 ) , ( "phi", 966 ) , ( "chi", 967 ) , ( "psi", 968 ) , ( "omega", 969 ) , ( "thetasym", 977 ) , ( "upsih", 978 ) , ( "straightphi", 981 ) , ( "piv", 982 ) , ( "PI:NAME:<NAME>END_PI", 988 ) , ( "gammad", 989 ) , ( "varkappa", 1008 ) , ( "varrho", 1009 ) , ( "straightepsilon", 1013 ) , ( "backepsilon", 1014 ) , ( "ensp", 8194 ) , ( "emsp", 8195 ) , ( "thinsp", 8201 ) , ( "zwnj", 8204 ) , ( "zwj", 8205 ) , ( "lrm", 8206 ) , ( "rlm", 8207 ) , ( "ndash", 8211 ) , ( "mdash", 8212 ) , ( "lsquo", 8216 ) , ( "rsquo", 8217 ) , ( "sbquo", 8218 ) , ( "ldquo", 8220 ) , ( "rdquo", 8221 ) , ( "bdquo", 8222 ) , ( "dagger", 8224 ) , ( "Dagger", 8225 ) , ( "bull", 8226 ) , ( "hellip", 8230 ) , ( "permil", 8240 ) , ( "prime", 8242 ) , ( "Prime", 8243 ) , ( "lsaquo", 8249 ) , ( "rsaquo", 8250 ) , ( "oline", 8254 ) , ( "frasl", 8260 ) , ( "sigma", 963 ) , ( "euro", 8364 ) , ( "image", 8465 ) , ( "weierp", 8472 ) , ( "real", 8476 ) , ( "trade", 8482 ) , ( "alefsym", 8501 ) , ( "larr", 8592 ) , ( "uarr", 8593 ) , ( "rarr", 8594 ) , ( "darr", 8595 ) , ( "harr", 8596 ) , ( "crarr", 8629 ) , ( "lArr", 8656 ) , ( "uArr", 8657 ) , ( "rArr", 8658 ) , ( "dArr", 8659 ) , ( "hArr", 8660 ) , ( "forall", 8704 ) , ( "part", 8706 ) , ( "exist", 8707 ) , ( "empty", 8709 ) , ( "nabla", 8711 ) , ( "isin", 8712 ) , ( "notin", 8713 ) , ( "ni", 8715 ) , ( "prod", 8719 ) , ( "sum", 8721 ) , ( "minus", 8722 ) , ( "lowast", 8727 ) , ( "radic", 8730 ) , ( "prop", 8733 ) , ( "infin", 8734 ) , ( "ang", 8736 ) , ( "and", 8743 ) , ( "or", 8744 ) , ( "cap", 8745 ) , ( "cup", 8746 ) , ( "int", 8747 ) , ( "there4", 8756 ) , ( "sim", 8764 ) , ( "cong", 8773 ) , ( "asymp", 8776 ) , ( "ne", 8800 ) , ( "equiv", 8801 ) , ( "le", 8804 ) , ( "ge", 8805 ) , ( "sub", 8834 ) , ( "sup", 8835 ) , ( "nsub", 8836 ) , ( "sube", 8838 ) , ( "supe", 8839 ) , ( "oplus", 8853 ) , ( "otimes", 8855 ) , ( "perp", 8869 ) , ( "sdot", 8901 ) , ( "loz", 9674 ) , ( "spades", 9824 ) , ( "clubs", 9827 ) , ( "hearts", 9829 ) , ( "diams", 9830 ) ]
elm
[ { "context": " \"attributes\": {\n \"firstname\": \"John\",\n \"lastname\": \"Doe\",\n ", "end": 1322, "score": 0.9996761084, "start": 1318, "tag": "NAME", "value": "John" }, { "context": "\"firstname\": \"John\",\n \"lastname\": \"Doe\",\n \"gender\": \"male\"\n },", "end": 1357, "score": 0.9994646311, "start": 1354, "tag": "NAME", "value": "Doe" }, { "context": "thAttributes\n [ ( \"firstname\", string \"John\" )\n , ( \"lastname\", string \"Doe\" )\n ", "end": 1848, "score": 0.9988350272, "start": 1844, "tag": "NAME", "value": "John" }, { "context": "ring \"John\" )\n , ( \"lastname\", string \"Doe\" )\n , ( \"gender\", string \"male\" )\n ", "end": 1891, "score": 0.9032616019, "start": 1888, "tag": "NAME", "value": "Doe" }, { "context": "tributes\n [ ( \"firstname\", string \"John\" )\n , ( \"lastname\", string \"Doe\" )", "end": 4538, "score": 0.9996237159, "start": 4534, "tag": "NAME", "value": "John" }, { "context": " \"John\" )\n , ( \"lastname\", string \"Doe\" )\n , ( \"gender\", string \"male\" )\n", "end": 4585, "score": 0.9989100695, "start": 4582, "tag": "NAME", "value": "Doe" } ]
src/JsonApi.elm
ChristophP/jsonapi
0
module JsonApi exposing (ResourceInfo, OneOrManyRelationships, id, links, withId, withLinks, withAttributes, withRelationship, build, relationship, relationships, fromResourceInfo) {-| JsonApi exposes the `ResourceInfo` type and functions to get and set information for your resources. # Type @docs ResourceInfo, OneOrManyRelationships # New resource @docs build, fromResourceInfo # Getter functions @docs id, links # Setter functions @docs withId, withLinks, withAttributes, withRelationship # Relationships @docs relationship, relationships -} import JsonApi.Internal.ResourceInfo as Internal import Dict exposing (Dict) import Json.Encode exposing (Value, object) {-| The `ResourceInfo` represents a resource. It is passed to your resource decoders, but you can also use it to encode resources to json api. It contains useful information for decoding and encoding your resource: resource `id`, `links`, `attributes`, `relationships`, ... _Example of json api <resource:_> ```json { "data": [ { "type": "users", "id": "13608770-76dd-47e5-a1c4-4d0d9c2483ad", "links": { "self": "http://link-to-user", "profile": "http://link-to-user-profile" }, "attributes": { "firstname": "John", "lastname": "Doe", "gender": "male" }, "relationships": {} } ] } ``` And how to build it with the `JsonApi` module: build "users" |> withId "13608770-76dd-47e5-a1c4-4d0d9c2483ad" |> withLinks (Dict.fromList [ ( "self", "http://link-to-user" ) , ( "profile", "http://link-to-user-profile" ) ] ) |> withAttributes [ ( "firstname", string "John" ) , ( "lastname", string "Doe" ) , ( "gender", string "male" ) ] -} type alias ResourceInfo = Internal.ResourceInfo {-| This type is used to represent either or or many relationships in your `ResourceInfo` object. See `withRelationship` function for more information -} type alias OneOrManyRelationships = Internal.OneOrManyRelationships {-| Returns the `id` of your resource. From the json example above, `id` will return `13608770-76dd-47e5-a1c4-4d0d9c2483ad` -} id : ResourceInfo -> String id (Internal.ResourceInfo { id }) = id |> Maybe.withDefault "" {-| Returns the `links` of your resource. From the json example above, `links` will return a `Dict` with this value: [ ("self", "http://link-to-user") , ("profile", "http://link-to-user-profile") ] -} links : ResourceInfo -> Dict String String links (Internal.ResourceInfo { links }) = links {-| Builds a new `ResourceInfo` with the specified type name You can build your resources like this: myResource : Post -> ResourceInfo myResource post = build "posts" |> withId "post-1" |> withLinks (Dict.fromList [ ( "self", "http://url-to-post/1" ) ]) -} build : String -> ResourceInfo build type_ = Internal.ResourceInfo (Internal.build type_) {-| Builds a new `ResourceInfo` from the specified `ResourceInfo` and with the specified type name You can build your resources like this: myResource : ResourceInfo -> ResourceInfo myResource resourceInfo = fromResourceInfo "posts" resourceInfo -} fromResourceInfo : String -> ResourceInfo -> ResourceInfo fromResourceInfo type_ (Internal.ResourceInfo info) = Internal.ResourceInfo { info | type_ = type_ } {-| Sets the id of the `ResourceInfo` object myResource : Post -> ResourceInfo myResource post = build "posts" |> withId "post-1" -} withId : String -> ResourceInfo -> ResourceInfo withId id (Internal.ResourceInfo info) = Internal.ResourceInfo { info | id = Just id } {-| Sets the links of the `ResourceInfo` object myResource : Post -> ResourceInfo myResource post = build "posts" |> withLinks (Dict.fromList [ ( "self", "http://url-to-post/1" ) ]) -} withLinks : Dict String String -> ResourceInfo -> ResourceInfo withLinks links (Internal.ResourceInfo info) = Internal.ResourceInfo { info | links = links } {-| Sets the attributes of the `ResourceInfo` object. This is the payload of your resource. myResource : Post -> ResourceInfo myResource post = build "posts" |> withAttributes [ ( "firstname", string "John" ) , ( "lastname", string "Doe" ) , ( "gender", string "male" ) ] -} withAttributes : List ( String, Value ) -> ResourceInfo -> ResourceInfo withAttributes attrs (Internal.ResourceInfo info) = Internal.ResourceInfo { info | attributes = object attrs } {-| Adds a relationship in the `ResourceInfo` object. You have to pass it the name of the relationship and a description of the relationship resource (See `relationship` and `relationships`) myResource : Post -> ResourceInfo myResource post = build "posts" |> withRelationship "creators" (relationship creator.id (creatorResource creator)) -} withRelationship : String -> OneOrManyRelationships -> ResourceInfo -> ResourceInfo withRelationship type_ (Internal.OneOrManyRelationships oneOrMoreRelationships) (Internal.ResourceInfo info) = Internal.ResourceInfo (Internal.addRelationship type_ oneOrMoreRelationships info) {-| Defines a relationship that can then be added to its parent `ResourceInfo`. It takes the `id` of the resource and the resource. creatorResource : Creator -> ResourceInfo creatorResource creator = build "creator" |> withAttributes [ ( "firstname", string creator.firstname ) ] myResource : Post -> ResourceInfo myResource post = build "posts" |> withRelationship "creators" (relationship creator.id (creatorResource creator)) -} relationship : String -> ResourceInfo -> OneOrManyRelationships relationship id = withId id >> Internal.OneRelationship >> Internal.OneOrManyRelationships {-| Defines a list of relationships that can then be added to a parent `ResourceInfo`. It takes a `List` of `Tuple`s with the `id` of the resource and the resource. commentResource : Comment -> ResourceInfo commentResource comment = build "comment" |> withAttributes [ ( "content", string comment.content ) ] myResource : Post -> ResourceInfo myResource post = build "posts" |> withRelationship "comments" (relationships (List.map (\comment -> ( "comment", commentResource comment )) comments)) -} relationships : List ( String, ResourceInfo ) -> OneOrManyRelationships relationships = List.map (\( id, info ) -> info |> withId id) >> Internal.ManyRelationships >> Internal.OneOrManyRelationships
44794
module JsonApi exposing (ResourceInfo, OneOrManyRelationships, id, links, withId, withLinks, withAttributes, withRelationship, build, relationship, relationships, fromResourceInfo) {-| JsonApi exposes the `ResourceInfo` type and functions to get and set information for your resources. # Type @docs ResourceInfo, OneOrManyRelationships # New resource @docs build, fromResourceInfo # Getter functions @docs id, links # Setter functions @docs withId, withLinks, withAttributes, withRelationship # Relationships @docs relationship, relationships -} import JsonApi.Internal.ResourceInfo as Internal import Dict exposing (Dict) import Json.Encode exposing (Value, object) {-| The `ResourceInfo` represents a resource. It is passed to your resource decoders, but you can also use it to encode resources to json api. It contains useful information for decoding and encoding your resource: resource `id`, `links`, `attributes`, `relationships`, ... _Example of json api <resource:_> ```json { "data": [ { "type": "users", "id": "13608770-76dd-47e5-a1c4-4d0d9c2483ad", "links": { "self": "http://link-to-user", "profile": "http://link-to-user-profile" }, "attributes": { "firstname": "<NAME>", "lastname": "<NAME>", "gender": "male" }, "relationships": {} } ] } ``` And how to build it with the `JsonApi` module: build "users" |> withId "13608770-76dd-47e5-a1c4-4d0d9c2483ad" |> withLinks (Dict.fromList [ ( "self", "http://link-to-user" ) , ( "profile", "http://link-to-user-profile" ) ] ) |> withAttributes [ ( "firstname", string "<NAME>" ) , ( "lastname", string "<NAME>" ) , ( "gender", string "male" ) ] -} type alias ResourceInfo = Internal.ResourceInfo {-| This type is used to represent either or or many relationships in your `ResourceInfo` object. See `withRelationship` function for more information -} type alias OneOrManyRelationships = Internal.OneOrManyRelationships {-| Returns the `id` of your resource. From the json example above, `id` will return `13608770-76dd-47e5-a1c4-4d0d9c2483ad` -} id : ResourceInfo -> String id (Internal.ResourceInfo { id }) = id |> Maybe.withDefault "" {-| Returns the `links` of your resource. From the json example above, `links` will return a `Dict` with this value: [ ("self", "http://link-to-user") , ("profile", "http://link-to-user-profile") ] -} links : ResourceInfo -> Dict String String links (Internal.ResourceInfo { links }) = links {-| Builds a new `ResourceInfo` with the specified type name You can build your resources like this: myResource : Post -> ResourceInfo myResource post = build "posts" |> withId "post-1" |> withLinks (Dict.fromList [ ( "self", "http://url-to-post/1" ) ]) -} build : String -> ResourceInfo build type_ = Internal.ResourceInfo (Internal.build type_) {-| Builds a new `ResourceInfo` from the specified `ResourceInfo` and with the specified type name You can build your resources like this: myResource : ResourceInfo -> ResourceInfo myResource resourceInfo = fromResourceInfo "posts" resourceInfo -} fromResourceInfo : String -> ResourceInfo -> ResourceInfo fromResourceInfo type_ (Internal.ResourceInfo info) = Internal.ResourceInfo { info | type_ = type_ } {-| Sets the id of the `ResourceInfo` object myResource : Post -> ResourceInfo myResource post = build "posts" |> withId "post-1" -} withId : String -> ResourceInfo -> ResourceInfo withId id (Internal.ResourceInfo info) = Internal.ResourceInfo { info | id = Just id } {-| Sets the links of the `ResourceInfo` object myResource : Post -> ResourceInfo myResource post = build "posts" |> withLinks (Dict.fromList [ ( "self", "http://url-to-post/1" ) ]) -} withLinks : Dict String String -> ResourceInfo -> ResourceInfo withLinks links (Internal.ResourceInfo info) = Internal.ResourceInfo { info | links = links } {-| Sets the attributes of the `ResourceInfo` object. This is the payload of your resource. myResource : Post -> ResourceInfo myResource post = build "posts" |> withAttributes [ ( "firstname", string "<NAME>" ) , ( "lastname", string "<NAME>" ) , ( "gender", string "male" ) ] -} withAttributes : List ( String, Value ) -> ResourceInfo -> ResourceInfo withAttributes attrs (Internal.ResourceInfo info) = Internal.ResourceInfo { info | attributes = object attrs } {-| Adds a relationship in the `ResourceInfo` object. You have to pass it the name of the relationship and a description of the relationship resource (See `relationship` and `relationships`) myResource : Post -> ResourceInfo myResource post = build "posts" |> withRelationship "creators" (relationship creator.id (creatorResource creator)) -} withRelationship : String -> OneOrManyRelationships -> ResourceInfo -> ResourceInfo withRelationship type_ (Internal.OneOrManyRelationships oneOrMoreRelationships) (Internal.ResourceInfo info) = Internal.ResourceInfo (Internal.addRelationship type_ oneOrMoreRelationships info) {-| Defines a relationship that can then be added to its parent `ResourceInfo`. It takes the `id` of the resource and the resource. creatorResource : Creator -> ResourceInfo creatorResource creator = build "creator" |> withAttributes [ ( "firstname", string creator.firstname ) ] myResource : Post -> ResourceInfo myResource post = build "posts" |> withRelationship "creators" (relationship creator.id (creatorResource creator)) -} relationship : String -> ResourceInfo -> OneOrManyRelationships relationship id = withId id >> Internal.OneRelationship >> Internal.OneOrManyRelationships {-| Defines a list of relationships that can then be added to a parent `ResourceInfo`. It takes a `List` of `Tuple`s with the `id` of the resource and the resource. commentResource : Comment -> ResourceInfo commentResource comment = build "comment" |> withAttributes [ ( "content", string comment.content ) ] myResource : Post -> ResourceInfo myResource post = build "posts" |> withRelationship "comments" (relationships (List.map (\comment -> ( "comment", commentResource comment )) comments)) -} relationships : List ( String, ResourceInfo ) -> OneOrManyRelationships relationships = List.map (\( id, info ) -> info |> withId id) >> Internal.ManyRelationships >> Internal.OneOrManyRelationships
true
module JsonApi exposing (ResourceInfo, OneOrManyRelationships, id, links, withId, withLinks, withAttributes, withRelationship, build, relationship, relationships, fromResourceInfo) {-| JsonApi exposes the `ResourceInfo` type and functions to get and set information for your resources. # Type @docs ResourceInfo, OneOrManyRelationships # New resource @docs build, fromResourceInfo # Getter functions @docs id, links # Setter functions @docs withId, withLinks, withAttributes, withRelationship # Relationships @docs relationship, relationships -} import JsonApi.Internal.ResourceInfo as Internal import Dict exposing (Dict) import Json.Encode exposing (Value, object) {-| The `ResourceInfo` represents a resource. It is passed to your resource decoders, but you can also use it to encode resources to json api. It contains useful information for decoding and encoding your resource: resource `id`, `links`, `attributes`, `relationships`, ... _Example of json api <resource:_> ```json { "data": [ { "type": "users", "id": "13608770-76dd-47e5-a1c4-4d0d9c2483ad", "links": { "self": "http://link-to-user", "profile": "http://link-to-user-profile" }, "attributes": { "firstname": "PI:NAME:<NAME>END_PI", "lastname": "PI:NAME:<NAME>END_PI", "gender": "male" }, "relationships": {} } ] } ``` And how to build it with the `JsonApi` module: build "users" |> withId "13608770-76dd-47e5-a1c4-4d0d9c2483ad" |> withLinks (Dict.fromList [ ( "self", "http://link-to-user" ) , ( "profile", "http://link-to-user-profile" ) ] ) |> withAttributes [ ( "firstname", string "PI:NAME:<NAME>END_PI" ) , ( "lastname", string "PI:NAME:<NAME>END_PI" ) , ( "gender", string "male" ) ] -} type alias ResourceInfo = Internal.ResourceInfo {-| This type is used to represent either or or many relationships in your `ResourceInfo` object. See `withRelationship` function for more information -} type alias OneOrManyRelationships = Internal.OneOrManyRelationships {-| Returns the `id` of your resource. From the json example above, `id` will return `13608770-76dd-47e5-a1c4-4d0d9c2483ad` -} id : ResourceInfo -> String id (Internal.ResourceInfo { id }) = id |> Maybe.withDefault "" {-| Returns the `links` of your resource. From the json example above, `links` will return a `Dict` with this value: [ ("self", "http://link-to-user") , ("profile", "http://link-to-user-profile") ] -} links : ResourceInfo -> Dict String String links (Internal.ResourceInfo { links }) = links {-| Builds a new `ResourceInfo` with the specified type name You can build your resources like this: myResource : Post -> ResourceInfo myResource post = build "posts" |> withId "post-1" |> withLinks (Dict.fromList [ ( "self", "http://url-to-post/1" ) ]) -} build : String -> ResourceInfo build type_ = Internal.ResourceInfo (Internal.build type_) {-| Builds a new `ResourceInfo` from the specified `ResourceInfo` and with the specified type name You can build your resources like this: myResource : ResourceInfo -> ResourceInfo myResource resourceInfo = fromResourceInfo "posts" resourceInfo -} fromResourceInfo : String -> ResourceInfo -> ResourceInfo fromResourceInfo type_ (Internal.ResourceInfo info) = Internal.ResourceInfo { info | type_ = type_ } {-| Sets the id of the `ResourceInfo` object myResource : Post -> ResourceInfo myResource post = build "posts" |> withId "post-1" -} withId : String -> ResourceInfo -> ResourceInfo withId id (Internal.ResourceInfo info) = Internal.ResourceInfo { info | id = Just id } {-| Sets the links of the `ResourceInfo` object myResource : Post -> ResourceInfo myResource post = build "posts" |> withLinks (Dict.fromList [ ( "self", "http://url-to-post/1" ) ]) -} withLinks : Dict String String -> ResourceInfo -> ResourceInfo withLinks links (Internal.ResourceInfo info) = Internal.ResourceInfo { info | links = links } {-| Sets the attributes of the `ResourceInfo` object. This is the payload of your resource. myResource : Post -> ResourceInfo myResource post = build "posts" |> withAttributes [ ( "firstname", string "PI:NAME:<NAME>END_PI" ) , ( "lastname", string "PI:NAME:<NAME>END_PI" ) , ( "gender", string "male" ) ] -} withAttributes : List ( String, Value ) -> ResourceInfo -> ResourceInfo withAttributes attrs (Internal.ResourceInfo info) = Internal.ResourceInfo { info | attributes = object attrs } {-| Adds a relationship in the `ResourceInfo` object. You have to pass it the name of the relationship and a description of the relationship resource (See `relationship` and `relationships`) myResource : Post -> ResourceInfo myResource post = build "posts" |> withRelationship "creators" (relationship creator.id (creatorResource creator)) -} withRelationship : String -> OneOrManyRelationships -> ResourceInfo -> ResourceInfo withRelationship type_ (Internal.OneOrManyRelationships oneOrMoreRelationships) (Internal.ResourceInfo info) = Internal.ResourceInfo (Internal.addRelationship type_ oneOrMoreRelationships info) {-| Defines a relationship that can then be added to its parent `ResourceInfo`. It takes the `id` of the resource and the resource. creatorResource : Creator -> ResourceInfo creatorResource creator = build "creator" |> withAttributes [ ( "firstname", string creator.firstname ) ] myResource : Post -> ResourceInfo myResource post = build "posts" |> withRelationship "creators" (relationship creator.id (creatorResource creator)) -} relationship : String -> ResourceInfo -> OneOrManyRelationships relationship id = withId id >> Internal.OneRelationship >> Internal.OneOrManyRelationships {-| Defines a list of relationships that can then be added to a parent `ResourceInfo`. It takes a `List` of `Tuple`s with the `id` of the resource and the resource. commentResource : Comment -> ResourceInfo commentResource comment = build "comment" |> withAttributes [ ( "content", string comment.content ) ] myResource : Post -> ResourceInfo myResource post = build "posts" |> withRelationship "comments" (relationships (List.map (\comment -> ( "comment", commentResource comment )) comments)) -} relationships : List ( String, ResourceInfo ) -> OneOrManyRelationships relationships = List.map (\( id, info ) -> info |> withId id) >> Internal.ManyRelationships >> Internal.OneOrManyRelationships
elm
[ { "context": "tring -> Model\ndefaultModel baseUrl =\n { name = \"Cool Person\"\n , baseUrl = baseUrl\n , token = \"\"\n }\n\ntype a", "end": 362, "score": 0.8970745206, "start": 351, "tag": "NAME", "value": "Cool Person" } ]
tests/src/Elmer/TestApps/InitTestApp.elm
jbwatkins/elmer
44
module Elmer.TestApps.InitTestApp exposing (..) import Html exposing (Html) import Html.Attributes as Attr import Task exposing (Task) type alias Model = { name : String , baseUrl : String , token : String } type Msg = TokenRequest (Result String String) | Tag String defaultModel : String -> Model defaultModel baseUrl = { name = "Cool Person" , baseUrl = baseUrl , token = "" } type alias Flags = { baseUrl: String } init : Flags -> ( Model, Cmd Msg ) init flags = ( defaultModel flags.baseUrl, requestTokenTask "/fun/token" |> Task.attempt TokenRequest ) requestTokenTask : String -> Task String String requestTokenTask path = Task.succeed "Succeed" view : Model -> Html Msg view model = Html.div [ Attr.id "base-url" ] [ Html.text model.baseUrl ] update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of TokenRequest result -> case result of Ok token -> ( { model | token = token }, Cmd.none ) _ -> ( model, Cmd.none ) _ -> ( model, Cmd.none )
1300
module Elmer.TestApps.InitTestApp exposing (..) import Html exposing (Html) import Html.Attributes as Attr import Task exposing (Task) type alias Model = { name : String , baseUrl : String , token : String } type Msg = TokenRequest (Result String String) | Tag String defaultModel : String -> Model defaultModel baseUrl = { name = "<NAME>" , baseUrl = baseUrl , token = "" } type alias Flags = { baseUrl: String } init : Flags -> ( Model, Cmd Msg ) init flags = ( defaultModel flags.baseUrl, requestTokenTask "/fun/token" |> Task.attempt TokenRequest ) requestTokenTask : String -> Task String String requestTokenTask path = Task.succeed "Succeed" view : Model -> Html Msg view model = Html.div [ Attr.id "base-url" ] [ Html.text model.baseUrl ] update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of TokenRequest result -> case result of Ok token -> ( { model | token = token }, Cmd.none ) _ -> ( model, Cmd.none ) _ -> ( model, Cmd.none )
true
module Elmer.TestApps.InitTestApp exposing (..) import Html exposing (Html) import Html.Attributes as Attr import Task exposing (Task) type alias Model = { name : String , baseUrl : String , token : String } type Msg = TokenRequest (Result String String) | Tag String defaultModel : String -> Model defaultModel baseUrl = { name = "PI:NAME:<NAME>END_PI" , baseUrl = baseUrl , token = "" } type alias Flags = { baseUrl: String } init : Flags -> ( Model, Cmd Msg ) init flags = ( defaultModel flags.baseUrl, requestTokenTask "/fun/token" |> Task.attempt TokenRequest ) requestTokenTask : String -> Task String String requestTokenTask path = Task.succeed "Succeed" view : Model -> Html Msg view model = Html.div [ Attr.id "base-url" ] [ Html.text model.baseUrl ] update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of TokenRequest result -> case result of Ok token -> ( { model | token = token }, Cmd.none ) _ -> ( model, Cmd.none ) _ -> ( model, Cmd.none )
elm
[ { "context": ", onInput (Change idx)\n , placeholder \"Todo Item\"\n ]\n []\n , div\n", "end": 2508, "score": 0.6158798933, "start": 2504, "tag": "NAME", "value": "Todo" } ]
src/Main.elm
fjij/elm-todo
0
port module Main exposing (Model, Msg(..), init, main, toJs, update, view) import Browser import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onCheck, onInput) import Http exposing (Error(..)) import Json.Decode as Decode -- --------------------------- -- PORTS -- --------------------------- port toJs : String -> Cmd msg -- --------------------------- -- MODEL -- --------------------------- type alias Todo = { text : String , done : Bool } type alias Model = List Todo init : Int -> ( Model, Cmd Msg ) init flags = ( [] , Cmd.none ) -- --------------------------- -- UPDATE -- --------------------------- type Msg = Add | Remove Int | Change Int String | Mark Int Bool update : Msg -> Model -> ( Model, Cmd Msg ) update message model = case message of Add -> ( model ++ [ defaultItem ] , Cmd.none ) Remove idx -> ( model |> List.indexedMap (\i item -> { i = i, item = item }) |> List.filter (\indexedItem -> indexedItem.i /= idx) |> List.map (\indexedItem -> indexedItem.item) , Cmd.none ) Change idx text -> ( useAt idx (\todo -> { todo | text = text }) model , Cmd.none ) Mark idx done -> ( useAt idx (\todo -> { todo | done = done }) model , Cmd.none ) defaultItem : Todo defaultItem = Todo "" False useAt : Int -> (a -> a) -> List a -> List a useAt idx fn items = List.indexedMap (\i item -> if i == idx then fn item else item ) items -- --------------------------- -- VIEW -- --------------------------- viewItem : Int -> Todo -> Html Msg viewItem idx todoItem = div [ class "input-group mt-2" ] [ div [ class "input-group-prepend" ] [ div [ class "input-group-text" ] [ input [ type_ "checkbox" , class "" , checked todoItem.done , onCheck (Mark idx) ] [] ] ] , input [ value todoItem.text , class "form-control" , onInput (Change idx) , placeholder "Todo Item" ] [] , div [ class "input-group-append" ] [ button [ onClick (Remove idx) , class "btn btn-danger" ] [ text "Remove" ] ] ] view : Model -> Html Msg view model = div [ class "card col-12 col-md-8 col-xl-6 mx-auto" ] [ div [ class "card-body" ] [ div [ class "container d-flex" ] [ h1 [ class "d-inline" ] [ text "Todo" ] , div [ class "ml-auto d-flex" ] [ button [ onClick Add , class "btn btn-primary my-auto" ] [ text "+" ] ] ] , div [ ] (List.indexedMap viewItem model) ] ] -- --------------------------- -- MAIN -- --------------------------- main : Program Int Model Msg main = Browser.document { init = init , update = update , view = \m -> { title = "Elm Todo List" , body = [ view m ] } , subscriptions = \_ -> Sub.none }
42031
port module Main exposing (Model, Msg(..), init, main, toJs, update, view) import Browser import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onCheck, onInput) import Http exposing (Error(..)) import Json.Decode as Decode -- --------------------------- -- PORTS -- --------------------------- port toJs : String -> Cmd msg -- --------------------------- -- MODEL -- --------------------------- type alias Todo = { text : String , done : Bool } type alias Model = List Todo init : Int -> ( Model, Cmd Msg ) init flags = ( [] , Cmd.none ) -- --------------------------- -- UPDATE -- --------------------------- type Msg = Add | Remove Int | Change Int String | Mark Int Bool update : Msg -> Model -> ( Model, Cmd Msg ) update message model = case message of Add -> ( model ++ [ defaultItem ] , Cmd.none ) Remove idx -> ( model |> List.indexedMap (\i item -> { i = i, item = item }) |> List.filter (\indexedItem -> indexedItem.i /= idx) |> List.map (\indexedItem -> indexedItem.item) , Cmd.none ) Change idx text -> ( useAt idx (\todo -> { todo | text = text }) model , Cmd.none ) Mark idx done -> ( useAt idx (\todo -> { todo | done = done }) model , Cmd.none ) defaultItem : Todo defaultItem = Todo "" False useAt : Int -> (a -> a) -> List a -> List a useAt idx fn items = List.indexedMap (\i item -> if i == idx then fn item else item ) items -- --------------------------- -- VIEW -- --------------------------- viewItem : Int -> Todo -> Html Msg viewItem idx todoItem = div [ class "input-group mt-2" ] [ div [ class "input-group-prepend" ] [ div [ class "input-group-text" ] [ input [ type_ "checkbox" , class "" , checked todoItem.done , onCheck (Mark idx) ] [] ] ] , input [ value todoItem.text , class "form-control" , onInput (Change idx) , placeholder "<NAME> Item" ] [] , div [ class "input-group-append" ] [ button [ onClick (Remove idx) , class "btn btn-danger" ] [ text "Remove" ] ] ] view : Model -> Html Msg view model = div [ class "card col-12 col-md-8 col-xl-6 mx-auto" ] [ div [ class "card-body" ] [ div [ class "container d-flex" ] [ h1 [ class "d-inline" ] [ text "Todo" ] , div [ class "ml-auto d-flex" ] [ button [ onClick Add , class "btn btn-primary my-auto" ] [ text "+" ] ] ] , div [ ] (List.indexedMap viewItem model) ] ] -- --------------------------- -- MAIN -- --------------------------- main : Program Int Model Msg main = Browser.document { init = init , update = update , view = \m -> { title = "Elm Todo List" , body = [ view m ] } , subscriptions = \_ -> Sub.none }
true
port module Main exposing (Model, Msg(..), init, main, toJs, update, view) import Browser import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onCheck, onInput) import Http exposing (Error(..)) import Json.Decode as Decode -- --------------------------- -- PORTS -- --------------------------- port toJs : String -> Cmd msg -- --------------------------- -- MODEL -- --------------------------- type alias Todo = { text : String , done : Bool } type alias Model = List Todo init : Int -> ( Model, Cmd Msg ) init flags = ( [] , Cmd.none ) -- --------------------------- -- UPDATE -- --------------------------- type Msg = Add | Remove Int | Change Int String | Mark Int Bool update : Msg -> Model -> ( Model, Cmd Msg ) update message model = case message of Add -> ( model ++ [ defaultItem ] , Cmd.none ) Remove idx -> ( model |> List.indexedMap (\i item -> { i = i, item = item }) |> List.filter (\indexedItem -> indexedItem.i /= idx) |> List.map (\indexedItem -> indexedItem.item) , Cmd.none ) Change idx text -> ( useAt idx (\todo -> { todo | text = text }) model , Cmd.none ) Mark idx done -> ( useAt idx (\todo -> { todo | done = done }) model , Cmd.none ) defaultItem : Todo defaultItem = Todo "" False useAt : Int -> (a -> a) -> List a -> List a useAt idx fn items = List.indexedMap (\i item -> if i == idx then fn item else item ) items -- --------------------------- -- VIEW -- --------------------------- viewItem : Int -> Todo -> Html Msg viewItem idx todoItem = div [ class "input-group mt-2" ] [ div [ class "input-group-prepend" ] [ div [ class "input-group-text" ] [ input [ type_ "checkbox" , class "" , checked todoItem.done , onCheck (Mark idx) ] [] ] ] , input [ value todoItem.text , class "form-control" , onInput (Change idx) , placeholder "PI:NAME:<NAME>END_PI Item" ] [] , div [ class "input-group-append" ] [ button [ onClick (Remove idx) , class "btn btn-danger" ] [ text "Remove" ] ] ] view : Model -> Html Msg view model = div [ class "card col-12 col-md-8 col-xl-6 mx-auto" ] [ div [ class "card-body" ] [ div [ class "container d-flex" ] [ h1 [ class "d-inline" ] [ text "Todo" ] , div [ class "ml-auto d-flex" ] [ button [ onClick Add , class "btn btn-primary my-auto" ] [ text "+" ] ] ] , div [ ] (List.indexedMap viewItem model) ] ] -- --------------------------- -- MAIN -- --------------------------- main : Program Int Model Msg main = Browser.document { init = init , update = update , view = \m -> { title = "Elm Todo List" , body = [ view m ] } , subscriptions = \_ -> Sub.none }
elm
[ { "context": " Password password ->\n { model | password = password }\n PasswordAgain password ->\n { model | p", "end": 700, "score": 0.9721410275, "start": 692, "tag": "PASSWORD", "value": "password" } ]
src/02.elm
Cassin01/elm_introduction
2
-- Forms -- https://guide.elm-lang.org/architecture/forms.html import Browser import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onInput) -- MAIN main = Browser.sandbox { init = init, update = update, view = view } -- MODEL type alias Model = { name : String , password : String , passwordAgain : String , age : String } init : Model init = Model "" "" "" "" -- UPDATE type Msg = Name String | Password String | PasswordAgain String | Age String update : Msg -> Model -> Model update msg model = case msg of Name name -> { model | name = name } Password password -> { model | password = password } PasswordAgain password -> { model | passwordAgain = password } Age age -> { model | age = age } -- VIEW view : Model -> Html Msg view model = div [] [ viewInput "text" "Name" model.name Name, viewInput "password" "Password" model.password Password, viewInput "password" "Re-enter Password" model.passwordAgain PasswordAgain, viewInput "text" "age" model.age Age, viewValidation model ] viewInput : String -> String -> String -> (String -> msg) -> Html msg viewInput t p v toMsg = input [ type_ t, placeholder p, value v, onInput toMsg ] [] viewValidation : Model -> Html msg viewValidation model = if not (is_num model.age) then div [ style "color" "red" ] [ text "Age Shoud be a number!" ] else if model.password /= model.passwordAgain then div [ style "color" "red" ] [ text "Passwords do not match!" ] else if String.length model.password <= 8 then div [ style "color" "red" ] [ text "Passwords should be longer than 8!" ] else if not (contain_num model.password) then div [ style "color" "red" ] [ text "Passwords should be contain number!" ] else div [] [ div [ style "color" "green" ] [ text "OK" ], button [] [ text "Submit" ] ] contain_num : String -> Bool contain_num password = List.foldr (||) False (List.map (\z -> containx z password) (List.range 0 9)) is_num : String -> Bool is_num age = List.foldr (&&) True (List.map (\x -> contain_num (String.fromChar x)) (String.toList age)) containx : Int -> String -> Bool containx x password = String.contains (Debug.toString x) password
56875
-- Forms -- https://guide.elm-lang.org/architecture/forms.html import Browser import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onInput) -- MAIN main = Browser.sandbox { init = init, update = update, view = view } -- MODEL type alias Model = { name : String , password : String , passwordAgain : String , age : String } init : Model init = Model "" "" "" "" -- UPDATE type Msg = Name String | Password String | PasswordAgain String | Age String update : Msg -> Model -> Model update msg model = case msg of Name name -> { model | name = name } Password password -> { model | password = <PASSWORD> } PasswordAgain password -> { model | passwordAgain = password } Age age -> { model | age = age } -- VIEW view : Model -> Html Msg view model = div [] [ viewInput "text" "Name" model.name Name, viewInput "password" "Password" model.password Password, viewInput "password" "Re-enter Password" model.passwordAgain PasswordAgain, viewInput "text" "age" model.age Age, viewValidation model ] viewInput : String -> String -> String -> (String -> msg) -> Html msg viewInput t p v toMsg = input [ type_ t, placeholder p, value v, onInput toMsg ] [] viewValidation : Model -> Html msg viewValidation model = if not (is_num model.age) then div [ style "color" "red" ] [ text "Age Shoud be a number!" ] else if model.password /= model.passwordAgain then div [ style "color" "red" ] [ text "Passwords do not match!" ] else if String.length model.password <= 8 then div [ style "color" "red" ] [ text "Passwords should be longer than 8!" ] else if not (contain_num model.password) then div [ style "color" "red" ] [ text "Passwords should be contain number!" ] else div [] [ div [ style "color" "green" ] [ text "OK" ], button [] [ text "Submit" ] ] contain_num : String -> Bool contain_num password = List.foldr (||) False (List.map (\z -> containx z password) (List.range 0 9)) is_num : String -> Bool is_num age = List.foldr (&&) True (List.map (\x -> contain_num (String.fromChar x)) (String.toList age)) containx : Int -> String -> Bool containx x password = String.contains (Debug.toString x) password
true
-- Forms -- https://guide.elm-lang.org/architecture/forms.html import Browser import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onInput) -- MAIN main = Browser.sandbox { init = init, update = update, view = view } -- MODEL type alias Model = { name : String , password : String , passwordAgain : String , age : String } init : Model init = Model "" "" "" "" -- UPDATE type Msg = Name String | Password String | PasswordAgain String | Age String update : Msg -> Model -> Model update msg model = case msg of Name name -> { model | name = name } Password password -> { model | password = PI:PASSWORD:<PASSWORD>END_PI } PasswordAgain password -> { model | passwordAgain = password } Age age -> { model | age = age } -- VIEW view : Model -> Html Msg view model = div [] [ viewInput "text" "Name" model.name Name, viewInput "password" "Password" model.password Password, viewInput "password" "Re-enter Password" model.passwordAgain PasswordAgain, viewInput "text" "age" model.age Age, viewValidation model ] viewInput : String -> String -> String -> (String -> msg) -> Html msg viewInput t p v toMsg = input [ type_ t, placeholder p, value v, onInput toMsg ] [] viewValidation : Model -> Html msg viewValidation model = if not (is_num model.age) then div [ style "color" "red" ] [ text "Age Shoud be a number!" ] else if model.password /= model.passwordAgain then div [ style "color" "red" ] [ text "Passwords do not match!" ] else if String.length model.password <= 8 then div [ style "color" "red" ] [ text "Passwords should be longer than 8!" ] else if not (contain_num model.password) then div [ style "color" "red" ] [ text "Passwords should be contain number!" ] else div [] [ div [ style "color" "green" ] [ text "OK" ], button [] [ text "Submit" ] ] contain_num : String -> Bool contain_num password = List.foldr (||) False (List.map (\z -> containx z password) (List.range 0 9)) is_num : String -> Bool is_num age = List.foldr (&&) True (List.map (\x -> contain_num (String.fromChar x)) (String.toList age)) containx : Int -> String -> Bool containx x password = String.contains (Debug.toString x) password
elm
[ { "context": "ssions, and pull requests is:\n\nhttps://github.com/sindikat/elm-list-experimental\n\n# List functions\n@docs and", "end": 1440, "score": 0.9715849161, "start": 1432, "tag": "USERNAME", "value": "sindikat" }, { "context": ",1),('b',2),('c',3)] == Nothing\n lookup 3 [(1,\"John\"),(1,\"Paul\"),(2,\"Mary\")] == Just \"John\"\n-}\nlookup", "end": 2842, "score": 0.9998459816, "start": 2838, "tag": "NAME", "value": "John" }, { "context": ",('c',3)] == Nothing\n lookup 3 [(1,\"John\"),(1,\"Paul\"),(2,\"Mary\")] == Just \"John\"\n-}\nlookup : a -> Lis", "end": 2853, "score": 0.9998131394, "start": 2849, "tag": "NAME", "value": "Paul" }, { "context": "= Nothing\n lookup 3 [(1,\"John\"),(1,\"Paul\"),(2,\"Mary\")] == Just \"John\"\n-}\nlookup : a -> List ( a, b ) ", "end": 2864, "score": 0.9998297691, "start": 2860, "tag": "NAME", "value": "Mary" }, { "context": "kup 3 [(1,\"John\"),(1,\"Paul\"),(2,\"Mary\")] == Just \"John\"\n-}\nlookup : a -> List ( a, b ) -> Maybe b\nlookup", "end": 2881, "score": 0.999771893, "start": 2877, "tag": "NAME", "value": "John" } ]
src/List/Experimental.elm
sindikat/elm-list-experimental
1
module List.Experimental exposing ( and , or , conjunction , disjunction , lookup , filter2 , filterMap2 , filterM , at , removeAt , removeFirst , removeFirstBy , removeFirsts , removeFirstsBy , difference , union , intersect , insert , differenceBy , unionBy , intersectBy , insertBy , iterate ) {-| List.Experimental is a testing playground for various List related functions. It contains functions that are experimental, unidiomatic, controversial or downright silly. This is specifically to not clutter List and List.Extra, and also have an isolated place to test crazy ideas. *Do not* use this module in production code. Try your best to come up with equivalent functionality or solve your problem in a different way, and if you fail, consider contributing to List and List.Extra packages. *Do not* import functions from this module unqualified if you do use it. This package has the lowest possible bar for inclusion of List related functions. If you have some code that you want to publish somewhere, but not necessarily contribute to core libraries, feel absolutely free to contribute here. Treat this package as a safe sandbox. The GitHub page for ideas, suggestions, discussions, and pull requests is: https://github.com/sindikat/elm-list-experimental # List functions @docs and, or, conjunction, disjunction, lookup, filter2, filterMap2, filterM # Elements @docs at # Removal @docs removeAt, removeFirst, removeFirstBy, removeFirsts, removeFirstsBy # Set functions @docs difference, union, intersect, insert, differenceBy, unionBy, intersectBy, insertBy # Misc @docs iterate -} import List exposing (..) import List.Extra exposing (..) {-| Return the conjunction of all `Bool`s in a list. In other words, return True if all elements are True, return False otherwise. `and` is equivalent to `all identity`. Return True on an empty list. -} and : List Bool -> Bool and = all identity {-| Return the disjunction of all `Bool`s in a list. In other words, return True if any element is True, return False otherwise. `or` is equivalent to `any identity`. Return False on an empty list. -} or : List Bool -> Bool or = any identity {-| Same as `and`. -} conjunction : List Bool -> Bool conjunction = and {-| Same as `or`. -} disjunction : List Bool -> Bool disjunction = or {-| Look up a key in an association list, return corresponding value, wrapped in `Just`. If no value is found, return `Nothing`. If multiple values correspond to the same key, return the first found value. lookup 'a' [('a',1),('b',2),('c',3)] == Just 1 lookup 'd' [('a',1),('b',2),('c',3)] == Nothing lookup 3 [(1,"John"),(1,"Paul"),(2,"Mary")] == Just "John" -} lookup : a -> List ( a, b ) -> Maybe b lookup key = Maybe.map snd << find (\item -> fst item == key) {-| Filter over two lists simultaneously using a custom comparison function, return a list of pairs. -} filter2 : (a -> b -> Bool) -> List a -> List b -> List ( a, b ) filter2 p xs ys = filter (uncurry p) (map2 (,) xs ys) {-| Apply a function, which may succeed, to all values of two lists, but only keep the successes. -} filterMap2 : (a -> b -> Maybe c) -> List a -> List b -> List c filterMap2 f xs ys = List.filterMap identity <| map2 f xs ys {-| Filter that exploits the behavior of `andThen`. Return all subsequences of a list: filterM (\x -> [True, False]) [1,2,3] == [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]] Return all subsequences that contain 2: filterM (\x -> if x==2 then [True] else [True,False]) [1,2,3] == [[1,2,3],[1,2],[2,3],[2]] -} filterM : (a -> List Bool) -> List a -> List (List a) filterM p = let andThen = flip concatMap go x r = p x `andThen` (\flg -> r `andThen` (\ys -> [ if flg then x :: ys else ys ] ) ) in foldr go [ [] ] -- come up with a better name? {-| Extract *n*th element of a list, index counts from 0. at 1 [1,2,3] == Just 2 at 3 [1,2,3] == Nothing at -1 [1,2,3] == Nothing -} at : Int -> List a -> Maybe a at n xs = if n >= 0 then head <| drop n xs else Nothing {-| Remove *n*th element of a list. If index is negative or out of bounds of the list, return the list unchanged. removeAt 0 [1,2,3] == [2,3] removeAt 3 [1,2,3] == [1,2,3] removeAt -1 [1,2,3] == [1,2,3] -} removeAt : Int -> List a -> List a removeAt n xs = take n xs ++ drop (n + 1) xs {-| Remove first occurrence of element from list. removeFirst 2 [1,2,1,2] == [1,1,2] -} removeFirst : a -> List a -> List a removeFirst = removeFirstBy (==) {-| Remove first occurence of each element from list. removeFirsts [1,2] [1,2,3,1,2,3] == [3,1,2,3] -} removeFirsts : List a -> List a -> List a removeFirsts = removeFirstsBy (==) {-| Remove last occurrence of element from list. removeLast 2 [1,2,1,2] == [1,2,1] -} removeLast : a -> List a -> List a removeLast = removeLastBy (==) {-| Generic version of removeFirst with a custom predicate. For example, remove first element that is greater than 2: removeFirstBy (>) 2 [1..4] == [1,2,4] -} removeFirstBy : (a -> a -> Bool) -> a -> List a -> List a removeFirstBy eq x xs = let ( ys, zs ) = break (flip eq x) xs in ys ++ drop 1 zs {-| Generic version of removeFirsts with a custom predicate. For example, remove first element that evenly divides by 2, then remove first element that evenly divides by 3: removeFirstsBy (\a b -> a `rem` b == 0) [2,3] [5..10] == [5,7,8,10] -} removeFirstsBy : (a -> a -> Bool) -> List a -> List a -> List a removeFirstsBy eq = flip <| foldl (removeFirstBy eq) {-| Generic version of removeLast with a custom predicate. -} removeLastBy : (a -> a -> Bool) -> a -> List a -> List a removeLastBy eq x = List.reverse << removeFirstBy eq x << List.reverse {-| Set difference between lists. [1,2,3] `difference` [3,4,5] == [1,2] -} difference : List a -> List a -> List a difference = differenceBy (==) {-| Union between lists. [3,2,1] `union` [3,4,5] == [3,2,1,4,5] -} union : List a -> List a -> List a union = unionBy (==) {-| Intersection between lists. [1,2,3] `intersect` [3,4,5] == [3] -} intersect : List a -> List a -> List a intersect = intersectBy (==) {-| Take an element and a list and insert the element into the list at the first position where it is less than or equal to the next element. If the list is sorted before the call, the result will also be sorted. insert 4 [1,3,5] == [1,3,4,5] -} insert : comparable -> List comparable -> List comparable insert = insertBy compare {-| Generic version of difference with a custom predicate. -} differenceBy : (a -> a -> Bool) -> List a -> List a -> List a differenceBy eq xs ys = filter (\x -> not <| any (eq x) ys) xs {-| Generic version of union with a custom predicate. -} unionBy : (a -> a -> Bool) -> List a -> List a -> List a unionBy eq xs ys = xs ++ filter (\y -> not <| any (eq y) xs) ys {-| Generic version of intersect with a custom predicate. -} intersectBy : (a -> a -> Bool) -> List a -> List a -> List a intersectBy eq xs ys = filter (\y -> any (eq y) xs) ys -- insertWith? {-| Generic version of insert with a custom predicate. -} insertBy : (a -> a -> Order) -> a -> List a -> List a insertBy cmp e xs = let ( ys, zs ) = break (\x -> cmp e x == GT) xs in ys ++ [ e ] ++ zs {-| Return a list of repeated applications of `f` to `x`. -} iterate : Int -> (a -> a) -> a -> List a iterate n f x = let step ( n, x' ) = if n == 0 then Nothing else Just ( x', ( n - 1, f x' ) ) in unfoldr step ( n, x ) -- move to extra? {-| -} unzip3 : List ( a, b, c ) -> ( List a, List b, List c ) unzip3 pairs = let step ( x, y, z ) ( xs, ys, zs ) = ( x :: xs, y :: ys, z :: zs ) in foldr step ( [], [], [] ) pairs {-| -} unzip4 : List ( a, b, c, d ) -> ( List a, List b, List c, List d ) unzip4 pairs = let step ( w, x, y, z ) ( ws, xs, ys, zs ) = ( w :: ws, x :: xs, y :: ys, z :: zs ) in foldr step ( [], [], [], [] ) pairs {-| -} unzip5 : List ( a, b, c, d, e ) -> ( List a, List b, List c, List d, List e ) unzip5 pairs = let step ( v, w, x, y, z ) ( vs, ws, xs, ys, zs ) = ( v :: vs, w :: ws, x :: xs, y :: ys, z :: zs ) in foldr step ( [], [], [], [], [] ) pairs mapWhen : (a -> Bool) -> (a -> a) -> List a -> List a mapWhen p f xs = map (\x -> if p x then f x else x ) xs -- mapFirst : (a -> Bool) -> (a -> a) -> List a -> List a -- mapFirst p f xs = -- let -- (ys, zs) = span p xs -- in -- mapLast : (a -> Bool) -> (a -> a) -> List a -> List a -- mapLast annonate : (a -> b) -> List a -> List ( b, a ) annonate f xs = map (\x -> ( f x, x )) xs splice : (a -> Bool) -> (a -> List a) -> List a -> List a splice p f xs = concatMap (\x -> if p x then f x else [ x ] ) xs spliceList : (a -> Bool) -> List a -> List a -> List a spliceList p ys xs = splice p (always ys) xs selectByIndices : List Int -> List a -> List a selectByIndices ns xs = filterMap (\n -> at n xs) ns
14069
module List.Experimental exposing ( and , or , conjunction , disjunction , lookup , filter2 , filterMap2 , filterM , at , removeAt , removeFirst , removeFirstBy , removeFirsts , removeFirstsBy , difference , union , intersect , insert , differenceBy , unionBy , intersectBy , insertBy , iterate ) {-| List.Experimental is a testing playground for various List related functions. It contains functions that are experimental, unidiomatic, controversial or downright silly. This is specifically to not clutter List and List.Extra, and also have an isolated place to test crazy ideas. *Do not* use this module in production code. Try your best to come up with equivalent functionality or solve your problem in a different way, and if you fail, consider contributing to List and List.Extra packages. *Do not* import functions from this module unqualified if you do use it. This package has the lowest possible bar for inclusion of List related functions. If you have some code that you want to publish somewhere, but not necessarily contribute to core libraries, feel absolutely free to contribute here. Treat this package as a safe sandbox. The GitHub page for ideas, suggestions, discussions, and pull requests is: https://github.com/sindikat/elm-list-experimental # List functions @docs and, or, conjunction, disjunction, lookup, filter2, filterMap2, filterM # Elements @docs at # Removal @docs removeAt, removeFirst, removeFirstBy, removeFirsts, removeFirstsBy # Set functions @docs difference, union, intersect, insert, differenceBy, unionBy, intersectBy, insertBy # Misc @docs iterate -} import List exposing (..) import List.Extra exposing (..) {-| Return the conjunction of all `Bool`s in a list. In other words, return True if all elements are True, return False otherwise. `and` is equivalent to `all identity`. Return True on an empty list. -} and : List Bool -> Bool and = all identity {-| Return the disjunction of all `Bool`s in a list. In other words, return True if any element is True, return False otherwise. `or` is equivalent to `any identity`. Return False on an empty list. -} or : List Bool -> Bool or = any identity {-| Same as `and`. -} conjunction : List Bool -> Bool conjunction = and {-| Same as `or`. -} disjunction : List Bool -> Bool disjunction = or {-| Look up a key in an association list, return corresponding value, wrapped in `Just`. If no value is found, return `Nothing`. If multiple values correspond to the same key, return the first found value. lookup 'a' [('a',1),('b',2),('c',3)] == Just 1 lookup 'd' [('a',1),('b',2),('c',3)] == Nothing lookup 3 [(1,"<NAME>"),(1,"<NAME>"),(2,"<NAME>")] == Just "<NAME>" -} lookup : a -> List ( a, b ) -> Maybe b lookup key = Maybe.map snd << find (\item -> fst item == key) {-| Filter over two lists simultaneously using a custom comparison function, return a list of pairs. -} filter2 : (a -> b -> Bool) -> List a -> List b -> List ( a, b ) filter2 p xs ys = filter (uncurry p) (map2 (,) xs ys) {-| Apply a function, which may succeed, to all values of two lists, but only keep the successes. -} filterMap2 : (a -> b -> Maybe c) -> List a -> List b -> List c filterMap2 f xs ys = List.filterMap identity <| map2 f xs ys {-| Filter that exploits the behavior of `andThen`. Return all subsequences of a list: filterM (\x -> [True, False]) [1,2,3] == [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]] Return all subsequences that contain 2: filterM (\x -> if x==2 then [True] else [True,False]) [1,2,3] == [[1,2,3],[1,2],[2,3],[2]] -} filterM : (a -> List Bool) -> List a -> List (List a) filterM p = let andThen = flip concatMap go x r = p x `andThen` (\flg -> r `andThen` (\ys -> [ if flg then x :: ys else ys ] ) ) in foldr go [ [] ] -- come up with a better name? {-| Extract *n*th element of a list, index counts from 0. at 1 [1,2,3] == Just 2 at 3 [1,2,3] == Nothing at -1 [1,2,3] == Nothing -} at : Int -> List a -> Maybe a at n xs = if n >= 0 then head <| drop n xs else Nothing {-| Remove *n*th element of a list. If index is negative or out of bounds of the list, return the list unchanged. removeAt 0 [1,2,3] == [2,3] removeAt 3 [1,2,3] == [1,2,3] removeAt -1 [1,2,3] == [1,2,3] -} removeAt : Int -> List a -> List a removeAt n xs = take n xs ++ drop (n + 1) xs {-| Remove first occurrence of element from list. removeFirst 2 [1,2,1,2] == [1,1,2] -} removeFirst : a -> List a -> List a removeFirst = removeFirstBy (==) {-| Remove first occurence of each element from list. removeFirsts [1,2] [1,2,3,1,2,3] == [3,1,2,3] -} removeFirsts : List a -> List a -> List a removeFirsts = removeFirstsBy (==) {-| Remove last occurrence of element from list. removeLast 2 [1,2,1,2] == [1,2,1] -} removeLast : a -> List a -> List a removeLast = removeLastBy (==) {-| Generic version of removeFirst with a custom predicate. For example, remove first element that is greater than 2: removeFirstBy (>) 2 [1..4] == [1,2,4] -} removeFirstBy : (a -> a -> Bool) -> a -> List a -> List a removeFirstBy eq x xs = let ( ys, zs ) = break (flip eq x) xs in ys ++ drop 1 zs {-| Generic version of removeFirsts with a custom predicate. For example, remove first element that evenly divides by 2, then remove first element that evenly divides by 3: removeFirstsBy (\a b -> a `rem` b == 0) [2,3] [5..10] == [5,7,8,10] -} removeFirstsBy : (a -> a -> Bool) -> List a -> List a -> List a removeFirstsBy eq = flip <| foldl (removeFirstBy eq) {-| Generic version of removeLast with a custom predicate. -} removeLastBy : (a -> a -> Bool) -> a -> List a -> List a removeLastBy eq x = List.reverse << removeFirstBy eq x << List.reverse {-| Set difference between lists. [1,2,3] `difference` [3,4,5] == [1,2] -} difference : List a -> List a -> List a difference = differenceBy (==) {-| Union between lists. [3,2,1] `union` [3,4,5] == [3,2,1,4,5] -} union : List a -> List a -> List a union = unionBy (==) {-| Intersection between lists. [1,2,3] `intersect` [3,4,5] == [3] -} intersect : List a -> List a -> List a intersect = intersectBy (==) {-| Take an element and a list and insert the element into the list at the first position where it is less than or equal to the next element. If the list is sorted before the call, the result will also be sorted. insert 4 [1,3,5] == [1,3,4,5] -} insert : comparable -> List comparable -> List comparable insert = insertBy compare {-| Generic version of difference with a custom predicate. -} differenceBy : (a -> a -> Bool) -> List a -> List a -> List a differenceBy eq xs ys = filter (\x -> not <| any (eq x) ys) xs {-| Generic version of union with a custom predicate. -} unionBy : (a -> a -> Bool) -> List a -> List a -> List a unionBy eq xs ys = xs ++ filter (\y -> not <| any (eq y) xs) ys {-| Generic version of intersect with a custom predicate. -} intersectBy : (a -> a -> Bool) -> List a -> List a -> List a intersectBy eq xs ys = filter (\y -> any (eq y) xs) ys -- insertWith? {-| Generic version of insert with a custom predicate. -} insertBy : (a -> a -> Order) -> a -> List a -> List a insertBy cmp e xs = let ( ys, zs ) = break (\x -> cmp e x == GT) xs in ys ++ [ e ] ++ zs {-| Return a list of repeated applications of `f` to `x`. -} iterate : Int -> (a -> a) -> a -> List a iterate n f x = let step ( n, x' ) = if n == 0 then Nothing else Just ( x', ( n - 1, f x' ) ) in unfoldr step ( n, x ) -- move to extra? {-| -} unzip3 : List ( a, b, c ) -> ( List a, List b, List c ) unzip3 pairs = let step ( x, y, z ) ( xs, ys, zs ) = ( x :: xs, y :: ys, z :: zs ) in foldr step ( [], [], [] ) pairs {-| -} unzip4 : List ( a, b, c, d ) -> ( List a, List b, List c, List d ) unzip4 pairs = let step ( w, x, y, z ) ( ws, xs, ys, zs ) = ( w :: ws, x :: xs, y :: ys, z :: zs ) in foldr step ( [], [], [], [] ) pairs {-| -} unzip5 : List ( a, b, c, d, e ) -> ( List a, List b, List c, List d, List e ) unzip5 pairs = let step ( v, w, x, y, z ) ( vs, ws, xs, ys, zs ) = ( v :: vs, w :: ws, x :: xs, y :: ys, z :: zs ) in foldr step ( [], [], [], [], [] ) pairs mapWhen : (a -> Bool) -> (a -> a) -> List a -> List a mapWhen p f xs = map (\x -> if p x then f x else x ) xs -- mapFirst : (a -> Bool) -> (a -> a) -> List a -> List a -- mapFirst p f xs = -- let -- (ys, zs) = span p xs -- in -- mapLast : (a -> Bool) -> (a -> a) -> List a -> List a -- mapLast annonate : (a -> b) -> List a -> List ( b, a ) annonate f xs = map (\x -> ( f x, x )) xs splice : (a -> Bool) -> (a -> List a) -> List a -> List a splice p f xs = concatMap (\x -> if p x then f x else [ x ] ) xs spliceList : (a -> Bool) -> List a -> List a -> List a spliceList p ys xs = splice p (always ys) xs selectByIndices : List Int -> List a -> List a selectByIndices ns xs = filterMap (\n -> at n xs) ns
true
module List.Experimental exposing ( and , or , conjunction , disjunction , lookup , filter2 , filterMap2 , filterM , at , removeAt , removeFirst , removeFirstBy , removeFirsts , removeFirstsBy , difference , union , intersect , insert , differenceBy , unionBy , intersectBy , insertBy , iterate ) {-| List.Experimental is a testing playground for various List related functions. It contains functions that are experimental, unidiomatic, controversial or downright silly. This is specifically to not clutter List and List.Extra, and also have an isolated place to test crazy ideas. *Do not* use this module in production code. Try your best to come up with equivalent functionality or solve your problem in a different way, and if you fail, consider contributing to List and List.Extra packages. *Do not* import functions from this module unqualified if you do use it. This package has the lowest possible bar for inclusion of List related functions. If you have some code that you want to publish somewhere, but not necessarily contribute to core libraries, feel absolutely free to contribute here. Treat this package as a safe sandbox. The GitHub page for ideas, suggestions, discussions, and pull requests is: https://github.com/sindikat/elm-list-experimental # List functions @docs and, or, conjunction, disjunction, lookup, filter2, filterMap2, filterM # Elements @docs at # Removal @docs removeAt, removeFirst, removeFirstBy, removeFirsts, removeFirstsBy # Set functions @docs difference, union, intersect, insert, differenceBy, unionBy, intersectBy, insertBy # Misc @docs iterate -} import List exposing (..) import List.Extra exposing (..) {-| Return the conjunction of all `Bool`s in a list. In other words, return True if all elements are True, return False otherwise. `and` is equivalent to `all identity`. Return True on an empty list. -} and : List Bool -> Bool and = all identity {-| Return the disjunction of all `Bool`s in a list. In other words, return True if any element is True, return False otherwise. `or` is equivalent to `any identity`. Return False on an empty list. -} or : List Bool -> Bool or = any identity {-| Same as `and`. -} conjunction : List Bool -> Bool conjunction = and {-| Same as `or`. -} disjunction : List Bool -> Bool disjunction = or {-| Look up a key in an association list, return corresponding value, wrapped in `Just`. If no value is found, return `Nothing`. If multiple values correspond to the same key, return the first found value. lookup 'a' [('a',1),('b',2),('c',3)] == Just 1 lookup 'd' [('a',1),('b',2),('c',3)] == Nothing lookup 3 [(1,"PI:NAME:<NAME>END_PI"),(1,"PI:NAME:<NAME>END_PI"),(2,"PI:NAME:<NAME>END_PI")] == Just "PI:NAME:<NAME>END_PI" -} lookup : a -> List ( a, b ) -> Maybe b lookup key = Maybe.map snd << find (\item -> fst item == key) {-| Filter over two lists simultaneously using a custom comparison function, return a list of pairs. -} filter2 : (a -> b -> Bool) -> List a -> List b -> List ( a, b ) filter2 p xs ys = filter (uncurry p) (map2 (,) xs ys) {-| Apply a function, which may succeed, to all values of two lists, but only keep the successes. -} filterMap2 : (a -> b -> Maybe c) -> List a -> List b -> List c filterMap2 f xs ys = List.filterMap identity <| map2 f xs ys {-| Filter that exploits the behavior of `andThen`. Return all subsequences of a list: filterM (\x -> [True, False]) [1,2,3] == [[1,2,3],[1,2],[1,3],[1],[2,3],[2],[3],[]] Return all subsequences that contain 2: filterM (\x -> if x==2 then [True] else [True,False]) [1,2,3] == [[1,2,3],[1,2],[2,3],[2]] -} filterM : (a -> List Bool) -> List a -> List (List a) filterM p = let andThen = flip concatMap go x r = p x `andThen` (\flg -> r `andThen` (\ys -> [ if flg then x :: ys else ys ] ) ) in foldr go [ [] ] -- come up with a better name? {-| Extract *n*th element of a list, index counts from 0. at 1 [1,2,3] == Just 2 at 3 [1,2,3] == Nothing at -1 [1,2,3] == Nothing -} at : Int -> List a -> Maybe a at n xs = if n >= 0 then head <| drop n xs else Nothing {-| Remove *n*th element of a list. If index is negative or out of bounds of the list, return the list unchanged. removeAt 0 [1,2,3] == [2,3] removeAt 3 [1,2,3] == [1,2,3] removeAt -1 [1,2,3] == [1,2,3] -} removeAt : Int -> List a -> List a removeAt n xs = take n xs ++ drop (n + 1) xs {-| Remove first occurrence of element from list. removeFirst 2 [1,2,1,2] == [1,1,2] -} removeFirst : a -> List a -> List a removeFirst = removeFirstBy (==) {-| Remove first occurence of each element from list. removeFirsts [1,2] [1,2,3,1,2,3] == [3,1,2,3] -} removeFirsts : List a -> List a -> List a removeFirsts = removeFirstsBy (==) {-| Remove last occurrence of element from list. removeLast 2 [1,2,1,2] == [1,2,1] -} removeLast : a -> List a -> List a removeLast = removeLastBy (==) {-| Generic version of removeFirst with a custom predicate. For example, remove first element that is greater than 2: removeFirstBy (>) 2 [1..4] == [1,2,4] -} removeFirstBy : (a -> a -> Bool) -> a -> List a -> List a removeFirstBy eq x xs = let ( ys, zs ) = break (flip eq x) xs in ys ++ drop 1 zs {-| Generic version of removeFirsts with a custom predicate. For example, remove first element that evenly divides by 2, then remove first element that evenly divides by 3: removeFirstsBy (\a b -> a `rem` b == 0) [2,3] [5..10] == [5,7,8,10] -} removeFirstsBy : (a -> a -> Bool) -> List a -> List a -> List a removeFirstsBy eq = flip <| foldl (removeFirstBy eq) {-| Generic version of removeLast with a custom predicate. -} removeLastBy : (a -> a -> Bool) -> a -> List a -> List a removeLastBy eq x = List.reverse << removeFirstBy eq x << List.reverse {-| Set difference between lists. [1,2,3] `difference` [3,4,5] == [1,2] -} difference : List a -> List a -> List a difference = differenceBy (==) {-| Union between lists. [3,2,1] `union` [3,4,5] == [3,2,1,4,5] -} union : List a -> List a -> List a union = unionBy (==) {-| Intersection between lists. [1,2,3] `intersect` [3,4,5] == [3] -} intersect : List a -> List a -> List a intersect = intersectBy (==) {-| Take an element and a list and insert the element into the list at the first position where it is less than or equal to the next element. If the list is sorted before the call, the result will also be sorted. insert 4 [1,3,5] == [1,3,4,5] -} insert : comparable -> List comparable -> List comparable insert = insertBy compare {-| Generic version of difference with a custom predicate. -} differenceBy : (a -> a -> Bool) -> List a -> List a -> List a differenceBy eq xs ys = filter (\x -> not <| any (eq x) ys) xs {-| Generic version of union with a custom predicate. -} unionBy : (a -> a -> Bool) -> List a -> List a -> List a unionBy eq xs ys = xs ++ filter (\y -> not <| any (eq y) xs) ys {-| Generic version of intersect with a custom predicate. -} intersectBy : (a -> a -> Bool) -> List a -> List a -> List a intersectBy eq xs ys = filter (\y -> any (eq y) xs) ys -- insertWith? {-| Generic version of insert with a custom predicate. -} insertBy : (a -> a -> Order) -> a -> List a -> List a insertBy cmp e xs = let ( ys, zs ) = break (\x -> cmp e x == GT) xs in ys ++ [ e ] ++ zs {-| Return a list of repeated applications of `f` to `x`. -} iterate : Int -> (a -> a) -> a -> List a iterate n f x = let step ( n, x' ) = if n == 0 then Nothing else Just ( x', ( n - 1, f x' ) ) in unfoldr step ( n, x ) -- move to extra? {-| -} unzip3 : List ( a, b, c ) -> ( List a, List b, List c ) unzip3 pairs = let step ( x, y, z ) ( xs, ys, zs ) = ( x :: xs, y :: ys, z :: zs ) in foldr step ( [], [], [] ) pairs {-| -} unzip4 : List ( a, b, c, d ) -> ( List a, List b, List c, List d ) unzip4 pairs = let step ( w, x, y, z ) ( ws, xs, ys, zs ) = ( w :: ws, x :: xs, y :: ys, z :: zs ) in foldr step ( [], [], [], [] ) pairs {-| -} unzip5 : List ( a, b, c, d, e ) -> ( List a, List b, List c, List d, List e ) unzip5 pairs = let step ( v, w, x, y, z ) ( vs, ws, xs, ys, zs ) = ( v :: vs, w :: ws, x :: xs, y :: ys, z :: zs ) in foldr step ( [], [], [], [], [] ) pairs mapWhen : (a -> Bool) -> (a -> a) -> List a -> List a mapWhen p f xs = map (\x -> if p x then f x else x ) xs -- mapFirst : (a -> Bool) -> (a -> a) -> List a -> List a -- mapFirst p f xs = -- let -- (ys, zs) = span p xs -- in -- mapLast : (a -> Bool) -> (a -> a) -> List a -> List a -- mapLast annonate : (a -> b) -> List a -> List ( b, a ) annonate f xs = map (\x -> ( f x, x )) xs splice : (a -> Bool) -> (a -> List a) -> List a -> List a splice p f xs = concatMap (\x -> if p x then f x else [ x ] ) xs spliceList : (a -> Bool) -> List a -> List a -> List a spliceList p ys xs = splice p (always ys) xs selectByIndices : List Int -> List a -> List a selectByIndices ns xs = filterMap (\n -> at n xs) ns
elm
[ { "context": "{-\n Copyright 2020 Morgan Stanley\n\n Licensed under the Apache License, Version 2.", "end": 35, "score": 0.9998217821, "start": 21, "tag": "NAME", "value": "Morgan Stanley" } ]
src/Morphir/SpringBoot/Backend/Codec.elm
bekand/morphir-elm
6
{- Copyright 2020 Morgan Stanley Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -} module Morphir.SpringBoot.Backend.Codec exposing (..) import Json.Decode as Decode import Morphir.SpringBoot.Backend exposing (Options) decodeOptions : Decode.Decoder Options decodeOptions = Decode.succeed Options
15108
{- Copyright 2020 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -} module Morphir.SpringBoot.Backend.Codec exposing (..) import Json.Decode as Decode import Morphir.SpringBoot.Backend exposing (Options) decodeOptions : Decode.Decoder Options decodeOptions = Decode.succeed Options
true
{- Copyright 2020 PI:NAME:<NAME>END_PI Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -} module Morphir.SpringBoot.Backend.Codec exposing (..) import Json.Decode as Decode import Morphir.SpringBoot.Backend exposing (Options) decodeOptions : Decode.Decoder Options decodeOptions = Decode.succeed Options
elm
[ { "context": "])\n in\n getIndexes \"Pe\" \"Peter\" |> Expect.equal []\n , test \"when ", "end": 1316, "score": 0.9204420447, "start": 1314, "tag": "NAME", "value": "Pe" }, { "context": " in\n getIndexes \"Pe\" \"Peter\" |> Expect.equal []\n , test \"when minlengt", "end": 1324, "score": 0.9787238836, "start": 1319, "tag": "NAME", "value": "Peter" }, { "context": " in\n decoratedGetIndexes \"Pet\" \"Peter\" |> Expect.equal (getIndexes \"Pet\" \"Peter", "end": 1751, "score": 0.9653279185, "start": 1748, "tag": "NAME", "value": "Pet" }, { "context": " in\n decoratedGetIndexes \"Pet\" \"Peter\" |> Expect.equal (getIndexes \"Pet\" \"Peter\")\n ", "end": 1759, "score": 0.9824410677, "start": 1754, "tag": "NAME", "value": "Peter" }, { "context": "ndexes \"Pet\" \"Peter\" |> Expect.equal (getIndexes \"Pet\" \"Peter\")\n ]\n\n\ngetIndexesFunctionsTest : T", "end": 1793, "score": 0.6500263214, "start": 1790, "tag": "NAME", "value": "Pet" }, { "context": " \"Pet\" \"Peter\" |> Expect.equal (getIndexes \"Pet\" \"Peter\")\n ]\n\n\ngetIndexesFunctionsTest : Test\ngetI", "end": 1801, "score": 0.9590158463, "start": 1796, "tag": "NAME", "value": "Peter" }, { "context": " \\() ->\n stringIndexes \"ete\" \"Peter Leter SCHMETER\" |> Expect.equal [ ( 1, 4 ), ( 7, 10 ) ]", "end": 2056, "score": 0.9657903314, "start": 2045, "tag": "NAME", "value": "Peter Leter" }, { "context": " \\() ->\n stringIndexes \"Peter\" \"PeterPeter\" |> Expect.equal [ ( 0, 5 ), ( 5, 10", "end": 2219, "score": 0.5279125571, "start": 2215, "tag": "NAME", "value": "eter" }, { "context": "\\() ->\n stringIndexes \"Peter\" \"PeterPeter\" |> Expect.equal [ ( 0, 5 ), ( 5, 10 ) ]\n ", "end": 2232, "score": 0.7386664152, "start": 2222, "tag": "NAME", "value": "PeterPeter" }, { "context": " stringIndexesIgnoreCase \"ETE\" \"Peter Leter\" |> Expect.equal [ ( 1, 4 ), ( 7, 10 ) ]\n ", "end": 2482, "score": 0.9985835552, "start": 2471, "tag": "NAME", "value": "Peter Leter" }, { "context": " in\n getIndexes \"peter\" \"Peter Leter SCHMETER\"\n |> Expect.equal (getIndexes ", "end": 2961, "score": 0.8722099662, "start": 2941, "tag": "NAME", "value": "Peter Leter SCHMETER" }, { "context": " |> Expect.equal (getIndexes \"peter\" \"Peter Leter SCHMETER\")\n , test \"decorates a getIndexes", "end": 3031, "score": 0.9865595102, "start": 3020, "tag": "NAME", "value": "Peter Leter" } ]
tests/InternalTest.elm
ChristophP/elm-mark
7
module InternalTest exposing (..) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import Internal exposing ( applyMinLengthCheck , filterLastTwo , multiWordGetIndexes , stringIndexes , stringIndexesIgnoreCase ) import Test exposing (..) basic : Test basic = describe "filterLastTwo case ignore" <| [ test "returns the same list if length is zero" <| \() -> filterLastTwo (<=) [] |> Expect.equal [] , test "returns the same list if length is one" <| \() -> filterLastTwo (<=) [ 1 ] |> Expect.equal [ 1 ] , test "filter based on the last two elements" <| \() -> filterLastTwo (<=) [ 1, 2, 1, 3, 5, 4 ] |> Expect.equal [ 1, 2, 3, 5 ] ] applyMinLengthCheckTest : Test applyMinLengthCheckTest = describe "applyMinLengthCheck" <| [ test "when minlength is not reached returns a getIndexes function that always returns an empty list" <| \() -> let getIndexes = applyMinLengthCheck 3 (\term content -> [ ( 1, 2 ) ]) in getIndexes "Pe" "Peter" |> Expect.equal [] , test "when minlength is not reached returns a getIndexes function that indentical to the one that's passed" <| \() -> let getIndexes = \term content -> [ ( 1, 2 ) ] decoratedGetIndexes = applyMinLengthCheck 3 getIndexes in decoratedGetIndexes "Pet" "Peter" |> Expect.equal (getIndexes "Pet" "Peter") ] getIndexesFunctionsTest : Test getIndexesFunctionsTest = concat [ describe "stringIndexes" [ test "gets indexes in case sensitive manner" <| \() -> stringIndexes "ete" "Peter Leter SCHMETER" |> Expect.equal [ ( 1, 4 ), ( 7, 10 ) ] , test "works with adjacent hits" <| \() -> stringIndexes "Peter" "PeterPeter" |> Expect.equal [ ( 0, 5 ), ( 5, 10 ) ] ] , describe "stringIndexesIgnoreCase" [ test "gets indexes in case insensitive manner" <| \() -> stringIndexesIgnoreCase "ETE" "Peter Leter" |> Expect.equal [ ( 1, 4 ), ( 7, 10 ) ] ] ] multiWordGetIndexesTest : Test multiWordGetIndexesTest = describe "multiWordGetIndexes" [ test "returns function that acts like passed callback when only a single word is searched" <| \() -> let getIndexes = multiWordGetIndexes stringIndexesIgnoreCase in getIndexes "peter" "Peter Leter SCHMETER" |> Expect.equal (getIndexes "peter" "Peter Leter SCHMETER") , test "decorates a getIndexes function to find all words separately" <| \() -> let getIndexes = multiWordGetIndexes stringIndexesIgnoreCase in getIndexes "iss ipp" "mississippi" |> Expect.equal [ ( 1, 4 ), ( 4, 7 ), ( 7, 10 ) ] ]
1316
module InternalTest exposing (..) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import Internal exposing ( applyMinLengthCheck , filterLastTwo , multiWordGetIndexes , stringIndexes , stringIndexesIgnoreCase ) import Test exposing (..) basic : Test basic = describe "filterLastTwo case ignore" <| [ test "returns the same list if length is zero" <| \() -> filterLastTwo (<=) [] |> Expect.equal [] , test "returns the same list if length is one" <| \() -> filterLastTwo (<=) [ 1 ] |> Expect.equal [ 1 ] , test "filter based on the last two elements" <| \() -> filterLastTwo (<=) [ 1, 2, 1, 3, 5, 4 ] |> Expect.equal [ 1, 2, 3, 5 ] ] applyMinLengthCheckTest : Test applyMinLengthCheckTest = describe "applyMinLengthCheck" <| [ test "when minlength is not reached returns a getIndexes function that always returns an empty list" <| \() -> let getIndexes = applyMinLengthCheck 3 (\term content -> [ ( 1, 2 ) ]) in getIndexes "<NAME>" "<NAME>" |> Expect.equal [] , test "when minlength is not reached returns a getIndexes function that indentical to the one that's passed" <| \() -> let getIndexes = \term content -> [ ( 1, 2 ) ] decoratedGetIndexes = applyMinLengthCheck 3 getIndexes in decoratedGetIndexes "<NAME>" "<NAME>" |> Expect.equal (getIndexes "<NAME>" "<NAME>") ] getIndexesFunctionsTest : Test getIndexesFunctionsTest = concat [ describe "stringIndexes" [ test "gets indexes in case sensitive manner" <| \() -> stringIndexes "ete" "<NAME> SCHMETER" |> Expect.equal [ ( 1, 4 ), ( 7, 10 ) ] , test "works with adjacent hits" <| \() -> stringIndexes "P<NAME>" "<NAME>" |> Expect.equal [ ( 0, 5 ), ( 5, 10 ) ] ] , describe "stringIndexesIgnoreCase" [ test "gets indexes in case insensitive manner" <| \() -> stringIndexesIgnoreCase "ETE" "<NAME>" |> Expect.equal [ ( 1, 4 ), ( 7, 10 ) ] ] ] multiWordGetIndexesTest : Test multiWordGetIndexesTest = describe "multiWordGetIndexes" [ test "returns function that acts like passed callback when only a single word is searched" <| \() -> let getIndexes = multiWordGetIndexes stringIndexesIgnoreCase in getIndexes "peter" "<NAME>" |> Expect.equal (getIndexes "peter" "<NAME> SCHMETER") , test "decorates a getIndexes function to find all words separately" <| \() -> let getIndexes = multiWordGetIndexes stringIndexesIgnoreCase in getIndexes "iss ipp" "mississippi" |> Expect.equal [ ( 1, 4 ), ( 4, 7 ), ( 7, 10 ) ] ]
true
module InternalTest exposing (..) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import Internal exposing ( applyMinLengthCheck , filterLastTwo , multiWordGetIndexes , stringIndexes , stringIndexesIgnoreCase ) import Test exposing (..) basic : Test basic = describe "filterLastTwo case ignore" <| [ test "returns the same list if length is zero" <| \() -> filterLastTwo (<=) [] |> Expect.equal [] , test "returns the same list if length is one" <| \() -> filterLastTwo (<=) [ 1 ] |> Expect.equal [ 1 ] , test "filter based on the last two elements" <| \() -> filterLastTwo (<=) [ 1, 2, 1, 3, 5, 4 ] |> Expect.equal [ 1, 2, 3, 5 ] ] applyMinLengthCheckTest : Test applyMinLengthCheckTest = describe "applyMinLengthCheck" <| [ test "when minlength is not reached returns a getIndexes function that always returns an empty list" <| \() -> let getIndexes = applyMinLengthCheck 3 (\term content -> [ ( 1, 2 ) ]) in getIndexes "PI:NAME:<NAME>END_PI" "PI:NAME:<NAME>END_PI" |> Expect.equal [] , test "when minlength is not reached returns a getIndexes function that indentical to the one that's passed" <| \() -> let getIndexes = \term content -> [ ( 1, 2 ) ] decoratedGetIndexes = applyMinLengthCheck 3 getIndexes in decoratedGetIndexes "PI:NAME:<NAME>END_PI" "PI:NAME:<NAME>END_PI" |> Expect.equal (getIndexes "PI:NAME:<NAME>END_PI" "PI:NAME:<NAME>END_PI") ] getIndexesFunctionsTest : Test getIndexesFunctionsTest = concat [ describe "stringIndexes" [ test "gets indexes in case sensitive manner" <| \() -> stringIndexes "ete" "PI:NAME:<NAME>END_PI SCHMETER" |> Expect.equal [ ( 1, 4 ), ( 7, 10 ) ] , test "works with adjacent hits" <| \() -> stringIndexes "PPI:NAME:<NAME>END_PI" "PI:NAME:<NAME>END_PI" |> Expect.equal [ ( 0, 5 ), ( 5, 10 ) ] ] , describe "stringIndexesIgnoreCase" [ test "gets indexes in case insensitive manner" <| \() -> stringIndexesIgnoreCase "ETE" "PI:NAME:<NAME>END_PI" |> Expect.equal [ ( 1, 4 ), ( 7, 10 ) ] ] ] multiWordGetIndexesTest : Test multiWordGetIndexesTest = describe "multiWordGetIndexes" [ test "returns function that acts like passed callback when only a single word is searched" <| \() -> let getIndexes = multiWordGetIndexes stringIndexesIgnoreCase in getIndexes "peter" "PI:NAME:<NAME>END_PI" |> Expect.equal (getIndexes "peter" "PI:NAME:<NAME>END_PI SCHMETER") , test "decorates a getIndexes function to find all words separately" <| \() -> let getIndexes = multiWordGetIndexes stringIndexesIgnoreCase in getIndexes "iss ipp" "mississippi" |> Expect.equal [ ( 1, 4 ), ( 4, 7 ), ( 7, 10 ) ] ]
elm
[ { "context": " روزا قريبه من بيته\"\n , meaning = \"His friend Rosa is close to his house.\"\n }\n , { latin = ", "end": 17814, "score": 0.9871558547, "start": 17810, "tag": "NAME", "value": "Rosa" }, { "context": "ا بوب قريب من بيتها\"\n , meaning = \"Her friend Bob is close to her house.\"\n } \n , { latin =", "end": 18451, "score": 0.9993483424, "start": 18448, "tag": "NAME", "value": "Bob" }, { "context": "se to her house.\"\n } \n , { latin = \"ismhu bob\"\n , arabic = \"إسمه بوب\"\n , meaning = \"H", "end": 18512, "score": 0.8701997995, "start": 18509, "tag": "NAME", "value": "bob" }, { "context": "arabic = \"إسمه بوب\"\n , meaning = \"His name is Bob.\"\n }\n , { latin = \"baythu qariib min bay", "end": 18576, "score": 0.9994205832, "start": 18573, "tag": "NAME", "value": "Bob" }, { "context": "َتهُ سامْية غَنِيّة\"\n , meaning = \"His friend Samia is rich.\"\n }\n , { latin = \"taariikhiyya\"", "end": 33989, "score": 0.7351631522, "start": 33984, "tag": "NAME", "value": "Samia" }, { "context": " تامِر غَنِيّ جِدّاً\"\n , meaning = \"My friend Tamer is very rich\"\n }\n , { latin = \"laa 2a3ri", "end": 34387, "score": 0.9342767596, "start": 34382, "tag": "NAME", "value": "Tamer" }, { "context": "\"أَخي بَشير مَشْغول\"\n , meaning = \"My brother Bashir is busy.\"\n }\n , { latin = \"fii haadhihi ", "end": 35690, "score": 0.9985380173, "start": 35684, "tag": "NAME", "value": "Bashir" }, { "context": "ً اِسْمي بوب\"\n , meaning = \"Hello, my name is Bob.\"\n }\n , { latin = \"Haziin\"\n , arabi", "end": 45996, "score": 0.9995663166, "start": 45993, "tag": "NAME", "value": "Bob" }, { "context": " \"أَنا إِسمي فاطِمة\"\n , meaning = \"My name is Fatima.\"\n }\n , { latin = \"2a3iish fii miSr\"\n ", "end": 52719, "score": 0.9997267127, "start": 52713, "tag": "NAME", "value": "Fatima" }, { "context": "ُ سامية\"\n , meaning = \"This is his girlfriend Samia.\"\n }\n\n\n\n ]\n", "end": 53334, "score": 0.5603682399, "start": 53331, "tag": "NAME", "value": "Sam" } ]
src/Arabic003.elm
kalz2q/elm-examples
0
module Arabic001 exposing (main) -- 2020-05-10 07:40:28 -- backup because I am makeing "kana" entry in the data import Browser import Html exposing (..) import Html.Attributes as HA import Html.Events as HE import Random main : Program () Model Msg main = Browser.element { init = init , update = update , subscriptions = subscriptions , view = view } type alias Model = { latin : String , arabic : String , meaning : String , showanswer : Bool , list : List Arabicdata } type alias Arabicdata = { latin : String , arabic : String , meaning : String } init : () -> ( Model, Cmd Msg ) init _ = ( Model "" "" "" False dict , Random.generate NewList (shuffle dict) ) type Msg = Delete | Next | NewRandom Int | Shuffle | NewList (List Arabicdata) | ShowAnswer Int update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Delete -> ( model , Cmd.none ) Next -> ( model , Cmd.none ) NewRandom n -> case List.drop n dict of x :: _ -> ( { model | latin = x.latin , arabic = x.arabic , meaning = x.meaning } , Cmd.none ) [] -> ( model , Cmd.none ) Shuffle -> ( model , Random.generate NewList (shuffle dict) ) NewList newList -> ( { model | list = newList } , Cmd.none ) ShowAnswer index -> case List.drop index model.list of x :: _ -> ( { model | latin = x.latin , arabic = x.arabic , meaning = x.meaning , showanswer = True } , Cmd.none ) [] -> ( model , Cmd.none ) subscriptions : Model -> Sub Msg subscriptions model = Sub.none view : Model -> Html Msg view model = div [] [ text "Convert latin to arabic" , p [] [ text "SabaaH" ] , button [] [ text "Show Answer" ] , button [] [ text "Delete" ] , button [] [ text "Next" ] ] shuffle : List a -> Random.Generator (List a) shuffle list = let randomNumbers : Random.Generator (List Int) randomNumbers = Random.list (List.length list) <| Random.int Random.minInt Random.maxInt zipWithList : List Int -> List ( a, Int ) zipWithList intList = List.map2 Tuple.pair list intList listWithRandomNumbers : Random.Generator (List ( a, Int )) listWithRandomNumbers = Random.map zipWithList randomNumbers sortedGenerator : Random.Generator (List ( a, Int )) sortedGenerator = Random.map (List.sortBy Tuple.second) listWithRandomNumbers in Random.map (List.map Tuple.first) sortedGenerator dict = [ { latin = "alssalaamu" , arabic = "اَلسَّلَامُ" , meaning = "peace" } , { latin = "2alaykum" , arabic = "عَلَيْكُمْ" , meaning = "on you" } , { latin = "SabaaH" , arabic = "صَبَاح" , meaning = "morning" } , { latin = "marhaban" , arabic = "مَرْحَبًا" , meaning = "Hello" } , { latin = "thaqaafah" , arabic = "ثَقافَة" , meaning = "culture" } , { latin = "2anaa bikhayr" , arabic = "أَنا بِخَيْر" , meaning = "I'm fine" } , { latin = "kabir" , arabic = "كَبير" , meaning = "large, big" } , { latin = "kabirah" , arabic = "كبيرة" , meaning = "large, big" } , { latin = "bayt" , arabic = "بَيْت" , meaning = "a house" } , { latin = "laysa" , arabic = "لِيْسَ" , meaning = "do not" } , { latin = "3and" , arabic = "عَنْد" , meaning = "have" } , { latin = "siith" , arabic = "سيث" , meaning = "Seth(male name)" } , { latin = "baluuzah" , arabic = "بَلوزة" , meaning = "blouse" } , { latin = "tii shiirt" , arabic = "تي شيرْت" , meaning = "T-shirt" } , { latin = "mi3Taf" , arabic = "مِعْطَف" , meaning = "a coat" } , { latin = "riim" , arabic = "ريم" , meaning = "Reem(name)" } , { latin = "tannuura" , arabic = "تَنّورة" , meaning = "a skirt" } , { latin = "jadiid" , arabic = "جَديد" , meaning = "new" } , { latin = "wishshaaH" , arabic = "وِشَاح" , meaning = "a scarf" } , { latin = "judii" , arabic = "جودي" , meaning = "Judy(name)" } , { latin = "jamiil" , arabic = "جَميل" , meaning = "good, nice, pretty, beautiful" } , { latin = "kalb" , arabic = "كَلْب" , meaning = "a dog" } , { latin = "2azraq" , arabic = "أَزْرَق" , meaning = "blue" } , { latin = "2abyaD" , arabic = "أَبْيَض " , meaning = "white" } , { latin = "qubb3a" , arabic = "قُبَّعة" , meaning = "a hat" } , { latin = "bunniyy" , arabic = "بُنِّيّ" , meaning = "brown" } , { latin = "mruu2a" , arabic = "مْروءة" , meaning = "chivalry" } , { latin = "kitaab" , arabic = "كِتاب" , meaning = "a book" } , { latin = "Taawilah" , arabic = "طاوِلة" , meaning = "a table" } , { latin = "hadhihi madiinA qadiima" , arabic = "هَذِهِ مَدينة قَديمة" , meaning = "This is an ancient city" } , { latin = "Hadiiqa" , arabic = "حَديقة" , meaning = "garden" } , { latin = "hadhihi HadiiqA 3arabyya" , arabic = "هَذِهِ حَديقة عَرَبيّة" , meaning = "This is an Arab garden" } , { latin = "hadhihi binaaya jamiila" , arabic = "هَذِهِ بِناية جَميلة" , meaning = "This is a beautiful building" } , { latin = "hadhaa muhammad" , arabic = "هَذا مُحَمَّد" , meaning = "This is mohamed" } , { latin = "hadhaa Saaluun ghaalii" , arabic = "هَذا صالون غالي" , meaning = "This is an expensive living room" } , { latin = "hadhihi HadiiqA jamiila" , arabic = "هَذِهِ حَديقة جَميلة" , meaning = "This is a pretty garden" } , { latin = "hadhihi HadiiqA qadiima" , arabic = "هَذِهِ حَديقة قَديمة" , meaning = "This is an old garden" } , { latin = "alHa2iT" , arabic = "الْحائط" , meaning = "the wall" } , { latin = "Ha2iT" , arabic = "حائِط" , meaning = "wall" } , { latin = "hadhaa alHaa2iT kabiir" , arabic = "هَذا الْحائِط كَبير " , meaning = "this wall is big" } , { latin = "alkalb" , arabic = "الْكَلْب" , meaning = "the dog" } , { latin = "hadhihi albinaaya" , arabic = "هذِهِ الْبِناية " , meaning = "this building" } , { latin = "al-ghurfa" , arabic = "اَلْغُرفة" , meaning = "the room" } , { latin = "alghurfA kaBiira" , arabic = "اَلْغرْفة كَبيرة" , meaning = "Theroom is big" } , { latin = "hadhihi alghurfa kabiira" , arabic = "هَذِهِ الْغُرْفة كَبيرة" , meaning = "this room is big" } , { latin = "hadhaa alkalb kalbii" , arabic = "هَذا الْكَلْب كَْلبي" , meaning = "this dog is my dog" } , { latin = "hadhaa alkalb jaw3aan" , arabic = "هَذا الْكَلْب جَوْعان" , meaning = "this dog is hungry" } , { latin = "hadhihi albinaaya waas3a" , arabic = "هَذِهِ الْبناية واسِعة" , meaning = "this building is spacious" } , { latin = "alkalb ghariib" , arabic = "اَلْكَلْب غَريب" , meaning = "The dog is weird" } , { latin = "alkalb kalbii" , arabic = "اَلْكَلْب كَلْبي" , meaning = "The dog is my dog" } , { latin = "hunaak" , arabic = "هُناك" , meaning = "there" } , { latin = "hunaak bayt" , arabic = "هُناك بَيْت" , meaning = "There is a house" } , { latin = "albayt hunaak" , arabic = "اَلْبَيْت هُناك" , meaning = "The house is there" } , { latin = "hunaak wishaaH 2abyaD" , arabic = "هُناك وِشاح أبْيَض" , meaning = "There is a white scarf" } , { latin = "alkalb munaak" , arabic = "اَلْكَلْب مُناك" , meaning = "The dog is there" } , { latin = "fii shanTatii" , arabic = "في شَنْطَتي" , meaning = "in my bag" } , { latin = "hal 3indak maHfaDHA yaa juurj" , arabic = "هَل عِنْدَك مَحْفَظة يا جورْج" , meaning = "do you have a wallet , george" } , { latin = "3indii shanTa ghaalya" , arabic = "عِنْدي شَنْطة غالْية" , meaning = "I have an expensive bag" } , { latin = "shanTatii fii shanTatik ya raanya" , arabic = "شِنْطَتي في شَنْطتِك يا رانْيا" , meaning = "my bag is in your bag rania" } , { latin = "huunak maHfaDhA Saghiira" , arabic = "هُناك مَحْفَظة صَغيرة" , meaning = "There is a small wallet" } , { latin = "hunaak kitab jadiid" , arabic = "هَناك كِتاب جَديد" , meaning = "There is a new book" } , { latin = "hunaak kitaab Saghiir" , arabic = "هُناك كِتاب صَغير" , meaning = "There is a small book" } , { latin = "hunaak qubba3A fii shanTatak yaa bob" , arabic = "هُناك قُبَّعة في شَنْطَتَك يا بوب" , meaning = "There is a hat in your bag bob" } , { latin = "hunaak shanTa Saghiira" , arabic = "هُناك شَنْطة صَغيرة" , meaning = "There is a small bag"f } , { latin = "shanTatii hunaak" , arabic = "شَنْطَتي هُناك" , meaning = "my bag is over there" } , { latin = "hunaak kitaab Saghiir wawishaaH Kabiir fii ShanTatii" , arabic = "هُناك كِتاب صَغير وَوِشاح كَبير في شَنْطَتي" , meaning = "There is a small book and a big scarf in my bag" } , { latin = "hunaak maHfaTa Saghiir fii ShanTatii" , arabic = "هُناك مَحْفَظة صَغيرة في شَنْطَتي" , meaning = "There is a small wallet in my bag" } , { latin = "aljaami3a hunaak" , arabic = "اَلْجامِعة هُناك" , meaning = "The university is there" } , { latin = "hunaak kitaab" , arabic = "هُناك كِتاب" , meaning = "There is a book" } , { latin = "almadiina hunaak" , arabic = "اَلْمَدينة هُناك" , meaning = "Thecity is there" } , { latin = "hal 3indik shanTa ghaalya ya Riim" , arabic = "هَل عِندِك شَنْطة غالْية يا ريم" , meaning = "do you have an expensive bag Reem" } , { latin = "hal 3indik mashruub ya saamya" , arabic = "هَل عِنْدِك مَشْروب يا سامْية" , meaning = "do you have a drink samia" } , { latin = "hunaak daftar rakhiiS" , arabic = "هُناك دَفْتَر رَخيص" , meaning = "There is a cheep notebook" } , { latin = "laysa 3indii daftar" , arabic = "لَيْسَ عِنْدي دَفْتَر" , meaning = "I do not have a notebook" } , { latin = "laysa hunaak masharuub fii shanTatii" , arabic = "لَيْسَ هُناك مَشْروب في شَنْطَتي" , meaning = "There is no drink in my bag" } , { latin = "laysa hunaak kitaab qaSiir fii baytii" , arabic = "لَيْسَ هُناك كِتاب قَصير في بَيْتي" , meaning = "There is no short book in my house" } , { latin = "laysa hunaak daftar rakhiiS" , arabic = "لَيْسَ هُناك دَفْتَر رَخيص" , meaning = "There is no cheap notebook" } , { latin = "laysa 3indii sii dii" , arabic = "لَيْسَ عَنْدي سي دي" , meaning = "I do not have a CD" } , { latin = "laysa hunaak qalam fii shanTatii" , arabic = "لَيْسَ هُناك قَلَم في شَنْطَتي" , meaning = "There is no pen in my bag" } , { latin = "laysa hunaak kitaab qaSiir fii shanTatii" , arabic = "لَيْسَ هُناك كِتاب قَصير في شَنْطَتي" , meaning = "There is no short book in my bag" } , { latin = "laysa hunaak daftar 2abyaD" , arabic = "لَيْسَ هُناك دَفْتَر أَبْيَض" , meaning = "There is no white notebook." } , { latin = "maTbakh" , arabic = "مَطْبَخ" , meaning = "a kitchen" } , { latin = "3ilka" , arabic = "عِلْكة" , meaning = "gum" } , { latin = "miftaaH" , arabic = "مفْتاح" , meaning = "a key" } , { latin = "tuub" , arabic = "توب" , meaning = "top" } , { latin = "nuquud" , arabic = "نُقود" , meaning = "money" } , { latin = "aljazeera" , arabic = "الجزيرة" , meaning = "Al Jazeera" } , { latin = "kayfa" , arabic = "كَيْفَ" , meaning = "how" } , { latin = "kursii" , arabic = "كَرْسي" , meaning = "a chair" } , { latin = "sari3" , arabic = "سَريع" , meaning = "fast" } , { latin = "Haasuub" , arabic = "حاسوب" , meaning = "a computer" } , { latin = "maktab" , arabic = "مَكْتَب" , meaning = "office" } , { latin = "hadhaa maktab kabiir" , arabic = "هَذا مَِكْتَب كَبير" , meaning = "This is a big office" } , { latin = "kursii alqiTTa" , arabic = "كُرْسي الْقِطّة" , meaning = "the cat's chair" } , { latin = "Haasuub al2ustaadha" , arabic = "حاسوب اَلْأُسْتاذة" , meaning = "professor's computer" } , { latin = "kursii jadiid" , arabic = "كُرْسي جَديد" , meaning = "a new chair" } , { latin = "alHamdu lilh" , arabic = "اَلْحَمْدُ لِله" , meaning = "Praise be to God" } , { latin = "SaHiifa" , arabic = "صَحيفة" , meaning = "newspaper" } , { latin = "raqam" , arabic = "رَقَم" , meaning = "number" } , { latin = "haatif" , arabic = "هاتِف" , meaning = "phone" } , { latin = "2amriikiyy" , arabic = "أمْريكِي" , meaning = "American" } , { latin = "2amriikaa wa-as-siin" , arabic = "أَمْريكا وَالْصّين" , meaning = "America and China" } , { latin = "qahwa" , arabic = "قَهْوة" , meaning = "coffee" } , { latin = "Haliib" , arabic = "حَليب" , meaning = "milk" } , { latin = "muuza" , arabic = "موزة" , meaning = "a banana" } , { latin = "2akl" , arabic = "أَكْل" , meaning = "food" } , { latin = "2akl 3arabyy waqahwA 3arabyy" , arabic = "أَكْل عَرَبيّ وَقَهْوة عَرَبيّة" , meaning = "Arabic food and Arabic coffee" } , { latin = "ruzz" , arabic = "رُزّ" , meaning = "rice" } , { latin = "ruzzii waqahwatii" , arabic = "رُزّي وَقَهْوَتي" , meaning = "my rice and my coffee" } , { latin = "qahwatii fii shanTatii" , arabic = "قَهْوَتي في شَنْطَتي" , meaning = "My coffee is in my bag" } , { latin = "qahwaA siith" , arabic = "قَهْوَة سيث" , meaning = "Seth's coffee" } , { latin = "Sadiiqathaa" , arabic = "صَديقَتها" , meaning = "her friend" } , { latin = "jaarat-haa" , arabic = "جارَتها" , meaning = "her neighbor" } , { latin = "2a3rif" , arabic = "أَعْرِف" , meaning = "I know ..." } , { latin = "2ukhtii" , arabic = "أُخْتي" , meaning = "my sister" } , { latin = "Sadiiqa Jayyida" , arabic = "صَديقة جَيِّدة" , meaning = "a good friend" }أ , { latin = "2a3rif" , arabic = "أَعْرِف" , meaning = "I know" } , { latin = "2anaa 2a3rifhu" , arabic = "أَنا أَعْرِفه" , meaning = "I know him" } , { latin = "Taaawila Tawiila" , arabic = "طاوِلة طَويلة" , meaning = "long table" } , { latin = "baytik wabaythaa" , arabic = "بَيْتِك وَبَيْتها" , meaning = "your house and her house" } , { latin = "ism Tawiil" , arabic = "اِسْم طَويل" , meaning = "long name" } , { latin = "baytii wabaythaa" , arabic = "بَيْتي وَبَيْتها" , meaning = "my house and her house" } , { latin = "laysa hunaak lugha Sa3ba" , arabic = "لَيْسَ هُناك لُغة صَعْبة" , meaning = "There is no diffcult language." } , { latin = "hadhaa shay2 Sa3b" , arabic = "هَذا شَيْء صَعْب" , meaning = "This is a difficult thing." } , { latin = "ismhu taamir" , arabic = "اِسْمهُ تامِر" , meaning = "His name is Tamer." } , { latin = "laa 2a3rif 2ayn bayt-hu" , arabic = "لا أَعْرِف أَيْن بَيْته" , meaning = "I don't know where his house is" } , { latin = "laa 2a3rif 2ayn 2anaa" , arabic = "لا أعرف أين أنا." , meaning = "I don't know where I am." } , { latin = "baythu qariib min aljaami3at" , arabic = "بيته قريب من الجامعة" , meaning = "His house is close to the university" } , { latin = "ismhaa arabyy" , arabic = "إسمها عربي" , meaning = "Her name is arabic." } , { latin = "Sadiiqathu ruuzaa qariibhu min baythu" , arabic = "صديقته روزا قريبه من بيته" , meaning = "His friend Rosa is close to his house." } , { latin = "ismhu Tawiil" , arabic = "إسمه طويل" , meaning = "His name is long." } , { latin = "riim Sadiiqat Sa3bat" , arabic = "ريم صديقة صعبة" , meaning = "Reem is a difficult friend." } , { latin = "ismhu bashiir" , arabic = "إسمه بشير" , meaning = "HIs name is Bashir." } , { latin = "ismhaa Tawiil" , arabic = "إسمها طويل" , meaning = "Her name is long." } , { latin = "Sadiiqhaa buub qariib min baythaa" , arabic = "صديقها بوب قريب من بيتها" , meaning = "Her friend Bob is close to her house." } , { latin = "ismhu bob" , arabic = "إسمه بوب" , meaning = "His name is Bob." } , { latin = "baythu qariib min baythaa" , arabic = "بيته قريب من بيتها" , meaning = "His house is close to her house." } , { latin = "hadhaa shay2 Sa3b" , arabic = "هذا شيء صعب" , meaning = "This is a difficult thing." } , { latin = "3alaaqa" , arabic = "عَلاقَة" , meaning = "relationship" } , { latin = "alqiTTa" , arabic = "اَلْقِطّة" , meaning = "the cat" } , { latin = "la 2uhib" , arabic = "لا أُحِب" , meaning = "I do not like" } , { latin = "al2akl mumti3" , arabic = "اَلْأَكْل مُمْتع" , meaning = "Eating is fun." } , { latin = "alqiraa2a" , arabic = "اَلْقِراءة" , meaning = "reading" } , { latin = "alkitaaba" , arabic = "الْكِتابة" , meaning = "writing" } , { latin = "alkiraa2a wa-alkitaaba" , arabic = "اَلْقِراءة وَالْكِتابة" , meaning = "reading and writing" } , { latin = "muhimm" , arabic = "مُهِمّ" , meaning = "important" } , { latin = "alkiaaba shay2 muhimm" , arabic = "اَلْكِتابة شَيْء مُهِمّ" , meaning = "Writing is an important thing." } , { latin = "aljara wa-alqiTTa" , arabic = "اَلْجارة وَالْقِطّة" , meaning = "the neighbor and the cat" } , { latin = "qiTTa wa-alqiTTa" , arabic = "قِطّة وَالْقِطّة" , meaning = "a cat and the cat" } , { latin = "2ayDaan" , arabic = "أَيْضاً" , meaning = "also" } , { latin = "almaT3m" , arabic = "الْمَطْعْم" , meaning = "the restaurant" } , { latin = "aljarii" , arabic = "اَلْجَري" , meaning = "the running" } , { latin = "maa2" , arabic = "ماء" , meaning = "water" } , { latin = "maT3am" , arabic = "مَطْعَم" , meaning = "a restaurant" } , { latin = "alttaSwiir" , arabic = "اَلْتَّصْوير" , meaning = "photography" } , { latin = "alnnawm" , arabic = "اَلْنَّوْم" , meaning = "sleeping" } , { latin = "as-sibaaha" , arabic = "اَلْسِّباحة" , meaning = "swimming" } , { latin = "Sabaahaan 2uhibb al2akl hunaa" , arabic = "صَباحاً أُحِبّ اَلْأَكْل هُنا" , meaning = "Inn the morning, I like eating here." } , { latin = "kathiiraan" , arabic = "كَثيراً" , meaning = "much" } , { latin = "hunaa" , arabic = "هُنا" , meaning = "here" } , { latin = "jiddan" , arabic = "جِدَّاً" , meaning = "very" } , { latin = "3an" , arabic = "عَن" , meaning = "about" } , { latin = "2uhibb al-ssafar 2ilaa 2iiiTaaliiaa" , arabic = "أُحِبّ اَلْسَّفَر إِلى إيطالْيا" , meaning = "I like traveling to Italy." } , { latin = "alkalaam ma3a 2abii" , arabic = "اَلْكَلام مَعَ أَبي" , meaning = "talking with my father" } , { latin = "alkalaam ma3a 2abii ba3d alDHDHahr" , arabic = "اَلْكَلام معَ أَبي بَعْد اَلْظَّهْر" , meaning = "talking with my father in the afternoon" } , { latin = "2uhibb alssafar 2ilaa 2almaaniiaa" , arabic = "أُحِب اَلْسَّفَر إِلى أَلْمانيا" , meaning = "I like travelling to Germany" } , { latin = "2uHibb aljarii bialllyl" , arabic = "أُحِبّ اَلْجَري بِالْلَّيْل" , meaning = "I like running at night." } , { latin = "2uriidu" , arabic = "أُريدُ" , meaning = "I want" } , { latin = "2uHibb 2iiiTaaliiaa 2ayDan" , arabic = "أُحِبّ إيطاليا أَيْضاً" , meaning = "I like Italy also." } , { latin = "2uHibb alnnawm ba3d alDHDHhr" , arabic = "أحِبّ اَلْنَّوْم بَعْد اَلْظَّهْر" , meaning = "I like sleeping in the afternoon." } , { latin = "2uHibb alqiraa2a 3an kuubaa biaalllayl" , arabic = "أُحِبّ اَلْقِراءة عَن كوبا بِالْلَّيْل" , meaning = "I like to read about Cuba at night." } , { latin = "2uHibb alkalaam 3an alkitaaba" , arabic = "أحِبّ اَلْكَلام عَن اَلْكِتابة" , meaning = "I like talking about writing." } , { latin = "alqur2aan" , arabic = "اَلْقُرْآن" , meaning = "Koran" } , { latin = "bayt jamiil" , arabic = "بَيْت جَميل" , meaning = "a pretty house" } , { latin = "bint suuriyya" , arabic = "بِنْت سورِيّة" , meaning = "a Syrian girl" } , { latin = "mutarjim mumtaaz" , arabic = "مُتَرْجِم مُمْتاز" , meaning = "an amazing translator" } , { latin = "jaami3a mashhuura" , arabic = "جامِعة مَشْهورة" , meaning = "a famous university" } , { latin = "al-bayt al-jamiil" , arabic = "اَلْبَيْت اَلْجَميل" , meaning = "the pretty house" } , { latin = "al-bint al-ssuuriyya" , arabic = "اَلْبِنْت اَلْسّورِيّة" , meaning = "a Syrian girl" } , { latin = "al-mutarjim al-mumtaaz" , arabic = "اَلْمُتَرْجِم اَلْمُمْتاز" , meaning = "the amazing translator" } , { latin = "al-jaami3a al-mashhuura" , arabic = "اَلْجامِعة اَلْمَشْهورة" , meaning = "the famous university" } , { latin = "al-bayt jamiil" , arabic = "اَلْبَيْت جَميل" , meaning = "The house is pretty." } , { latin = "al-bint suuriyya" , arabic = "البنت سورِيّة" , meaning = "The girl is Syrian." } , { latin = "al-mutarjim mumtaaz" , arabic = "اَلْمُتَرْجِم مُمْتاز" , meaning = "The translator is amazing." } , { latin = "al-jaami3a mashhuura" , arabic = "اَلْجامِعة مَشْهورة" , meaning = "" } , { latin = "Haarr" , arabic = "حارّ" , meaning = "hot" } , { latin = "maTar" , arabic = "مَطَر" , meaning = "rain" } , { latin = "yawm Tawiil" , arabic = "يَوْم طَويل" , meaning = "a long day" } , { latin = "Taqs baarid" , arabic = "طَقْس بارِد" , meaning = "cold weather" } , { latin = "haathaa yawm Tawiil" , arabic = "هَذا يَوْم طَويل" , meaning = "This is a long day." } , { latin = "shanTa fafiifa" , arabic = "شَنْطة خَفيفة" , meaning = "a light bag" } , { latin = "mi3Taf khafiif" , arabic = "مِعْطَف خَفيف" , meaning = "a light coat" } , { latin = "al-maTar al-ththaqiil mumtaaz" , arabic = "اَلْمَطَر اَلْثَّقيل مُمْتاز" , meaning = "The heavy rain is amazing." } , { latin = "Taqs ghariib" , arabic = "طَقْس غَريب" , meaning = "a weird weather" } , { latin = "yawm Haarr" , arabic = "يَوْم حارّ" , meaning = "a hot day" } , { latin = "maTar khafiif" , arabic = "مَطَر خفيف" , meaning = "a light rain" } , { latin = "Taawila khafiifa" , arabic = "طاوِلة خَفيفة" , meaning = "a light table" } , { latin = "Taqs jamiil" , arabic = "طَقْس جَميل" , meaning = "a pretty weather" } , { latin = "al-maTar al-ththaqiil mumtaaz" , arabic = "اَلْمَطَر اَلْثَّقيل مُمْتاز" , meaning = "The heavy rain is amazing." } , { latin = "haathaa yawm Haarr" , arabic = "هَذا يَوْم حارّ" , meaning = "This is a hot day." } , { latin = "shanTa khafiifa" , arabic = "شَنْطة خَفيفة" , meaning = "a light bag" } , { latin = "hunaak maTar baarid jiddan" , arabic = "هُناك مَطَر بارِد جِدّاً" , meaning = "There is a very cold rain." } , { latin = "Sayf" , arabic = "صّيْف" , meaning = "summer" } , { latin = "shitaa2" , arabic = "شِتاء" , meaning = "winter" } , { latin = "thitaa2 baarid" , arabic = "شِتاء بارِد" , meaning = "cold winter" } , { latin = "binaaya 3aalya" , arabic = "بِناية عالْية" , meaning = "a high building" } , { latin = "yawm baarid" , arabic = "يَوْم بارِد" , meaning = "a cold day" } , { latin = "alyawm yawm baarid" , arabic = "اَلْيَوْم يَوْم بارِد" , meaning = "Today is a cold day." } , { latin = "ruTwwba 3aalya" , arabic = "رُطوبة عالْية" , meaning = "high humidity" } , { latin = "al-rruTuuba al-3aalya" , arabic = "اَلْرَّطوبة الْعالْية" , meaning = "the high humidity" } , { latin = "Sayf mumTir" , arabic = "صَيْف مُمْطِر" , meaning = "a rainy summer" } , { latin = "al-rruTuuba al3aalya" , arabic = "اَلْرُّطوبة الْعالْية" , meaning = "the high humidity" } , { latin = "al-TTaqs al-mushmis" , arabic = "اّلْطَّقْس الّْمُشْمِس" , meaning = "the sunny weather" } , { latin = "shitaa2 mumTir" , arabic = "شِتاء مُمْطِر" , meaning = "a rainy winter" } , { latin = "Sayf Haarr" , arabic = "صَيْف حارّ" , meaning = "a hot summer" } , { latin = "al-yawm yawm Tawiil" , arabic = "اَلْيَوْم يَوْم طَويل" , meaning = "Today is a long day." } , { latin = "laa 2uhibb al-Taqs al-mushmis" , arabic = "لا أُحِبّ اَلْطَقْس اَلْمُشْمِس" , meaning = "I do not like sunny weather." } , { latin = "al-Taqs mumTir jiddan al-yawm" , arabic = "اَلْطَقْس مُمْطِر جِدّاً اَلْيَوْم" , meaning = "The weather is very rainy today." } , { latin = "laa 2uhibb al-TTaqs al-mumTir" , arabic = "لا أحِبّ اَلْطَّقْس اَلْمُمْطِر" , meaning = "I do not like the rainy weather." } , { latin = "al-TTaqs mushmis al-yawm" , arabic = "اَلْطَّقْس مُشْمِس اَلْيَوْم" , meaning = "The weather is sunny today." } , { latin = "khariif" , arabic = "خَريف" , meaning = "fall, autumn" } , { latin = "qamar" , arabic = "قَمَر" , meaning = "moon" } , { latin = "rabiir" , arabic = "رَبيع" , meaning = "spring" } , { latin = "al-shishitaa2 mumTir" , arabic = "اَلْشِّتاء مُمْطِر" , meaning = "The winter is rainy." } , { latin = "al-SSayf al-baarid" , arabic = "اَلْصَّيْف اَلْبارِد" , meaning = "the cold summer" } , { latin = "al-qamar al-2abyab" , arabic = "اَلْقَمَر اَلْأَبْيَض" , meaning = "the white moon" } , { latin = "al-shishitaa2 Tawiil wa-baarid" , arabic = "اَلْشِّتاء طَويل وَبارِد" , meaning = "The winter is long and cold." } , { latin = "al-rrabii3 mumTir al-aan" , arabic = "اَلْرَّبيع مُمْطِر اَلآن" , meaning = "The winter is rainy now" } , { latin = "Saghiir" , arabic = "صَغير" , meaning = "small" } , { latin = "kashiiran" , arabic = "كَثيراً" , meaning = "a lot, much" } , { latin = "al-ssuudaan" , arabic = "اَلْسّودان" , meaning = "Sudan" } , { latin = "as-siin" , arabic = "اَلْصّين" , meaning = "China" } , { latin = "al-qaahira" , arabic = "اَلْقاهِرة" , meaning = "Cairo" } , { latin = "al-bunduqiyya" , arabic = "اَلْبُنْدُقِية" , meaning = "Venice" } , { latin = "filasTiin" , arabic = "فِلَسْطين" , meaning = "Palestine" } , { latin = "huulandaa" , arabic = "هولَنْدا" , meaning = "Netherlands" } , { latin = "baghdaad" , arabic = "بَغْداد" , meaning = "Bagdad" } , { latin = "Tuukyuu" , arabic = "طوكْيو" , meaning = "Tokyo" } , { latin = "al-yaman" , arabic = "اَلْيَمَن" , meaning = "Yemen" } , { latin = "SaaHil Tawiil" , arabic = "ساحَل طَويل" , meaning = "a long coast" } , { latin = "al-2urdun" , arabic = "اَلْأُرْدُن" , meaning = "Jordan" } , { latin = "haathaa al-balad" , arabic = "هَذا الْبَلَد" , meaning = "this country" } , { latin = "2ayn baladik yaa riim" , arabic = "أَيْن بَلَدِك يا ريم" , meaning = "Where is your country, Reem?" } , { latin = "baldii mumtaaz" , arabic = "بَلَدي مُمْتاز" , meaning = "My country is amazing." } , { latin = "haathaa balad-haa" , arabic = "هَذا بَلَدها" , meaning = "This is her country." } , { latin = "hal baladak jamiil yaa juurj?" , arabic = "هَل بَلَدَك جَميل يا جورْج" , meaning = "Is your country pretty, George" } , { latin = "al-yaman balad Saghiir" , arabic = "اَلْيَمَن بَلَد صَغير" , meaning = "Yemen is a small country." } , { latin = "qaari2" , arabic = "قارِئ" , meaning = "reader" } , { latin = "ghaa2ib" , arabic = "غائِب" , meaning = "absent" } , { latin = "mas2uul" , arabic = "مَسْؤول" , meaning = "responsoble, administrator" } , { latin = "jaa2at" , arabic = "جاءَت" , meaning = "she came" } , { latin = "3indii" , arabic = "عِنْدي" , meaning = "I have" } , { latin = "3indik" , arabic = "عِنْدِك" , meaning = "you have" } , { latin = "ladii kitaab" , arabic = "لَدي كِتاب" , meaning = "I have a book." } , { latin = "3indhaa" , arabic = "عِنْدها" , meaning = "she has" } , { latin = "3indhu" , arabic = "عِنْدهُ" , meaning = "he has" } , { latin = "laysa 3indhu" , arabic = "لَيْسَ عِنْدهُ" , meaning = "he does not have" } , { latin = "laysa 3indhaa" , arabic = "لَيْسَ عِنْدها" , meaning = "she does not have" } , { latin = "hunaak maTar thaqiil" , arabic = "هُناك مَطَر ثَقيل" , meaning = "There is a heavy rain." } , { latin = "hunaak wishaaH fii shanTatii" , arabic = "هُناك وِشاح في شَنْطتي" , meaning = "There is a scarf in my bag." } , { latin = "laysa hunaak lugha Sa3ba" , arabic = "لَيْسَ هُناك لُغة صَعْبة" , meaning = "There is no difficult language." } , { latin = "2amaamii rajul ghariib" , arabic = "أَمامي رَجُل غَريب" , meaning = "There is a weird man in front of me." } , { latin = "fii al-khalfiyya bayt" , arabic = "في الْخَلفِيْة بَيْت" , meaning = "There is a house in the background." } , { latin = "fii shanTatii wishaaH" , arabic = "في شَنْطَتي وِشاح" , meaning = "There is a scarf in my bag." } , { latin = "asad" , arabic = "أَسَد" , meaning = "a lion" } , { latin = "2uHibb 2asadii laakibb la 2uHibb 2usadhaa" , arabic = "أحِبَ أَسَدي لَكِنّ لا أُحِبّ أَسَدها" , meaning = "I like my lion but I do not like her lion." } , { latin = "laysa 3indhu" , arabic = "لَيْسَ عِنْدهُ" , meaning = "he does not have" } , { latin = "3indhaa kalb wa-qiTTa" , arabic = "عِنْدها كَلْب وَقِطّة" , meaning = "She has a doc and a cat." } , { latin = "Sadiiqatu" , arabic = "صَديقَتهُ سامْية غَنِيّة" , meaning = "His friend Samia is rich." } , { latin = "taariikhiyya" , arabic = "تاريخِيّة" , meaning = "historical" } , { latin = "juurj 3indhu 3amal mumtaaz" , arabic = "جورْج عِنْدهُ عَمَل مُمْتاز" , meaning = "George has an amazing work." } , { latin = "Sadiiqii taamir ghaniyy jiddan" , arabic = "صَديقي تامِر غَنِيّ جِدّاً" , meaning = "My friend Tamer is very rich" } , { latin = "laa 2a3rif haadhaa l-2asad" , arabic = "لا أَعْرِف هَذا الْأَسّد" , meaning = "I do not know this lion." } , { latin = "laysa 3indhu mi3Taf" , arabic = "لَيْسَ عِنْدهُ مِعْطَف" , meaning = "He does not have a coat." } , { latin = "fii l-khalfiyya zawjatak ya siith" , arabic = "في الْخَلْفِيّة زَوْجَتَك يا سيث" , meaning = "There is your wife in background, Seth" } , { latin = "su2uaal" , arabic = "سُؤال" , meaning = "a question" } , { latin = "Sadiiqat-hu saamya laabisa tannuura" , arabic = "صدَيقَتهُ سامْية لابِسة تّنّورة" , meaning = "His friend Samia is wering a skirt." } , { latin = "wa-hunaa fii l-khalfitta rajul muDHik" , arabic = "وَهُنا في الْخَلْفِتّة رَجُل مُضْحِك" , meaning = "And here in the background there is a funny man." } , { latin = "man haadhaa" , arabic = "مَن هَذا" , meaning = "Who is this?" } , { latin = "hal 2anti labisa wishaaH ya lamaa" , arabic = "هَل أَنْتِ لابِسة وِشاح يا لَمى" , meaning = "Are you wering a scarf, Lama?" } , { latin = "2akhii bashiir mashghuul" , arabic = "أَخي بَشير مَشْغول" , meaning = "My brother Bashir is busy." } , { latin = "fii haadhihi l-s-Suura imraa muDHika" , arabic = "في هَذِهِ الْصّورة اِمْرأة مُضْحِكة" , meaning = "Thre is a funny woman in this picture." } , { latin = "hal 2anta laabis qubb3a ya siith" , arabic = "هَل أَنْتَ لابِس قُبَّعة يا سيث" , meaning = "Are you wearing a hat, Seth?" } , { latin = "fii l-khalfiyya rajul muDHik" , arabic = "في الْخَلْفِيّة رَجُل مُضْحِك" , meaning = "There is a funny man in the background." } , { latin = "shubbaak" , arabic = "شُبّاك" , meaning = "a window" } , { latin = "sariir" , arabic = "سَرير" , meaning = "a bed" } , { latin = "muHammad 2ustaadhii" , arabic = "مُحَمَّد أُسْتاذي" , meaning = "Muhammed is my teacher." } , { latin = "saadii 2ustaadhii" , arabic = "شادي أُسْتاذي" , meaning = "Sadie is my teacher." } , { latin = "2ummhu" , arabic = "أُمّهُ" , meaning = "his mother" } , { latin = "tilfaaz" , arabic = "تِلْفاز" , meaning = "a television" } , { latin = "ma haadhaa as-sawt" , arabic = "ما هَذا الْصَّوْت" , meaning = "What is this noise" } , { latin = "2adkhul al-Hammaam" , arabic = "أَدْخُل اَلْحَمّام" , meaning = "I enter the bathroom." } , { latin = "2uHibb al-ssariir al-kabiir" , arabic = "أُحِبّ اَلْسَّرير اَلْكَبير" , meaning = "I love the big bed." } , { latin = "hunaak mushkila ma3 lt-tilfaaz" , arabic = "هُناك مُشْكِلة مَعَ الْتِّلْفاز" , meaning = "There is a problem with the television." } , { latin = "al-haatif mu3aTTal wa-lt-tilfaaz 2ayDan" , arabic = "اَلْهاتِف مُعَطَّل وَالْتَّلْفاز أَيضاً" , meaning = "The telephone is out of order and the television also." } , { latin = "hunaak Sawt ghariib fii l-maTbakh" , arabic = "هُناك صَوْت غَريب في الْمَطْبَخ" , meaning = "There is a weird nose in the kitchen." } , { latin = "2anaam fii l-ghurfa" , arabic = "أَنام في الْغُرْفة" , meaning = "I sleep in the room." } , { latin = "tilfaaz Saghiir fii Saaluun kabiir" , arabic = "تِلْفاز صَغير في صالون كَبير" , meaning = "a small television in a big living room" } , { latin = "2anaam fii sariir maksuur" , arabic = "أَنام في سَرير مَكْسور" , meaning = "I sleep in a broken bed." } , { latin = "as-sariir al-kabiir" , arabic = "اَلْسَّرير اَلْكَبير" , meaning = "the big bed" } , { latin = "maa haadhaa aSSwut" , arabic = "ما هَذا الصّوُت" , meaning = "What is this noise?" } , { latin = "sariirii mumtaaz al-Hamdu lila" , arabic = "سَريري مُمتاز اَلْحَمْدُ لِله" , meaning = "My bed is amazing, praise be to God" } , { latin = "2anaam kathiiran" , arabic = "أَنام كَشيراً" , meaning = "I sleep a lot" } , { latin = "hunaak Sawt ghariib" , arabic = "هُناك صَوْت غَريب" , meaning = "There is a weird noise." } , { latin = "shubbaak" , arabic = "شُبّاك" , meaning = "a window" } , { latin = "2anaam fii sariir Saghiir" , arabic = "أَنام في سَرير صَغير" , meaning = "I sleep in a small bed." } , { latin = "muHammad 2ustaadhii" , arabic = "مُحَمَّد أُسْتاذي" , meaning = "Muhammad is my teacher." } , { latin = "mahaa 2ummhu" , arabic = "مَها أُمّهُ" , meaning = "Maha is his mother." } , { latin = "fii haadhaa lsh-shaari3 Sawt ghariib" , arabic = "في هٰذا ٱلْشّارِع صَوْت غَريب" , meaning = "There is a weird nose on this street" } , { latin = "2askun fii ls-saaluun" , arabic = "أَسْكُن في الْصّالون" , meaning = "I live in the living room." } , { latin = "haadhaa lsh-shaar3" , arabic = "هَذا الْشّارِع" , meaning = "this street" } , { latin = "fii lT-Taabiq al-2awwal" , arabic = "في الْطّابِق اَلْأَوَّل" , meaning = "on the first floor" } , { latin = "Hammaam" , arabic = "حَمّام" , meaning = "bathroom" } , { latin = "alsh-shaanii" , arabic = "اَلْثّاني" , meaning = "the second" } , { latin = "3and-hu ghurfa nawm Saghiira" , arabic = "عِندهُ غُرْفة نَوْم صَغيرة" , meaning = "He has a small bedroom." } , { latin = "laa 2aftaH albaab bisabab lT-Taqs" , arabic = "لا أَفْتَح اَلْباب بِسَبَب اّلْطَّقْس" , meaning = "I do not open the door because of the weather." } , { latin = "Sifr" , arabic = "صِفْر" , meaning = "zero" } , { latin = "3ashara" , arabic = "عَشَرَة" , meaning = "ten" } , { latin = "waaHid" , arabic = "وَاحِد" , meaning = "one" } , { latin = "2ithnaan" , arabic = "اِثْنان" , meaning = "two" } , { latin = "kayf ta3uddiin min waaHid 2ilaa sitta" , arabic = "كَيْف تَعُدّين مِن ١ إِلى ٦" , meaning = "How do you count from one to six?" } , { latin = "bil-lugha" , arabic = "بِالْلُّغة" , meaning = "in language" } , { latin = "bil-lugha l-3arabiya" , arabic = "بِالْلُّغة الْعَرَبِيّة" , meaning = "in the arabic language" } , { latin = "ta3rifiin" , arabic = "تَعْرِفين" , meaning = "you know" } , { latin = "hal ta3rifiin kull shay2 yaa mahaa" , arabic = "هَل تَعْرِفين كُلّ شَيء يا مَها" , meaning = "Do you know everything Maha?" } , { latin = "kayf ta3udd yaa 3umar" , arabic = "كَيْف تَعُدّ يا عُمَر" , meaning = "How do you count Omar?" } , { latin = "Kayf ta3udd min Sifr 2ilaa 2ashara yaa muHammad" , arabic = "كَيْف تَعُدّ مِن٠ إِلى ١٠ يا مُحَمَّد" , meaning = "How do you count from 0 to 10 , Mohammed?" } , { latin = "hal ta3rif yaa siith" , arabic = "هَل تَعْرِف يا سيث" , meaning = "Do you know Seth?" } , { latin = "bayt buub" , arabic = "بَيْت بوب" , meaning = "Bob's house" } , { latin = "maT3am muHammad" , arabic = "مَطْعَم مُحَمَّد" , meaning = "Mohammed's restaurant" } , { latin = "SaHiifat al-muhandis" , arabic = "صَحيفة اَلْمُهَنْدِس" , meaning = "the enginner's newspaper" } , { latin = "madiinat diitruuyt" , arabic = "مَدينة ديتْرويْت" , meaning = "the city of Detroit" } , { latin = "wilaayat taksaas" , arabic = "وِلاية تَكْساس" , meaning = "the state of Texas" } , { latin = "jaami3at juurj waashinTun" , arabic = "جامِعة جورْج واشِنْطُن" , meaning = "George Washinton University" } , { latin = "shukuran" , arabic = "شُكْراً" , meaning = "thank you" } , { latin = "SabaaHan" , arabic = "صَباحاً" , meaning = "in the morning" } , { latin = "masaa-an" , arabic = "مَساءً" , meaning = "in the evening" } , { latin = "wayaatak" , arabic = "وِلايَتَك" , meaning = "your state" } , { latin = "madiina saaHiliyya" , arabic = "مَدينة ساحِلِيّة" , meaning = "a coastal city" } , { latin = "muzdaHima" , arabic = "مُزْدَحِمة" , meaning = "crowded" } , { latin = "wilaaya kaaliifuurniyaa" , arabic = "وِلاية كاليفورْنْيا" , meaning = "the state of California" } , { latin = "luus 2anjiaalis" , arabic = "لوس أَنْجِلِس" , meaning = "Los Angeles" } , { latin = "baHr" , arabic = "بَحْر" , meaning = "sea" } , { latin = "al-baHr al-2abyaD al-mutawassaT" , arabic = "اَاْبَحْر اَلْأَبْيَض اَلْمُتَوَسِّط" , meaning = "the Meditteranean Sea" } , { latin = "lil2asaf" , arabic = "لٍلْأَسَف" , meaning = "unfortunately" } , { latin = "DawaaHii" , arabic = "ضَواحي" , meaning = "suburbs" } , { latin = "taskuniin" , arabic = "تَسْكُنين" , meaning = "you live" } , { latin = "nyuuyuurk" , arabic = "نْيويورْك" , meaning = "New York" } , { latin = "qaryatik" , arabic = "قَرْيَتِك" , meaning = "your village" } , { latin = "shubbaak" , arabic = "شُبّاك" , meaning = "a window" } , { latin = "jaziira" , arabic = "جَزيرة" , meaning = "an island" } , { latin = "Tabii3a" , arabic = "طَبيعة" , meaning = "nature" } , { latin = "al-2iskandariyya" , arabic = "اَلْإِسْكَندَرِيّة" , meaning = "Alexandria" } , { latin = "miSr" , arabic = "مِصْر" , meaning = "Egypt" } , { latin = "na3am" , arabic = "نَعَم" , meaning = "yes" } , { latin = "SabaaH l-khayr" , arabic = "صَباح اَلْخَيْر" , meaning = "Good morning." } , { latin = "SabaaH an-nuur" , arabic = "صَباح اَلْنّور" , meaning = "Good morning." } , { latin = "masaa2 al-khayr" , arabic = "مَساء اَلْخَيْر" , meaning = "Good evening" } , { latin = "masaa2 an-nuur" , arabic = "مَساء اَلْنّور" , meaning = "Good evening." } , { latin = "as-salaamu 3alaykum" , arabic = "اَلْسَّلامُ عَلَيْكُم" , meaning = "Peace be upon you." } , { latin = "wa-3alaykumu as-salaam" , arabic = "وَعَلَيْكُمُ ٲلْسَّلام" , meaning = "" } , { latin = "tasharrafnaa" , arabic = "تَشَرَّفْنا" , meaning = "It's a pleasure to meet you." } , { latin = "hal 2anta bikhyr" , arabic = "هَل أَنْتَ بِخَيْر" , meaning = "Are you well?" } , { latin = "kayfak" , arabic = "كَيْفَك" , meaning = "How are you?" } , { latin = "al-yawm" , arabic = "اَلْيَوْم" , meaning = "today" } , { latin = "kayfik al-yawm" , arabic = "كَيْفِك اَلْيَوْم" , meaning = "How are you today?" } , { latin = "marHaban ismii buub" , arabic = "مَرْحَباً اِسْمي بوب" , meaning = "Hello, my name is Bob." } , { latin = "Haziin" , arabic = "حَزين" , meaning = "sad" } , { latin = "mariiD" , arabic = "مَريض" , meaning = "sick" } , { latin = "yawm sa3iid" , arabic = "يَوْم سَعيد" , meaning = "Have a nice day." } , { latin = "sa3iid" , arabic = "سَعيد" , meaning = "happy" } , { latin = "2anaa Haziinat l-yawm" , arabic = "أَنا حَزينة الْيَوْم" , meaning = "I am sad today." } , { latin = "2anaa Haziin jiddan" , arabic = "أَنا حَزين جِدّاً" , meaning = "I am very sad." } , { latin = "2anaa mariiDa lil2asaf" , arabic = "أَنا مَريضة لِلْأَسَف" , meaning = "I am sick unfortunately." } , { latin = "2ilaa l-laqaa2 yaa Sadiiqii" , arabic = "إِلى الْلِّقاء يا صَديقي" , meaning = "Until next time, my friend." } , { latin = "na3saana" , arabic = "نَعْسانة" , meaning = "sleepy" } , { latin = "mutaHammis" , arabic = "مُتَحَمِّس" , meaning = "excited" } , { latin = "maa 2ismak" , arabic = "ما إِسْمَك" , meaning = "What is your name?" } , { latin = "2ana na3saan" , arabic = "أَنا نَعْسان" , meaning = "I am sleepy." } , { latin = "yallaa 2ilaa l-liqaa2" , arabic = "يَلّإِ إِلى الْلَّقاء" , meaning = "Alriht, until next time." } , { latin = "ma3a as-alaama" , arabic = "مَعَ الْسَّلامة" , meaning = "Goodbye." } , { latin = "tamaam" , arabic = "تَمام" , meaning = "OK" } , { latin = "2ana tamaam al-Hamdu lillah" , arabic = "أَنا تَمام اَلْحَمْدُ لِله" , meaning = "I am OK , praise be to God." } , { latin = "maa al2akhbaar" , arabic = "ما الْأَخْبار" , meaning = "What is new?" } , { latin = "al-bathu alhii" , arabic = "اَلْبَثُ اَلْحي" , meaning = "live broadcast" } , { latin = "2ikhtar" , arabic = "إِخْتَر" , meaning = "choose" } , { latin = "sayyaara" , arabic = "سَيّارة" , meaning = "a car" } , { latin = "2ahlan wa-sahlan" , arabic = "أَهْلاً وَسَهْلاً" , meaning = "welcom" } , { latin = "2akh ghariib" , arabic = "أَخ غَريب" , meaning = "a weird brother" } , { latin = "2ukht muhimma" , arabic = "أُخْت مُهِمّة" , meaning = "an important sister" } , { latin = "ibn kariim wa-mumtaaz" , arabic = "اِبْن كَريم وَمُمْتاز" , meaning = "a generous and amazing son" } , { latin = "2ab" , arabic = "أَب" , meaning = "a father" } , { latin = "2umm" , arabic = "أُمّ" , meaning = "a mother" } , { latin = "abn" , arabic = "اِبْن" , meaning = "a son" } , { latin = "mumti3" , arabic = "مُمْتِع" , meaning = "fun" } , { latin = "muHaasib" , arabic = "مُحاسِب" , meaning = "an accountant" } , { latin = "ma-smika ya 2ustaadha" , arabic = "ما اسْمِك يا أُسْتاذة" , meaning = "Whatis your name ma'am?" } , { latin = "qiTTatak malika" , arabic = "قِطَّتَك مَلِكة" , meaning = "Your cat is a queen." } , { latin = "jadda laTiifa wa-jadd laTiif" , arabic = "جَدّة لَطيفة وَجَدّ لَطيف" , meaning = "a kind grandmother and a kind grandfather" } , { latin = "qiTTa jadiida" , arabic = "قِطّة جَديدة" , meaning = "a new cat" } , { latin = "hal jaddatak 2ustaadha" , arabic = "هَل جَدَّتَك أُسْتاذة" , meaning = "Is your grandmother a professor?" } , { latin = "hal zawjatak 2urduniyya" , arabic = "هَل زَوْجَتَك أُرْدُنِتّة" , meaning = "Is your wife a Jordanian?" } , { latin = "mu3allim" , arabic = "مُعَلِّم" , meaning = "a teacher" } , { latin = "dhakiyya" , arabic = "ذَكِيّة" , meaning = "smart" } , { latin = "jaaratii" , arabic = "جارَتي" , meaning = "my neighbor" } , { latin = "ma3Taf" , arabic = "مَعْطَف" , meaning = "a coat" } , { latin = "qubba3a zarqaa2 wa-bunniyya" , arabic = "قُبَّعة زَرْقاء وَبُنّية" , meaning = "a blue ad brown hat" } , { latin = "bayDaa2" , arabic = "بَيْضاء" , meaning = "white" } , { latin = "al-2iijaar jayyd al-Hamdu lila" , arabic = "اَلْإِيجار جَيِّد اَلْحَمْدُ لِله" , meaning = "The rent is good, praise be to God." } , { latin = "jaami3a ghaalya" , arabic = "جامِعة غالْية" , meaning = "an expensive university" } , { latin = "haadhaa Saaluun qadiim" , arabic = "هَذا صالون قَديم" , meaning = "This is an old living room." } , { latin = "haadhihi Hadiiqa 3arabiyya" , arabic = "هَذِهِ حَديقة عَرَبِيّة" , meaning = "" } , { latin = "al-HaaiT" , arabic = "اَلْحائِط" , meaning = "the wall" } , { latin = "hunaak shanTa Saghiira" , arabic = "هُناك شَنطة صَغيرة" , meaning = "There is a small bag." } , { latin = "2abii hunaak" , arabic = "أَبي هُناك" , meaning = "My father is there." } , { latin = "haatifak hunaak yaa buub" , arabic = "هاتِفَك هُناك يا بوب" , meaning = "Your telephone is there, Bob." } , { latin = "haatifii hunaak" , arabic = "هاتِفي هُناك" , meaning = "My telephone is there." } , { latin = "hunaak 3ilka wa-laab tuub fii shanTatik" , arabic = "هُناك عِلكة وَلاب توب في شَنطَتِك" , meaning = "There is a chewing gum and a laptop in your bag." } , { latin = "raSaaS" , arabic = "رَصاص" , meaning = "lead" } , { latin = "qalam raSaaS" , arabic = "قَلَم رَصاص" , meaning = "a pencil" } , { latin = "mu2al-lif" , arabic = "مُؤَلِّف" , meaning = "an author" } , { latin = "shaahid al-bath il-Hayy" , arabic = "شاهد البث الحي" , meaning = "Watch the live braodcast" } , { latin = "Tayyib" , arabic = "طَيِّب" , meaning = "Ok, good" } , { latin = "2ahlan wa-sahlan" , arabic = "أَهْلاً وَسَهْلاً" , meaning = "Welcome." } , { latin = "2a3iish" , arabic = "أَعيش" , meaning = "I live" } , { latin = "2a3iish fi l-yaabaan" , arabic = "أَعيش في لايابان" , meaning = "I live in Japan." } , { latin = "2ana 2ismii faaTima" , arabic = "أَنا إِسمي فاطِمة" , meaning = "My name is Fatima." } , { latin = "2a3iish fii miSr" , arabic = "أَعيش في مِصر" , meaning = "I live in Egypt." } , { latin = "al3mr" , arabic = "العمر" , meaning = "age" } , { latin = "2ukhtii wa-Sadiiqhaa juurj" , arabic = "أُخْتي وَصَديقهل جورْج" , meaning = "my sister and her friend George" } , { latin = "3amalii wa-eamala" , arabic = "عَمَلي وَعَمَله" , meaning = "my work and his work" } , { latin = "haadhihi Sadiiqat-hu saamiya" , arabic = "هَذِهِ صَديقَتهُ سامية" , meaning = "This is his girlfriend Samia." } ]
1922
module Arabic001 exposing (main) -- 2020-05-10 07:40:28 -- backup because I am makeing "kana" entry in the data import Browser import Html exposing (..) import Html.Attributes as HA import Html.Events as HE import Random main : Program () Model Msg main = Browser.element { init = init , update = update , subscriptions = subscriptions , view = view } type alias Model = { latin : String , arabic : String , meaning : String , showanswer : Bool , list : List Arabicdata } type alias Arabicdata = { latin : String , arabic : String , meaning : String } init : () -> ( Model, Cmd Msg ) init _ = ( Model "" "" "" False dict , Random.generate NewList (shuffle dict) ) type Msg = Delete | Next | NewRandom Int | Shuffle | NewList (List Arabicdata) | ShowAnswer Int update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Delete -> ( model , Cmd.none ) Next -> ( model , Cmd.none ) NewRandom n -> case List.drop n dict of x :: _ -> ( { model | latin = x.latin , arabic = x.arabic , meaning = x.meaning } , Cmd.none ) [] -> ( model , Cmd.none ) Shuffle -> ( model , Random.generate NewList (shuffle dict) ) NewList newList -> ( { model | list = newList } , Cmd.none ) ShowAnswer index -> case List.drop index model.list of x :: _ -> ( { model | latin = x.latin , arabic = x.arabic , meaning = x.meaning , showanswer = True } , Cmd.none ) [] -> ( model , Cmd.none ) subscriptions : Model -> Sub Msg subscriptions model = Sub.none view : Model -> Html Msg view model = div [] [ text "Convert latin to arabic" , p [] [ text "SabaaH" ] , button [] [ text "Show Answer" ] , button [] [ text "Delete" ] , button [] [ text "Next" ] ] shuffle : List a -> Random.Generator (List a) shuffle list = let randomNumbers : Random.Generator (List Int) randomNumbers = Random.list (List.length list) <| Random.int Random.minInt Random.maxInt zipWithList : List Int -> List ( a, Int ) zipWithList intList = List.map2 Tuple.pair list intList listWithRandomNumbers : Random.Generator (List ( a, Int )) listWithRandomNumbers = Random.map zipWithList randomNumbers sortedGenerator : Random.Generator (List ( a, Int )) sortedGenerator = Random.map (List.sortBy Tuple.second) listWithRandomNumbers in Random.map (List.map Tuple.first) sortedGenerator dict = [ { latin = "alssalaamu" , arabic = "اَلسَّلَامُ" , meaning = "peace" } , { latin = "2alaykum" , arabic = "عَلَيْكُمْ" , meaning = "on you" } , { latin = "SabaaH" , arabic = "صَبَاح" , meaning = "morning" } , { latin = "marhaban" , arabic = "مَرْحَبًا" , meaning = "Hello" } , { latin = "thaqaafah" , arabic = "ثَقافَة" , meaning = "culture" } , { latin = "2anaa bikhayr" , arabic = "أَنا بِخَيْر" , meaning = "I'm fine" } , { latin = "kabir" , arabic = "كَبير" , meaning = "large, big" } , { latin = "kabirah" , arabic = "كبيرة" , meaning = "large, big" } , { latin = "bayt" , arabic = "بَيْت" , meaning = "a house" } , { latin = "laysa" , arabic = "لِيْسَ" , meaning = "do not" } , { latin = "3and" , arabic = "عَنْد" , meaning = "have" } , { latin = "siith" , arabic = "سيث" , meaning = "Seth(male name)" } , { latin = "baluuzah" , arabic = "بَلوزة" , meaning = "blouse" } , { latin = "tii shiirt" , arabic = "تي شيرْت" , meaning = "T-shirt" } , { latin = "mi3Taf" , arabic = "مِعْطَف" , meaning = "a coat" } , { latin = "riim" , arabic = "ريم" , meaning = "Reem(name)" } , { latin = "tannuura" , arabic = "تَنّورة" , meaning = "a skirt" } , { latin = "jadiid" , arabic = "جَديد" , meaning = "new" } , { latin = "wishshaaH" , arabic = "وِشَاح" , meaning = "a scarf" } , { latin = "judii" , arabic = "جودي" , meaning = "Judy(name)" } , { latin = "jamiil" , arabic = "جَميل" , meaning = "good, nice, pretty, beautiful" } , { latin = "kalb" , arabic = "كَلْب" , meaning = "a dog" } , { latin = "2azraq" , arabic = "أَزْرَق" , meaning = "blue" } , { latin = "2abyaD" , arabic = "أَبْيَض " , meaning = "white" } , { latin = "qubb3a" , arabic = "قُبَّعة" , meaning = "a hat" } , { latin = "bunniyy" , arabic = "بُنِّيّ" , meaning = "brown" } , { latin = "mruu2a" , arabic = "مْروءة" , meaning = "chivalry" } , { latin = "kitaab" , arabic = "كِتاب" , meaning = "a book" } , { latin = "Taawilah" , arabic = "طاوِلة" , meaning = "a table" } , { latin = "hadhihi madiinA qadiima" , arabic = "هَذِهِ مَدينة قَديمة" , meaning = "This is an ancient city" } , { latin = "Hadiiqa" , arabic = "حَديقة" , meaning = "garden" } , { latin = "hadhihi HadiiqA 3arabyya" , arabic = "هَذِهِ حَديقة عَرَبيّة" , meaning = "This is an Arab garden" } , { latin = "hadhihi binaaya jamiila" , arabic = "هَذِهِ بِناية جَميلة" , meaning = "This is a beautiful building" } , { latin = "hadhaa muhammad" , arabic = "هَذا مُحَمَّد" , meaning = "This is mohamed" } , { latin = "hadhaa Saaluun ghaalii" , arabic = "هَذا صالون غالي" , meaning = "This is an expensive living room" } , { latin = "hadhihi HadiiqA jamiila" , arabic = "هَذِهِ حَديقة جَميلة" , meaning = "This is a pretty garden" } , { latin = "hadhihi HadiiqA qadiima" , arabic = "هَذِهِ حَديقة قَديمة" , meaning = "This is an old garden" } , { latin = "alHa2iT" , arabic = "الْحائط" , meaning = "the wall" } , { latin = "Ha2iT" , arabic = "حائِط" , meaning = "wall" } , { latin = "hadhaa alHaa2iT kabiir" , arabic = "هَذا الْحائِط كَبير " , meaning = "this wall is big" } , { latin = "alkalb" , arabic = "الْكَلْب" , meaning = "the dog" } , { latin = "hadhihi albinaaya" , arabic = "هذِهِ الْبِناية " , meaning = "this building" } , { latin = "al-ghurfa" , arabic = "اَلْغُرفة" , meaning = "the room" } , { latin = "alghurfA kaBiira" , arabic = "اَلْغرْفة كَبيرة" , meaning = "Theroom is big" } , { latin = "hadhihi alghurfa kabiira" , arabic = "هَذِهِ الْغُرْفة كَبيرة" , meaning = "this room is big" } , { latin = "hadhaa alkalb kalbii" , arabic = "هَذا الْكَلْب كَْلبي" , meaning = "this dog is my dog" } , { latin = "hadhaa alkalb jaw3aan" , arabic = "هَذا الْكَلْب جَوْعان" , meaning = "this dog is hungry" } , { latin = "hadhihi albinaaya waas3a" , arabic = "هَذِهِ الْبناية واسِعة" , meaning = "this building is spacious" } , { latin = "alkalb ghariib" , arabic = "اَلْكَلْب غَريب" , meaning = "The dog is weird" } , { latin = "alkalb kalbii" , arabic = "اَلْكَلْب كَلْبي" , meaning = "The dog is my dog" } , { latin = "hunaak" , arabic = "هُناك" , meaning = "there" } , { latin = "hunaak bayt" , arabic = "هُناك بَيْت" , meaning = "There is a house" } , { latin = "albayt hunaak" , arabic = "اَلْبَيْت هُناك" , meaning = "The house is there" } , { latin = "hunaak wishaaH 2abyaD" , arabic = "هُناك وِشاح أبْيَض" , meaning = "There is a white scarf" } , { latin = "alkalb munaak" , arabic = "اَلْكَلْب مُناك" , meaning = "The dog is there" } , { latin = "fii shanTatii" , arabic = "في شَنْطَتي" , meaning = "in my bag" } , { latin = "hal 3indak maHfaDHA yaa juurj" , arabic = "هَل عِنْدَك مَحْفَظة يا جورْج" , meaning = "do you have a wallet , george" } , { latin = "3indii shanTa ghaalya" , arabic = "عِنْدي شَنْطة غالْية" , meaning = "I have an expensive bag" } , { latin = "shanTatii fii shanTatik ya raanya" , arabic = "شِنْطَتي في شَنْطتِك يا رانْيا" , meaning = "my bag is in your bag rania" } , { latin = "huunak maHfaDhA Saghiira" , arabic = "هُناك مَحْفَظة صَغيرة" , meaning = "There is a small wallet" } , { latin = "hunaak kitab jadiid" , arabic = "هَناك كِتاب جَديد" , meaning = "There is a new book" } , { latin = "hunaak kitaab Saghiir" , arabic = "هُناك كِتاب صَغير" , meaning = "There is a small book" } , { latin = "hunaak qubba3A fii shanTatak yaa bob" , arabic = "هُناك قُبَّعة في شَنْطَتَك يا بوب" , meaning = "There is a hat in your bag bob" } , { latin = "hunaak shanTa Saghiira" , arabic = "هُناك شَنْطة صَغيرة" , meaning = "There is a small bag"f } , { latin = "shanTatii hunaak" , arabic = "شَنْطَتي هُناك" , meaning = "my bag is over there" } , { latin = "hunaak kitaab Saghiir wawishaaH Kabiir fii ShanTatii" , arabic = "هُناك كِتاب صَغير وَوِشاح كَبير في شَنْطَتي" , meaning = "There is a small book and a big scarf in my bag" } , { latin = "hunaak maHfaTa Saghiir fii ShanTatii" , arabic = "هُناك مَحْفَظة صَغيرة في شَنْطَتي" , meaning = "There is a small wallet in my bag" } , { latin = "aljaami3a hunaak" , arabic = "اَلْجامِعة هُناك" , meaning = "The university is there" } , { latin = "hunaak kitaab" , arabic = "هُناك كِتاب" , meaning = "There is a book" } , { latin = "almadiina hunaak" , arabic = "اَلْمَدينة هُناك" , meaning = "Thecity is there" } , { latin = "hal 3indik shanTa ghaalya ya Riim" , arabic = "هَل عِندِك شَنْطة غالْية يا ريم" , meaning = "do you have an expensive bag Reem" } , { latin = "hal 3indik mashruub ya saamya" , arabic = "هَل عِنْدِك مَشْروب يا سامْية" , meaning = "do you have a drink samia" } , { latin = "hunaak daftar rakhiiS" , arabic = "هُناك دَفْتَر رَخيص" , meaning = "There is a cheep notebook" } , { latin = "laysa 3indii daftar" , arabic = "لَيْسَ عِنْدي دَفْتَر" , meaning = "I do not have a notebook" } , { latin = "laysa hunaak masharuub fii shanTatii" , arabic = "لَيْسَ هُناك مَشْروب في شَنْطَتي" , meaning = "There is no drink in my bag" } , { latin = "laysa hunaak kitaab qaSiir fii baytii" , arabic = "لَيْسَ هُناك كِتاب قَصير في بَيْتي" , meaning = "There is no short book in my house" } , { latin = "laysa hunaak daftar rakhiiS" , arabic = "لَيْسَ هُناك دَفْتَر رَخيص" , meaning = "There is no cheap notebook" } , { latin = "laysa 3indii sii dii" , arabic = "لَيْسَ عَنْدي سي دي" , meaning = "I do not have a CD" } , { latin = "laysa hunaak qalam fii shanTatii" , arabic = "لَيْسَ هُناك قَلَم في شَنْطَتي" , meaning = "There is no pen in my bag" } , { latin = "laysa hunaak kitaab qaSiir fii shanTatii" , arabic = "لَيْسَ هُناك كِتاب قَصير في شَنْطَتي" , meaning = "There is no short book in my bag" } , { latin = "laysa hunaak daftar 2abyaD" , arabic = "لَيْسَ هُناك دَفْتَر أَبْيَض" , meaning = "There is no white notebook." } , { latin = "maTbakh" , arabic = "مَطْبَخ" , meaning = "a kitchen" } , { latin = "3ilka" , arabic = "عِلْكة" , meaning = "gum" } , { latin = "miftaaH" , arabic = "مفْتاح" , meaning = "a key" } , { latin = "tuub" , arabic = "توب" , meaning = "top" } , { latin = "nuquud" , arabic = "نُقود" , meaning = "money" } , { latin = "aljazeera" , arabic = "الجزيرة" , meaning = "Al Jazeera" } , { latin = "kayfa" , arabic = "كَيْفَ" , meaning = "how" } , { latin = "kursii" , arabic = "كَرْسي" , meaning = "a chair" } , { latin = "sari3" , arabic = "سَريع" , meaning = "fast" } , { latin = "Haasuub" , arabic = "حاسوب" , meaning = "a computer" } , { latin = "maktab" , arabic = "مَكْتَب" , meaning = "office" } , { latin = "hadhaa maktab kabiir" , arabic = "هَذا مَِكْتَب كَبير" , meaning = "This is a big office" } , { latin = "kursii alqiTTa" , arabic = "كُرْسي الْقِطّة" , meaning = "the cat's chair" } , { latin = "Haasuub al2ustaadha" , arabic = "حاسوب اَلْأُسْتاذة" , meaning = "professor's computer" } , { latin = "kursii jadiid" , arabic = "كُرْسي جَديد" , meaning = "a new chair" } , { latin = "alHamdu lilh" , arabic = "اَلْحَمْدُ لِله" , meaning = "Praise be to God" } , { latin = "SaHiifa" , arabic = "صَحيفة" , meaning = "newspaper" } , { latin = "raqam" , arabic = "رَقَم" , meaning = "number" } , { latin = "haatif" , arabic = "هاتِف" , meaning = "phone" } , { latin = "2amriikiyy" , arabic = "أمْريكِي" , meaning = "American" } , { latin = "2amriikaa wa-as-siin" , arabic = "أَمْريكا وَالْصّين" , meaning = "America and China" } , { latin = "qahwa" , arabic = "قَهْوة" , meaning = "coffee" } , { latin = "Haliib" , arabic = "حَليب" , meaning = "milk" } , { latin = "muuza" , arabic = "موزة" , meaning = "a banana" } , { latin = "2akl" , arabic = "أَكْل" , meaning = "food" } , { latin = "2akl 3arabyy waqahwA 3arabyy" , arabic = "أَكْل عَرَبيّ وَقَهْوة عَرَبيّة" , meaning = "Arabic food and Arabic coffee" } , { latin = "ruzz" , arabic = "رُزّ" , meaning = "rice" } , { latin = "ruzzii waqahwatii" , arabic = "رُزّي وَقَهْوَتي" , meaning = "my rice and my coffee" } , { latin = "qahwatii fii shanTatii" , arabic = "قَهْوَتي في شَنْطَتي" , meaning = "My coffee is in my bag" } , { latin = "qahwaA siith" , arabic = "قَهْوَة سيث" , meaning = "Seth's coffee" } , { latin = "Sadiiqathaa" , arabic = "صَديقَتها" , meaning = "her friend" } , { latin = "jaarat-haa" , arabic = "جارَتها" , meaning = "her neighbor" } , { latin = "2a3rif" , arabic = "أَعْرِف" , meaning = "I know ..." } , { latin = "2ukhtii" , arabic = "أُخْتي" , meaning = "my sister" } , { latin = "Sadiiqa Jayyida" , arabic = "صَديقة جَيِّدة" , meaning = "a good friend" }أ , { latin = "2a3rif" , arabic = "أَعْرِف" , meaning = "I know" } , { latin = "2anaa 2a3rifhu" , arabic = "أَنا أَعْرِفه" , meaning = "I know him" } , { latin = "Taaawila Tawiila" , arabic = "طاوِلة طَويلة" , meaning = "long table" } , { latin = "baytik wabaythaa" , arabic = "بَيْتِك وَبَيْتها" , meaning = "your house and her house" } , { latin = "ism Tawiil" , arabic = "اِسْم طَويل" , meaning = "long name" } , { latin = "baytii wabaythaa" , arabic = "بَيْتي وَبَيْتها" , meaning = "my house and her house" } , { latin = "laysa hunaak lugha Sa3ba" , arabic = "لَيْسَ هُناك لُغة صَعْبة" , meaning = "There is no diffcult language." } , { latin = "hadhaa shay2 Sa3b" , arabic = "هَذا شَيْء صَعْب" , meaning = "This is a difficult thing." } , { latin = "ismhu taamir" , arabic = "اِسْمهُ تامِر" , meaning = "His name is Tamer." } , { latin = "laa 2a3rif 2ayn bayt-hu" , arabic = "لا أَعْرِف أَيْن بَيْته" , meaning = "I don't know where his house is" } , { latin = "laa 2a3rif 2ayn 2anaa" , arabic = "لا أعرف أين أنا." , meaning = "I don't know where I am." } , { latin = "baythu qariib min aljaami3at" , arabic = "بيته قريب من الجامعة" , meaning = "His house is close to the university" } , { latin = "ismhaa arabyy" , arabic = "إسمها عربي" , meaning = "Her name is arabic." } , { latin = "Sadiiqathu ruuzaa qariibhu min baythu" , arabic = "صديقته روزا قريبه من بيته" , meaning = "His friend <NAME> is close to his house." } , { latin = "ismhu Tawiil" , arabic = "إسمه طويل" , meaning = "His name is long." } , { latin = "riim Sadiiqat Sa3bat" , arabic = "ريم صديقة صعبة" , meaning = "Reem is a difficult friend." } , { latin = "ismhu bashiir" , arabic = "إسمه بشير" , meaning = "HIs name is Bashir." } , { latin = "ismhaa Tawiil" , arabic = "إسمها طويل" , meaning = "Her name is long." } , { latin = "Sadiiqhaa buub qariib min baythaa" , arabic = "صديقها بوب قريب من بيتها" , meaning = "Her friend <NAME> is close to her house." } , { latin = "ismhu <NAME>" , arabic = "إسمه بوب" , meaning = "His name is <NAME>." } , { latin = "baythu qariib min baythaa" , arabic = "بيته قريب من بيتها" , meaning = "His house is close to her house." } , { latin = "hadhaa shay2 Sa3b" , arabic = "هذا شيء صعب" , meaning = "This is a difficult thing." } , { latin = "3alaaqa" , arabic = "عَلاقَة" , meaning = "relationship" } , { latin = "alqiTTa" , arabic = "اَلْقِطّة" , meaning = "the cat" } , { latin = "la 2uhib" , arabic = "لا أُحِب" , meaning = "I do not like" } , { latin = "al2akl mumti3" , arabic = "اَلْأَكْل مُمْتع" , meaning = "Eating is fun." } , { latin = "alqiraa2a" , arabic = "اَلْقِراءة" , meaning = "reading" } , { latin = "alkitaaba" , arabic = "الْكِتابة" , meaning = "writing" } , { latin = "alkiraa2a wa-alkitaaba" , arabic = "اَلْقِراءة وَالْكِتابة" , meaning = "reading and writing" } , { latin = "muhimm" , arabic = "مُهِمّ" , meaning = "important" } , { latin = "alkiaaba shay2 muhimm" , arabic = "اَلْكِتابة شَيْء مُهِمّ" , meaning = "Writing is an important thing." } , { latin = "aljara wa-alqiTTa" , arabic = "اَلْجارة وَالْقِطّة" , meaning = "the neighbor and the cat" } , { latin = "qiTTa wa-alqiTTa" , arabic = "قِطّة وَالْقِطّة" , meaning = "a cat and the cat" } , { latin = "2ayDaan" , arabic = "أَيْضاً" , meaning = "also" } , { latin = "almaT3m" , arabic = "الْمَطْعْم" , meaning = "the restaurant" } , { latin = "aljarii" , arabic = "اَلْجَري" , meaning = "the running" } , { latin = "maa2" , arabic = "ماء" , meaning = "water" } , { latin = "maT3am" , arabic = "مَطْعَم" , meaning = "a restaurant" } , { latin = "alttaSwiir" , arabic = "اَلْتَّصْوير" , meaning = "photography" } , { latin = "alnnawm" , arabic = "اَلْنَّوْم" , meaning = "sleeping" } , { latin = "as-sibaaha" , arabic = "اَلْسِّباحة" , meaning = "swimming" } , { latin = "Sabaahaan 2uhibb al2akl hunaa" , arabic = "صَباحاً أُحِبّ اَلْأَكْل هُنا" , meaning = "Inn the morning, I like eating here." } , { latin = "kathiiraan" , arabic = "كَثيراً" , meaning = "much" } , { latin = "hunaa" , arabic = "هُنا" , meaning = "here" } , { latin = "jiddan" , arabic = "جِدَّاً" , meaning = "very" } , { latin = "3an" , arabic = "عَن" , meaning = "about" } , { latin = "2uhibb al-ssafar 2ilaa 2iiiTaaliiaa" , arabic = "أُحِبّ اَلْسَّفَر إِلى إيطالْيا" , meaning = "I like traveling to Italy." } , { latin = "alkalaam ma3a 2abii" , arabic = "اَلْكَلام مَعَ أَبي" , meaning = "talking with my father" } , { latin = "alkalaam ma3a 2abii ba3d alDHDHahr" , arabic = "اَلْكَلام معَ أَبي بَعْد اَلْظَّهْر" , meaning = "talking with my father in the afternoon" } , { latin = "2uhibb alssafar 2ilaa 2almaaniiaa" , arabic = "أُحِب اَلْسَّفَر إِلى أَلْمانيا" , meaning = "I like travelling to Germany" } , { latin = "2uHibb aljarii bialllyl" , arabic = "أُحِبّ اَلْجَري بِالْلَّيْل" , meaning = "I like running at night." } , { latin = "2uriidu" , arabic = "أُريدُ" , meaning = "I want" } , { latin = "2uHibb 2iiiTaaliiaa 2ayDan" , arabic = "أُحِبّ إيطاليا أَيْضاً" , meaning = "I like Italy also." } , { latin = "2uHibb alnnawm ba3d alDHDHhr" , arabic = "أحِبّ اَلْنَّوْم بَعْد اَلْظَّهْر" , meaning = "I like sleeping in the afternoon." } , { latin = "2uHibb alqiraa2a 3an kuubaa biaalllayl" , arabic = "أُحِبّ اَلْقِراءة عَن كوبا بِالْلَّيْل" , meaning = "I like to read about Cuba at night." } , { latin = "2uHibb alkalaam 3an alkitaaba" , arabic = "أحِبّ اَلْكَلام عَن اَلْكِتابة" , meaning = "I like talking about writing." } , { latin = "alqur2aan" , arabic = "اَلْقُرْآن" , meaning = "Koran" } , { latin = "bayt jamiil" , arabic = "بَيْت جَميل" , meaning = "a pretty house" } , { latin = "bint suuriyya" , arabic = "بِنْت سورِيّة" , meaning = "a Syrian girl" } , { latin = "mutarjim mumtaaz" , arabic = "مُتَرْجِم مُمْتاز" , meaning = "an amazing translator" } , { latin = "jaami3a mashhuura" , arabic = "جامِعة مَشْهورة" , meaning = "a famous university" } , { latin = "al-bayt al-jamiil" , arabic = "اَلْبَيْت اَلْجَميل" , meaning = "the pretty house" } , { latin = "al-bint al-ssuuriyya" , arabic = "اَلْبِنْت اَلْسّورِيّة" , meaning = "a Syrian girl" } , { latin = "al-mutarjim al-mumtaaz" , arabic = "اَلْمُتَرْجِم اَلْمُمْتاز" , meaning = "the amazing translator" } , { latin = "al-jaami3a al-mashhuura" , arabic = "اَلْجامِعة اَلْمَشْهورة" , meaning = "the famous university" } , { latin = "al-bayt jamiil" , arabic = "اَلْبَيْت جَميل" , meaning = "The house is pretty." } , { latin = "al-bint suuriyya" , arabic = "البنت سورِيّة" , meaning = "The girl is Syrian." } , { latin = "al-mutarjim mumtaaz" , arabic = "اَلْمُتَرْجِم مُمْتاز" , meaning = "The translator is amazing." } , { latin = "al-jaami3a mashhuura" , arabic = "اَلْجامِعة مَشْهورة" , meaning = "" } , { latin = "Haarr" , arabic = "حارّ" , meaning = "hot" } , { latin = "maTar" , arabic = "مَطَر" , meaning = "rain" } , { latin = "yawm Tawiil" , arabic = "يَوْم طَويل" , meaning = "a long day" } , { latin = "Taqs baarid" , arabic = "طَقْس بارِد" , meaning = "cold weather" } , { latin = "haathaa yawm Tawiil" , arabic = "هَذا يَوْم طَويل" , meaning = "This is a long day." } , { latin = "shanTa fafiifa" , arabic = "شَنْطة خَفيفة" , meaning = "a light bag" } , { latin = "mi3Taf khafiif" , arabic = "مِعْطَف خَفيف" , meaning = "a light coat" } , { latin = "al-maTar al-ththaqiil mumtaaz" , arabic = "اَلْمَطَر اَلْثَّقيل مُمْتاز" , meaning = "The heavy rain is amazing." } , { latin = "Taqs ghariib" , arabic = "طَقْس غَريب" , meaning = "a weird weather" } , { latin = "yawm Haarr" , arabic = "يَوْم حارّ" , meaning = "a hot day" } , { latin = "maTar khafiif" , arabic = "مَطَر خفيف" , meaning = "a light rain" } , { latin = "Taawila khafiifa" , arabic = "طاوِلة خَفيفة" , meaning = "a light table" } , { latin = "Taqs jamiil" , arabic = "طَقْس جَميل" , meaning = "a pretty weather" } , { latin = "al-maTar al-ththaqiil mumtaaz" , arabic = "اَلْمَطَر اَلْثَّقيل مُمْتاز" , meaning = "The heavy rain is amazing." } , { latin = "haathaa yawm Haarr" , arabic = "هَذا يَوْم حارّ" , meaning = "This is a hot day." } , { latin = "shanTa khafiifa" , arabic = "شَنْطة خَفيفة" , meaning = "a light bag" } , { latin = "hunaak maTar baarid jiddan" , arabic = "هُناك مَطَر بارِد جِدّاً" , meaning = "There is a very cold rain." } , { latin = "Sayf" , arabic = "صّيْف" , meaning = "summer" } , { latin = "shitaa2" , arabic = "شِتاء" , meaning = "winter" } , { latin = "thitaa2 baarid" , arabic = "شِتاء بارِد" , meaning = "cold winter" } , { latin = "binaaya 3aalya" , arabic = "بِناية عالْية" , meaning = "a high building" } , { latin = "yawm baarid" , arabic = "يَوْم بارِد" , meaning = "a cold day" } , { latin = "alyawm yawm baarid" , arabic = "اَلْيَوْم يَوْم بارِد" , meaning = "Today is a cold day." } , { latin = "ruTwwba 3aalya" , arabic = "رُطوبة عالْية" , meaning = "high humidity" } , { latin = "al-rruTuuba al-3aalya" , arabic = "اَلْرَّطوبة الْعالْية" , meaning = "the high humidity" } , { latin = "Sayf mumTir" , arabic = "صَيْف مُمْطِر" , meaning = "a rainy summer" } , { latin = "al-rruTuuba al3aalya" , arabic = "اَلْرُّطوبة الْعالْية" , meaning = "the high humidity" } , { latin = "al-TTaqs al-mushmis" , arabic = "اّلْطَّقْس الّْمُشْمِس" , meaning = "the sunny weather" } , { latin = "shitaa2 mumTir" , arabic = "شِتاء مُمْطِر" , meaning = "a rainy winter" } , { latin = "Sayf Haarr" , arabic = "صَيْف حارّ" , meaning = "a hot summer" } , { latin = "al-yawm yawm Tawiil" , arabic = "اَلْيَوْم يَوْم طَويل" , meaning = "Today is a long day." } , { latin = "laa 2uhibb al-Taqs al-mushmis" , arabic = "لا أُحِبّ اَلْطَقْس اَلْمُشْمِس" , meaning = "I do not like sunny weather." } , { latin = "al-Taqs mumTir jiddan al-yawm" , arabic = "اَلْطَقْس مُمْطِر جِدّاً اَلْيَوْم" , meaning = "The weather is very rainy today." } , { latin = "laa 2uhibb al-TTaqs al-mumTir" , arabic = "لا أحِبّ اَلْطَّقْس اَلْمُمْطِر" , meaning = "I do not like the rainy weather." } , { latin = "al-TTaqs mushmis al-yawm" , arabic = "اَلْطَّقْس مُشْمِس اَلْيَوْم" , meaning = "The weather is sunny today." } , { latin = "khariif" , arabic = "خَريف" , meaning = "fall, autumn" } , { latin = "qamar" , arabic = "قَمَر" , meaning = "moon" } , { latin = "rabiir" , arabic = "رَبيع" , meaning = "spring" } , { latin = "al-shishitaa2 mumTir" , arabic = "اَلْشِّتاء مُمْطِر" , meaning = "The winter is rainy." } , { latin = "al-SSayf al-baarid" , arabic = "اَلْصَّيْف اَلْبارِد" , meaning = "the cold summer" } , { latin = "al-qamar al-2abyab" , arabic = "اَلْقَمَر اَلْأَبْيَض" , meaning = "the white moon" } , { latin = "al-shishitaa2 Tawiil wa-baarid" , arabic = "اَلْشِّتاء طَويل وَبارِد" , meaning = "The winter is long and cold." } , { latin = "al-rrabii3 mumTir al-aan" , arabic = "اَلْرَّبيع مُمْطِر اَلآن" , meaning = "The winter is rainy now" } , { latin = "Saghiir" , arabic = "صَغير" , meaning = "small" } , { latin = "kashiiran" , arabic = "كَثيراً" , meaning = "a lot, much" } , { latin = "al-ssuudaan" , arabic = "اَلْسّودان" , meaning = "Sudan" } , { latin = "as-siin" , arabic = "اَلْصّين" , meaning = "China" } , { latin = "al-qaahira" , arabic = "اَلْقاهِرة" , meaning = "Cairo" } , { latin = "al-bunduqiyya" , arabic = "اَلْبُنْدُقِية" , meaning = "Venice" } , { latin = "filasTiin" , arabic = "فِلَسْطين" , meaning = "Palestine" } , { latin = "huulandaa" , arabic = "هولَنْدا" , meaning = "Netherlands" } , { latin = "baghdaad" , arabic = "بَغْداد" , meaning = "Bagdad" } , { latin = "Tuukyuu" , arabic = "طوكْيو" , meaning = "Tokyo" } , { latin = "al-yaman" , arabic = "اَلْيَمَن" , meaning = "Yemen" } , { latin = "SaaHil Tawiil" , arabic = "ساحَل طَويل" , meaning = "a long coast" } , { latin = "al-2urdun" , arabic = "اَلْأُرْدُن" , meaning = "Jordan" } , { latin = "haathaa al-balad" , arabic = "هَذا الْبَلَد" , meaning = "this country" } , { latin = "2ayn baladik yaa riim" , arabic = "أَيْن بَلَدِك يا ريم" , meaning = "Where is your country, Reem?" } , { latin = "baldii mumtaaz" , arabic = "بَلَدي مُمْتاز" , meaning = "My country is amazing." } , { latin = "haathaa balad-haa" , arabic = "هَذا بَلَدها" , meaning = "This is her country." } , { latin = "hal baladak jamiil yaa juurj?" , arabic = "هَل بَلَدَك جَميل يا جورْج" , meaning = "Is your country pretty, George" } , { latin = "al-yaman balad Saghiir" , arabic = "اَلْيَمَن بَلَد صَغير" , meaning = "Yemen is a small country." } , { latin = "qaari2" , arabic = "قارِئ" , meaning = "reader" } , { latin = "ghaa2ib" , arabic = "غائِب" , meaning = "absent" } , { latin = "mas2uul" , arabic = "مَسْؤول" , meaning = "responsoble, administrator" } , { latin = "jaa2at" , arabic = "جاءَت" , meaning = "she came" } , { latin = "3indii" , arabic = "عِنْدي" , meaning = "I have" } , { latin = "3indik" , arabic = "عِنْدِك" , meaning = "you have" } , { latin = "ladii kitaab" , arabic = "لَدي كِتاب" , meaning = "I have a book." } , { latin = "3indhaa" , arabic = "عِنْدها" , meaning = "she has" } , { latin = "3indhu" , arabic = "عِنْدهُ" , meaning = "he has" } , { latin = "laysa 3indhu" , arabic = "لَيْسَ عِنْدهُ" , meaning = "he does not have" } , { latin = "laysa 3indhaa" , arabic = "لَيْسَ عِنْدها" , meaning = "she does not have" } , { latin = "hunaak maTar thaqiil" , arabic = "هُناك مَطَر ثَقيل" , meaning = "There is a heavy rain." } , { latin = "hunaak wishaaH fii shanTatii" , arabic = "هُناك وِشاح في شَنْطتي" , meaning = "There is a scarf in my bag." } , { latin = "laysa hunaak lugha Sa3ba" , arabic = "لَيْسَ هُناك لُغة صَعْبة" , meaning = "There is no difficult language." } , { latin = "2amaamii rajul ghariib" , arabic = "أَمامي رَجُل غَريب" , meaning = "There is a weird man in front of me." } , { latin = "fii al-khalfiyya bayt" , arabic = "في الْخَلفِيْة بَيْت" , meaning = "There is a house in the background." } , { latin = "fii shanTatii wishaaH" , arabic = "في شَنْطَتي وِشاح" , meaning = "There is a scarf in my bag." } , { latin = "asad" , arabic = "أَسَد" , meaning = "a lion" } , { latin = "2uHibb 2asadii laakibb la 2uHibb 2usadhaa" , arabic = "أحِبَ أَسَدي لَكِنّ لا أُحِبّ أَسَدها" , meaning = "I like my lion but I do not like her lion." } , { latin = "laysa 3indhu" , arabic = "لَيْسَ عِنْدهُ" , meaning = "he does not have" } , { latin = "3indhaa kalb wa-qiTTa" , arabic = "عِنْدها كَلْب وَقِطّة" , meaning = "She has a doc and a cat." } , { latin = "Sadiiqatu" , arabic = "صَديقَتهُ سامْية غَنِيّة" , meaning = "His friend <NAME> is rich." } , { latin = "taariikhiyya" , arabic = "تاريخِيّة" , meaning = "historical" } , { latin = "juurj 3indhu 3amal mumtaaz" , arabic = "جورْج عِنْدهُ عَمَل مُمْتاز" , meaning = "George has an amazing work." } , { latin = "Sadiiqii taamir ghaniyy jiddan" , arabic = "صَديقي تامِر غَنِيّ جِدّاً" , meaning = "My friend <NAME> is very rich" } , { latin = "laa 2a3rif haadhaa l-2asad" , arabic = "لا أَعْرِف هَذا الْأَسّد" , meaning = "I do not know this lion." } , { latin = "laysa 3indhu mi3Taf" , arabic = "لَيْسَ عِنْدهُ مِعْطَف" , meaning = "He does not have a coat." } , { latin = "fii l-khalfiyya zawjatak ya siith" , arabic = "في الْخَلْفِيّة زَوْجَتَك يا سيث" , meaning = "There is your wife in background, Seth" } , { latin = "su2uaal" , arabic = "سُؤال" , meaning = "a question" } , { latin = "Sadiiqat-hu saamya laabisa tannuura" , arabic = "صدَيقَتهُ سامْية لابِسة تّنّورة" , meaning = "His friend Samia is wering a skirt." } , { latin = "wa-hunaa fii l-khalfitta rajul muDHik" , arabic = "وَهُنا في الْخَلْفِتّة رَجُل مُضْحِك" , meaning = "And here in the background there is a funny man." } , { latin = "man haadhaa" , arabic = "مَن هَذا" , meaning = "Who is this?" } , { latin = "hal 2anti labisa wishaaH ya lamaa" , arabic = "هَل أَنْتِ لابِسة وِشاح يا لَمى" , meaning = "Are you wering a scarf, Lama?" } , { latin = "2akhii bashiir mashghuul" , arabic = "أَخي بَشير مَشْغول" , meaning = "My brother <NAME> is busy." } , { latin = "fii haadhihi l-s-Suura imraa muDHika" , arabic = "في هَذِهِ الْصّورة اِمْرأة مُضْحِكة" , meaning = "Thre is a funny woman in this picture." } , { latin = "hal 2anta laabis qubb3a ya siith" , arabic = "هَل أَنْتَ لابِس قُبَّعة يا سيث" , meaning = "Are you wearing a hat, Seth?" } , { latin = "fii l-khalfiyya rajul muDHik" , arabic = "في الْخَلْفِيّة رَجُل مُضْحِك" , meaning = "There is a funny man in the background." } , { latin = "shubbaak" , arabic = "شُبّاك" , meaning = "a window" } , { latin = "sariir" , arabic = "سَرير" , meaning = "a bed" } , { latin = "muHammad 2ustaadhii" , arabic = "مُحَمَّد أُسْتاذي" , meaning = "Muhammed is my teacher." } , { latin = "saadii 2ustaadhii" , arabic = "شادي أُسْتاذي" , meaning = "Sadie is my teacher." } , { latin = "2ummhu" , arabic = "أُمّهُ" , meaning = "his mother" } , { latin = "tilfaaz" , arabic = "تِلْفاز" , meaning = "a television" } , { latin = "ma haadhaa as-sawt" , arabic = "ما هَذا الْصَّوْت" , meaning = "What is this noise" } , { latin = "2adkhul al-Hammaam" , arabic = "أَدْخُل اَلْحَمّام" , meaning = "I enter the bathroom." } , { latin = "2uHibb al-ssariir al-kabiir" , arabic = "أُحِبّ اَلْسَّرير اَلْكَبير" , meaning = "I love the big bed." } , { latin = "hunaak mushkila ma3 lt-tilfaaz" , arabic = "هُناك مُشْكِلة مَعَ الْتِّلْفاز" , meaning = "There is a problem with the television." } , { latin = "al-haatif mu3aTTal wa-lt-tilfaaz 2ayDan" , arabic = "اَلْهاتِف مُعَطَّل وَالْتَّلْفاز أَيضاً" , meaning = "The telephone is out of order and the television also." } , { latin = "hunaak Sawt ghariib fii l-maTbakh" , arabic = "هُناك صَوْت غَريب في الْمَطْبَخ" , meaning = "There is a weird nose in the kitchen." } , { latin = "2anaam fii l-ghurfa" , arabic = "أَنام في الْغُرْفة" , meaning = "I sleep in the room." } , { latin = "tilfaaz Saghiir fii Saaluun kabiir" , arabic = "تِلْفاز صَغير في صالون كَبير" , meaning = "a small television in a big living room" } , { latin = "2anaam fii sariir maksuur" , arabic = "أَنام في سَرير مَكْسور" , meaning = "I sleep in a broken bed." } , { latin = "as-sariir al-kabiir" , arabic = "اَلْسَّرير اَلْكَبير" , meaning = "the big bed" } , { latin = "maa haadhaa aSSwut" , arabic = "ما هَذا الصّوُت" , meaning = "What is this noise?" } , { latin = "sariirii mumtaaz al-Hamdu lila" , arabic = "سَريري مُمتاز اَلْحَمْدُ لِله" , meaning = "My bed is amazing, praise be to God" } , { latin = "2anaam kathiiran" , arabic = "أَنام كَشيراً" , meaning = "I sleep a lot" } , { latin = "hunaak Sawt ghariib" , arabic = "هُناك صَوْت غَريب" , meaning = "There is a weird noise." } , { latin = "shubbaak" , arabic = "شُبّاك" , meaning = "a window" } , { latin = "2anaam fii sariir Saghiir" , arabic = "أَنام في سَرير صَغير" , meaning = "I sleep in a small bed." } , { latin = "muHammad 2ustaadhii" , arabic = "مُحَمَّد أُسْتاذي" , meaning = "Muhammad is my teacher." } , { latin = "mahaa 2ummhu" , arabic = "مَها أُمّهُ" , meaning = "Maha is his mother." } , { latin = "fii haadhaa lsh-shaari3 Sawt ghariib" , arabic = "في هٰذا ٱلْشّارِع صَوْت غَريب" , meaning = "There is a weird nose on this street" } , { latin = "2askun fii ls-saaluun" , arabic = "أَسْكُن في الْصّالون" , meaning = "I live in the living room." } , { latin = "haadhaa lsh-shaar3" , arabic = "هَذا الْشّارِع" , meaning = "this street" } , { latin = "fii lT-Taabiq al-2awwal" , arabic = "في الْطّابِق اَلْأَوَّل" , meaning = "on the first floor" } , { latin = "Hammaam" , arabic = "حَمّام" , meaning = "bathroom" } , { latin = "alsh-shaanii" , arabic = "اَلْثّاني" , meaning = "the second" } , { latin = "3and-hu ghurfa nawm Saghiira" , arabic = "عِندهُ غُرْفة نَوْم صَغيرة" , meaning = "He has a small bedroom." } , { latin = "laa 2aftaH albaab bisabab lT-Taqs" , arabic = "لا أَفْتَح اَلْباب بِسَبَب اّلْطَّقْس" , meaning = "I do not open the door because of the weather." } , { latin = "Sifr" , arabic = "صِفْر" , meaning = "zero" } , { latin = "3ashara" , arabic = "عَشَرَة" , meaning = "ten" } , { latin = "waaHid" , arabic = "وَاحِد" , meaning = "one" } , { latin = "2ithnaan" , arabic = "اِثْنان" , meaning = "two" } , { latin = "kayf ta3uddiin min waaHid 2ilaa sitta" , arabic = "كَيْف تَعُدّين مِن ١ إِلى ٦" , meaning = "How do you count from one to six?" } , { latin = "bil-lugha" , arabic = "بِالْلُّغة" , meaning = "in language" } , { latin = "bil-lugha l-3arabiya" , arabic = "بِالْلُّغة الْعَرَبِيّة" , meaning = "in the arabic language" } , { latin = "ta3rifiin" , arabic = "تَعْرِفين" , meaning = "you know" } , { latin = "hal ta3rifiin kull shay2 yaa mahaa" , arabic = "هَل تَعْرِفين كُلّ شَيء يا مَها" , meaning = "Do you know everything Maha?" } , { latin = "kayf ta3udd yaa 3umar" , arabic = "كَيْف تَعُدّ يا عُمَر" , meaning = "How do you count Omar?" } , { latin = "Kayf ta3udd min Sifr 2ilaa 2ashara yaa muHammad" , arabic = "كَيْف تَعُدّ مِن٠ إِلى ١٠ يا مُحَمَّد" , meaning = "How do you count from 0 to 10 , Mohammed?" } , { latin = "hal ta3rif yaa siith" , arabic = "هَل تَعْرِف يا سيث" , meaning = "Do you know Seth?" } , { latin = "bayt buub" , arabic = "بَيْت بوب" , meaning = "Bob's house" } , { latin = "maT3am muHammad" , arabic = "مَطْعَم مُحَمَّد" , meaning = "Mohammed's restaurant" } , { latin = "SaHiifat al-muhandis" , arabic = "صَحيفة اَلْمُهَنْدِس" , meaning = "the enginner's newspaper" } , { latin = "madiinat diitruuyt" , arabic = "مَدينة ديتْرويْت" , meaning = "the city of Detroit" } , { latin = "wilaayat taksaas" , arabic = "وِلاية تَكْساس" , meaning = "the state of Texas" } , { latin = "jaami3at juurj waashinTun" , arabic = "جامِعة جورْج واشِنْطُن" , meaning = "George Washinton University" } , { latin = "shukuran" , arabic = "شُكْراً" , meaning = "thank you" } , { latin = "SabaaHan" , arabic = "صَباحاً" , meaning = "in the morning" } , { latin = "masaa-an" , arabic = "مَساءً" , meaning = "in the evening" } , { latin = "wayaatak" , arabic = "وِلايَتَك" , meaning = "your state" } , { latin = "madiina saaHiliyya" , arabic = "مَدينة ساحِلِيّة" , meaning = "a coastal city" } , { latin = "muzdaHima" , arabic = "مُزْدَحِمة" , meaning = "crowded" } , { latin = "wilaaya kaaliifuurniyaa" , arabic = "وِلاية كاليفورْنْيا" , meaning = "the state of California" } , { latin = "luus 2anjiaalis" , arabic = "لوس أَنْجِلِس" , meaning = "Los Angeles" } , { latin = "baHr" , arabic = "بَحْر" , meaning = "sea" } , { latin = "al-baHr al-2abyaD al-mutawassaT" , arabic = "اَاْبَحْر اَلْأَبْيَض اَلْمُتَوَسِّط" , meaning = "the Meditteranean Sea" } , { latin = "lil2asaf" , arabic = "لٍلْأَسَف" , meaning = "unfortunately" } , { latin = "DawaaHii" , arabic = "ضَواحي" , meaning = "suburbs" } , { latin = "taskuniin" , arabic = "تَسْكُنين" , meaning = "you live" } , { latin = "nyuuyuurk" , arabic = "نْيويورْك" , meaning = "New York" } , { latin = "qaryatik" , arabic = "قَرْيَتِك" , meaning = "your village" } , { latin = "shubbaak" , arabic = "شُبّاك" , meaning = "a window" } , { latin = "jaziira" , arabic = "جَزيرة" , meaning = "an island" } , { latin = "Tabii3a" , arabic = "طَبيعة" , meaning = "nature" } , { latin = "al-2iskandariyya" , arabic = "اَلْإِسْكَندَرِيّة" , meaning = "Alexandria" } , { latin = "miSr" , arabic = "مِصْر" , meaning = "Egypt" } , { latin = "na3am" , arabic = "نَعَم" , meaning = "yes" } , { latin = "SabaaH l-khayr" , arabic = "صَباح اَلْخَيْر" , meaning = "Good morning." } , { latin = "SabaaH an-nuur" , arabic = "صَباح اَلْنّور" , meaning = "Good morning." } , { latin = "masaa2 al-khayr" , arabic = "مَساء اَلْخَيْر" , meaning = "Good evening" } , { latin = "masaa2 an-nuur" , arabic = "مَساء اَلْنّور" , meaning = "Good evening." } , { latin = "as-salaamu 3alaykum" , arabic = "اَلْسَّلامُ عَلَيْكُم" , meaning = "Peace be upon you." } , { latin = "wa-3alaykumu as-salaam" , arabic = "وَعَلَيْكُمُ ٲلْسَّلام" , meaning = "" } , { latin = "tasharrafnaa" , arabic = "تَشَرَّفْنا" , meaning = "It's a pleasure to meet you." } , { latin = "hal 2anta bikhyr" , arabic = "هَل أَنْتَ بِخَيْر" , meaning = "Are you well?" } , { latin = "kayfak" , arabic = "كَيْفَك" , meaning = "How are you?" } , { latin = "al-yawm" , arabic = "اَلْيَوْم" , meaning = "today" } , { latin = "kayfik al-yawm" , arabic = "كَيْفِك اَلْيَوْم" , meaning = "How are you today?" } , { latin = "marHaban ismii buub" , arabic = "مَرْحَباً اِسْمي بوب" , meaning = "Hello, my name is <NAME>." } , { latin = "Haziin" , arabic = "حَزين" , meaning = "sad" } , { latin = "mariiD" , arabic = "مَريض" , meaning = "sick" } , { latin = "yawm sa3iid" , arabic = "يَوْم سَعيد" , meaning = "Have a nice day." } , { latin = "sa3iid" , arabic = "سَعيد" , meaning = "happy" } , { latin = "2anaa Haziinat l-yawm" , arabic = "أَنا حَزينة الْيَوْم" , meaning = "I am sad today." } , { latin = "2anaa Haziin jiddan" , arabic = "أَنا حَزين جِدّاً" , meaning = "I am very sad." } , { latin = "2anaa mariiDa lil2asaf" , arabic = "أَنا مَريضة لِلْأَسَف" , meaning = "I am sick unfortunately." } , { latin = "2ilaa l-laqaa2 yaa Sadiiqii" , arabic = "إِلى الْلِّقاء يا صَديقي" , meaning = "Until next time, my friend." } , { latin = "na3saana" , arabic = "نَعْسانة" , meaning = "sleepy" } , { latin = "mutaHammis" , arabic = "مُتَحَمِّس" , meaning = "excited" } , { latin = "maa 2ismak" , arabic = "ما إِسْمَك" , meaning = "What is your name?" } , { latin = "2ana na3saan" , arabic = "أَنا نَعْسان" , meaning = "I am sleepy." } , { latin = "yallaa 2ilaa l-liqaa2" , arabic = "يَلّإِ إِلى الْلَّقاء" , meaning = "Alriht, until next time." } , { latin = "ma3a as-alaama" , arabic = "مَعَ الْسَّلامة" , meaning = "Goodbye." } , { latin = "tamaam" , arabic = "تَمام" , meaning = "OK" } , { latin = "2ana tamaam al-Hamdu lillah" , arabic = "أَنا تَمام اَلْحَمْدُ لِله" , meaning = "I am OK , praise be to God." } , { latin = "maa al2akhbaar" , arabic = "ما الْأَخْبار" , meaning = "What is new?" } , { latin = "al-bathu alhii" , arabic = "اَلْبَثُ اَلْحي" , meaning = "live broadcast" } , { latin = "2ikhtar" , arabic = "إِخْتَر" , meaning = "choose" } , { latin = "sayyaara" , arabic = "سَيّارة" , meaning = "a car" } , { latin = "2ahlan wa-sahlan" , arabic = "أَهْلاً وَسَهْلاً" , meaning = "welcom" } , { latin = "2akh ghariib" , arabic = "أَخ غَريب" , meaning = "a weird brother" } , { latin = "2ukht muhimma" , arabic = "أُخْت مُهِمّة" , meaning = "an important sister" } , { latin = "ibn kariim wa-mumtaaz" , arabic = "اِبْن كَريم وَمُمْتاز" , meaning = "a generous and amazing son" } , { latin = "2ab" , arabic = "أَب" , meaning = "a father" } , { latin = "2umm" , arabic = "أُمّ" , meaning = "a mother" } , { latin = "abn" , arabic = "اِبْن" , meaning = "a son" } , { latin = "mumti3" , arabic = "مُمْتِع" , meaning = "fun" } , { latin = "muHaasib" , arabic = "مُحاسِب" , meaning = "an accountant" } , { latin = "ma-smika ya 2ustaadha" , arabic = "ما اسْمِك يا أُسْتاذة" , meaning = "Whatis your name ma'am?" } , { latin = "qiTTatak malika" , arabic = "قِطَّتَك مَلِكة" , meaning = "Your cat is a queen." } , { latin = "jadda laTiifa wa-jadd laTiif" , arabic = "جَدّة لَطيفة وَجَدّ لَطيف" , meaning = "a kind grandmother and a kind grandfather" } , { latin = "qiTTa jadiida" , arabic = "قِطّة جَديدة" , meaning = "a new cat" } , { latin = "hal jaddatak 2ustaadha" , arabic = "هَل جَدَّتَك أُسْتاذة" , meaning = "Is your grandmother a professor?" } , { latin = "hal zawjatak 2urduniyya" , arabic = "هَل زَوْجَتَك أُرْدُنِتّة" , meaning = "Is your wife a Jordanian?" } , { latin = "mu3allim" , arabic = "مُعَلِّم" , meaning = "a teacher" } , { latin = "dhakiyya" , arabic = "ذَكِيّة" , meaning = "smart" } , { latin = "jaaratii" , arabic = "جارَتي" , meaning = "my neighbor" } , { latin = "ma3Taf" , arabic = "مَعْطَف" , meaning = "a coat" } , { latin = "qubba3a zarqaa2 wa-bunniyya" , arabic = "قُبَّعة زَرْقاء وَبُنّية" , meaning = "a blue ad brown hat" } , { latin = "bayDaa2" , arabic = "بَيْضاء" , meaning = "white" } , { latin = "al-2iijaar jayyd al-Hamdu lila" , arabic = "اَلْإِيجار جَيِّد اَلْحَمْدُ لِله" , meaning = "The rent is good, praise be to God." } , { latin = "jaami3a ghaalya" , arabic = "جامِعة غالْية" , meaning = "an expensive university" } , { latin = "haadhaa Saaluun qadiim" , arabic = "هَذا صالون قَديم" , meaning = "This is an old living room." } , { latin = "haadhihi Hadiiqa 3arabiyya" , arabic = "هَذِهِ حَديقة عَرَبِيّة" , meaning = "" } , { latin = "al-HaaiT" , arabic = "اَلْحائِط" , meaning = "the wall" } , { latin = "hunaak shanTa Saghiira" , arabic = "هُناك شَنطة صَغيرة" , meaning = "There is a small bag." } , { latin = "2abii hunaak" , arabic = "أَبي هُناك" , meaning = "My father is there." } , { latin = "haatifak hunaak yaa buub" , arabic = "هاتِفَك هُناك يا بوب" , meaning = "Your telephone is there, Bob." } , { latin = "haatifii hunaak" , arabic = "هاتِفي هُناك" , meaning = "My telephone is there." } , { latin = "hunaak 3ilka wa-laab tuub fii shanTatik" , arabic = "هُناك عِلكة وَلاب توب في شَنطَتِك" , meaning = "There is a chewing gum and a laptop in your bag." } , { latin = "raSaaS" , arabic = "رَصاص" , meaning = "lead" } , { latin = "qalam raSaaS" , arabic = "قَلَم رَصاص" , meaning = "a pencil" } , { latin = "mu2al-lif" , arabic = "مُؤَلِّف" , meaning = "an author" } , { latin = "shaahid al-bath il-Hayy" , arabic = "شاهد البث الحي" , meaning = "Watch the live braodcast" } , { latin = "Tayyib" , arabic = "طَيِّب" , meaning = "Ok, good" } , { latin = "2ahlan wa-sahlan" , arabic = "أَهْلاً وَسَهْلاً" , meaning = "Welcome." } , { latin = "2a3iish" , arabic = "أَعيش" , meaning = "I live" } , { latin = "2a3iish fi l-yaabaan" , arabic = "أَعيش في لايابان" , meaning = "I live in Japan." } , { latin = "2ana 2ismii faaTima" , arabic = "أَنا إِسمي فاطِمة" , meaning = "My name is <NAME>." } , { latin = "2a3iish fii miSr" , arabic = "أَعيش في مِصر" , meaning = "I live in Egypt." } , { latin = "al3mr" , arabic = "العمر" , meaning = "age" } , { latin = "2ukhtii wa-Sadiiqhaa juurj" , arabic = "أُخْتي وَصَديقهل جورْج" , meaning = "my sister and her friend George" } , { latin = "3amalii wa-eamala" , arabic = "عَمَلي وَعَمَله" , meaning = "my work and his work" } , { latin = "haadhihi Sadiiqat-hu saamiya" , arabic = "هَذِهِ صَديقَتهُ سامية" , meaning = "This is his girlfriend <NAME>ia." } ]
true
module Arabic001 exposing (main) -- 2020-05-10 07:40:28 -- backup because I am makeing "kana" entry in the data import Browser import Html exposing (..) import Html.Attributes as HA import Html.Events as HE import Random main : Program () Model Msg main = Browser.element { init = init , update = update , subscriptions = subscriptions , view = view } type alias Model = { latin : String , arabic : String , meaning : String , showanswer : Bool , list : List Arabicdata } type alias Arabicdata = { latin : String , arabic : String , meaning : String } init : () -> ( Model, Cmd Msg ) init _ = ( Model "" "" "" False dict , Random.generate NewList (shuffle dict) ) type Msg = Delete | Next | NewRandom Int | Shuffle | NewList (List Arabicdata) | ShowAnswer Int update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Delete -> ( model , Cmd.none ) Next -> ( model , Cmd.none ) NewRandom n -> case List.drop n dict of x :: _ -> ( { model | latin = x.latin , arabic = x.arabic , meaning = x.meaning } , Cmd.none ) [] -> ( model , Cmd.none ) Shuffle -> ( model , Random.generate NewList (shuffle dict) ) NewList newList -> ( { model | list = newList } , Cmd.none ) ShowAnswer index -> case List.drop index model.list of x :: _ -> ( { model | latin = x.latin , arabic = x.arabic , meaning = x.meaning , showanswer = True } , Cmd.none ) [] -> ( model , Cmd.none ) subscriptions : Model -> Sub Msg subscriptions model = Sub.none view : Model -> Html Msg view model = div [] [ text "Convert latin to arabic" , p [] [ text "SabaaH" ] , button [] [ text "Show Answer" ] , button [] [ text "Delete" ] , button [] [ text "Next" ] ] shuffle : List a -> Random.Generator (List a) shuffle list = let randomNumbers : Random.Generator (List Int) randomNumbers = Random.list (List.length list) <| Random.int Random.minInt Random.maxInt zipWithList : List Int -> List ( a, Int ) zipWithList intList = List.map2 Tuple.pair list intList listWithRandomNumbers : Random.Generator (List ( a, Int )) listWithRandomNumbers = Random.map zipWithList randomNumbers sortedGenerator : Random.Generator (List ( a, Int )) sortedGenerator = Random.map (List.sortBy Tuple.second) listWithRandomNumbers in Random.map (List.map Tuple.first) sortedGenerator dict = [ { latin = "alssalaamu" , arabic = "اَلسَّلَامُ" , meaning = "peace" } , { latin = "2alaykum" , arabic = "عَلَيْكُمْ" , meaning = "on you" } , { latin = "SabaaH" , arabic = "صَبَاح" , meaning = "morning" } , { latin = "marhaban" , arabic = "مَرْحَبًا" , meaning = "Hello" } , { latin = "thaqaafah" , arabic = "ثَقافَة" , meaning = "culture" } , { latin = "2anaa bikhayr" , arabic = "أَنا بِخَيْر" , meaning = "I'm fine" } , { latin = "kabir" , arabic = "كَبير" , meaning = "large, big" } , { latin = "kabirah" , arabic = "كبيرة" , meaning = "large, big" } , { latin = "bayt" , arabic = "بَيْت" , meaning = "a house" } , { latin = "laysa" , arabic = "لِيْسَ" , meaning = "do not" } , { latin = "3and" , arabic = "عَنْد" , meaning = "have" } , { latin = "siith" , arabic = "سيث" , meaning = "Seth(male name)" } , { latin = "baluuzah" , arabic = "بَلوزة" , meaning = "blouse" } , { latin = "tii shiirt" , arabic = "تي شيرْت" , meaning = "T-shirt" } , { latin = "mi3Taf" , arabic = "مِعْطَف" , meaning = "a coat" } , { latin = "riim" , arabic = "ريم" , meaning = "Reem(name)" } , { latin = "tannuura" , arabic = "تَنّورة" , meaning = "a skirt" } , { latin = "jadiid" , arabic = "جَديد" , meaning = "new" } , { latin = "wishshaaH" , arabic = "وِشَاح" , meaning = "a scarf" } , { latin = "judii" , arabic = "جودي" , meaning = "Judy(name)" } , { latin = "jamiil" , arabic = "جَميل" , meaning = "good, nice, pretty, beautiful" } , { latin = "kalb" , arabic = "كَلْب" , meaning = "a dog" } , { latin = "2azraq" , arabic = "أَزْرَق" , meaning = "blue" } , { latin = "2abyaD" , arabic = "أَبْيَض " , meaning = "white" } , { latin = "qubb3a" , arabic = "قُبَّعة" , meaning = "a hat" } , { latin = "bunniyy" , arabic = "بُنِّيّ" , meaning = "brown" } , { latin = "mruu2a" , arabic = "مْروءة" , meaning = "chivalry" } , { latin = "kitaab" , arabic = "كِتاب" , meaning = "a book" } , { latin = "Taawilah" , arabic = "طاوِلة" , meaning = "a table" } , { latin = "hadhihi madiinA qadiima" , arabic = "هَذِهِ مَدينة قَديمة" , meaning = "This is an ancient city" } , { latin = "Hadiiqa" , arabic = "حَديقة" , meaning = "garden" } , { latin = "hadhihi HadiiqA 3arabyya" , arabic = "هَذِهِ حَديقة عَرَبيّة" , meaning = "This is an Arab garden" } , { latin = "hadhihi binaaya jamiila" , arabic = "هَذِهِ بِناية جَميلة" , meaning = "This is a beautiful building" } , { latin = "hadhaa muhammad" , arabic = "هَذا مُحَمَّد" , meaning = "This is mohamed" } , { latin = "hadhaa Saaluun ghaalii" , arabic = "هَذا صالون غالي" , meaning = "This is an expensive living room" } , { latin = "hadhihi HadiiqA jamiila" , arabic = "هَذِهِ حَديقة جَميلة" , meaning = "This is a pretty garden" } , { latin = "hadhihi HadiiqA qadiima" , arabic = "هَذِهِ حَديقة قَديمة" , meaning = "This is an old garden" } , { latin = "alHa2iT" , arabic = "الْحائط" , meaning = "the wall" } , { latin = "Ha2iT" , arabic = "حائِط" , meaning = "wall" } , { latin = "hadhaa alHaa2iT kabiir" , arabic = "هَذا الْحائِط كَبير " , meaning = "this wall is big" } , { latin = "alkalb" , arabic = "الْكَلْب" , meaning = "the dog" } , { latin = "hadhihi albinaaya" , arabic = "هذِهِ الْبِناية " , meaning = "this building" } , { latin = "al-ghurfa" , arabic = "اَلْغُرفة" , meaning = "the room" } , { latin = "alghurfA kaBiira" , arabic = "اَلْغرْفة كَبيرة" , meaning = "Theroom is big" } , { latin = "hadhihi alghurfa kabiira" , arabic = "هَذِهِ الْغُرْفة كَبيرة" , meaning = "this room is big" } , { latin = "hadhaa alkalb kalbii" , arabic = "هَذا الْكَلْب كَْلبي" , meaning = "this dog is my dog" } , { latin = "hadhaa alkalb jaw3aan" , arabic = "هَذا الْكَلْب جَوْعان" , meaning = "this dog is hungry" } , { latin = "hadhihi albinaaya waas3a" , arabic = "هَذِهِ الْبناية واسِعة" , meaning = "this building is spacious" } , { latin = "alkalb ghariib" , arabic = "اَلْكَلْب غَريب" , meaning = "The dog is weird" } , { latin = "alkalb kalbii" , arabic = "اَلْكَلْب كَلْبي" , meaning = "The dog is my dog" } , { latin = "hunaak" , arabic = "هُناك" , meaning = "there" } , { latin = "hunaak bayt" , arabic = "هُناك بَيْت" , meaning = "There is a house" } , { latin = "albayt hunaak" , arabic = "اَلْبَيْت هُناك" , meaning = "The house is there" } , { latin = "hunaak wishaaH 2abyaD" , arabic = "هُناك وِشاح أبْيَض" , meaning = "There is a white scarf" } , { latin = "alkalb munaak" , arabic = "اَلْكَلْب مُناك" , meaning = "The dog is there" } , { latin = "fii shanTatii" , arabic = "في شَنْطَتي" , meaning = "in my bag" } , { latin = "hal 3indak maHfaDHA yaa juurj" , arabic = "هَل عِنْدَك مَحْفَظة يا جورْج" , meaning = "do you have a wallet , george" } , { latin = "3indii shanTa ghaalya" , arabic = "عِنْدي شَنْطة غالْية" , meaning = "I have an expensive bag" } , { latin = "shanTatii fii shanTatik ya raanya" , arabic = "شِنْطَتي في شَنْطتِك يا رانْيا" , meaning = "my bag is in your bag rania" } , { latin = "huunak maHfaDhA Saghiira" , arabic = "هُناك مَحْفَظة صَغيرة" , meaning = "There is a small wallet" } , { latin = "hunaak kitab jadiid" , arabic = "هَناك كِتاب جَديد" , meaning = "There is a new book" } , { latin = "hunaak kitaab Saghiir" , arabic = "هُناك كِتاب صَغير" , meaning = "There is a small book" } , { latin = "hunaak qubba3A fii shanTatak yaa bob" , arabic = "هُناك قُبَّعة في شَنْطَتَك يا بوب" , meaning = "There is a hat in your bag bob" } , { latin = "hunaak shanTa Saghiira" , arabic = "هُناك شَنْطة صَغيرة" , meaning = "There is a small bag"f } , { latin = "shanTatii hunaak" , arabic = "شَنْطَتي هُناك" , meaning = "my bag is over there" } , { latin = "hunaak kitaab Saghiir wawishaaH Kabiir fii ShanTatii" , arabic = "هُناك كِتاب صَغير وَوِشاح كَبير في شَنْطَتي" , meaning = "There is a small book and a big scarf in my bag" } , { latin = "hunaak maHfaTa Saghiir fii ShanTatii" , arabic = "هُناك مَحْفَظة صَغيرة في شَنْطَتي" , meaning = "There is a small wallet in my bag" } , { latin = "aljaami3a hunaak" , arabic = "اَلْجامِعة هُناك" , meaning = "The university is there" } , { latin = "hunaak kitaab" , arabic = "هُناك كِتاب" , meaning = "There is a book" } , { latin = "almadiina hunaak" , arabic = "اَلْمَدينة هُناك" , meaning = "Thecity is there" } , { latin = "hal 3indik shanTa ghaalya ya Riim" , arabic = "هَل عِندِك شَنْطة غالْية يا ريم" , meaning = "do you have an expensive bag Reem" } , { latin = "hal 3indik mashruub ya saamya" , arabic = "هَل عِنْدِك مَشْروب يا سامْية" , meaning = "do you have a drink samia" } , { latin = "hunaak daftar rakhiiS" , arabic = "هُناك دَفْتَر رَخيص" , meaning = "There is a cheep notebook" } , { latin = "laysa 3indii daftar" , arabic = "لَيْسَ عِنْدي دَفْتَر" , meaning = "I do not have a notebook" } , { latin = "laysa hunaak masharuub fii shanTatii" , arabic = "لَيْسَ هُناك مَشْروب في شَنْطَتي" , meaning = "There is no drink in my bag" } , { latin = "laysa hunaak kitaab qaSiir fii baytii" , arabic = "لَيْسَ هُناك كِتاب قَصير في بَيْتي" , meaning = "There is no short book in my house" } , { latin = "laysa hunaak daftar rakhiiS" , arabic = "لَيْسَ هُناك دَفْتَر رَخيص" , meaning = "There is no cheap notebook" } , { latin = "laysa 3indii sii dii" , arabic = "لَيْسَ عَنْدي سي دي" , meaning = "I do not have a CD" } , { latin = "laysa hunaak qalam fii shanTatii" , arabic = "لَيْسَ هُناك قَلَم في شَنْطَتي" , meaning = "There is no pen in my bag" } , { latin = "laysa hunaak kitaab qaSiir fii shanTatii" , arabic = "لَيْسَ هُناك كِتاب قَصير في شَنْطَتي" , meaning = "There is no short book in my bag" } , { latin = "laysa hunaak daftar 2abyaD" , arabic = "لَيْسَ هُناك دَفْتَر أَبْيَض" , meaning = "There is no white notebook." } , { latin = "maTbakh" , arabic = "مَطْبَخ" , meaning = "a kitchen" } , { latin = "3ilka" , arabic = "عِلْكة" , meaning = "gum" } , { latin = "miftaaH" , arabic = "مفْتاح" , meaning = "a key" } , { latin = "tuub" , arabic = "توب" , meaning = "top" } , { latin = "nuquud" , arabic = "نُقود" , meaning = "money" } , { latin = "aljazeera" , arabic = "الجزيرة" , meaning = "Al Jazeera" } , { latin = "kayfa" , arabic = "كَيْفَ" , meaning = "how" } , { latin = "kursii" , arabic = "كَرْسي" , meaning = "a chair" } , { latin = "sari3" , arabic = "سَريع" , meaning = "fast" } , { latin = "Haasuub" , arabic = "حاسوب" , meaning = "a computer" } , { latin = "maktab" , arabic = "مَكْتَب" , meaning = "office" } , { latin = "hadhaa maktab kabiir" , arabic = "هَذا مَِكْتَب كَبير" , meaning = "This is a big office" } , { latin = "kursii alqiTTa" , arabic = "كُرْسي الْقِطّة" , meaning = "the cat's chair" } , { latin = "Haasuub al2ustaadha" , arabic = "حاسوب اَلْأُسْتاذة" , meaning = "professor's computer" } , { latin = "kursii jadiid" , arabic = "كُرْسي جَديد" , meaning = "a new chair" } , { latin = "alHamdu lilh" , arabic = "اَلْحَمْدُ لِله" , meaning = "Praise be to God" } , { latin = "SaHiifa" , arabic = "صَحيفة" , meaning = "newspaper" } , { latin = "raqam" , arabic = "رَقَم" , meaning = "number" } , { latin = "haatif" , arabic = "هاتِف" , meaning = "phone" } , { latin = "2amriikiyy" , arabic = "أمْريكِي" , meaning = "American" } , { latin = "2amriikaa wa-as-siin" , arabic = "أَمْريكا وَالْصّين" , meaning = "America and China" } , { latin = "qahwa" , arabic = "قَهْوة" , meaning = "coffee" } , { latin = "Haliib" , arabic = "حَليب" , meaning = "milk" } , { latin = "muuza" , arabic = "موزة" , meaning = "a banana" } , { latin = "2akl" , arabic = "أَكْل" , meaning = "food" } , { latin = "2akl 3arabyy waqahwA 3arabyy" , arabic = "أَكْل عَرَبيّ وَقَهْوة عَرَبيّة" , meaning = "Arabic food and Arabic coffee" } , { latin = "ruzz" , arabic = "رُزّ" , meaning = "rice" } , { latin = "ruzzii waqahwatii" , arabic = "رُزّي وَقَهْوَتي" , meaning = "my rice and my coffee" } , { latin = "qahwatii fii shanTatii" , arabic = "قَهْوَتي في شَنْطَتي" , meaning = "My coffee is in my bag" } , { latin = "qahwaA siith" , arabic = "قَهْوَة سيث" , meaning = "Seth's coffee" } , { latin = "Sadiiqathaa" , arabic = "صَديقَتها" , meaning = "her friend" } , { latin = "jaarat-haa" , arabic = "جارَتها" , meaning = "her neighbor" } , { latin = "2a3rif" , arabic = "أَعْرِف" , meaning = "I know ..." } , { latin = "2ukhtii" , arabic = "أُخْتي" , meaning = "my sister" } , { latin = "Sadiiqa Jayyida" , arabic = "صَديقة جَيِّدة" , meaning = "a good friend" }أ , { latin = "2a3rif" , arabic = "أَعْرِف" , meaning = "I know" } , { latin = "2anaa 2a3rifhu" , arabic = "أَنا أَعْرِفه" , meaning = "I know him" } , { latin = "Taaawila Tawiila" , arabic = "طاوِلة طَويلة" , meaning = "long table" } , { latin = "baytik wabaythaa" , arabic = "بَيْتِك وَبَيْتها" , meaning = "your house and her house" } , { latin = "ism Tawiil" , arabic = "اِسْم طَويل" , meaning = "long name" } , { latin = "baytii wabaythaa" , arabic = "بَيْتي وَبَيْتها" , meaning = "my house and her house" } , { latin = "laysa hunaak lugha Sa3ba" , arabic = "لَيْسَ هُناك لُغة صَعْبة" , meaning = "There is no diffcult language." } , { latin = "hadhaa shay2 Sa3b" , arabic = "هَذا شَيْء صَعْب" , meaning = "This is a difficult thing." } , { latin = "ismhu taamir" , arabic = "اِسْمهُ تامِر" , meaning = "His name is Tamer." } , { latin = "laa 2a3rif 2ayn bayt-hu" , arabic = "لا أَعْرِف أَيْن بَيْته" , meaning = "I don't know where his house is" } , { latin = "laa 2a3rif 2ayn 2anaa" , arabic = "لا أعرف أين أنا." , meaning = "I don't know where I am." } , { latin = "baythu qariib min aljaami3at" , arabic = "بيته قريب من الجامعة" , meaning = "His house is close to the university" } , { latin = "ismhaa arabyy" , arabic = "إسمها عربي" , meaning = "Her name is arabic." } , { latin = "Sadiiqathu ruuzaa qariibhu min baythu" , arabic = "صديقته روزا قريبه من بيته" , meaning = "His friend PI:NAME:<NAME>END_PI is close to his house." } , { latin = "ismhu Tawiil" , arabic = "إسمه طويل" , meaning = "His name is long." } , { latin = "riim Sadiiqat Sa3bat" , arabic = "ريم صديقة صعبة" , meaning = "Reem is a difficult friend." } , { latin = "ismhu bashiir" , arabic = "إسمه بشير" , meaning = "HIs name is Bashir." } , { latin = "ismhaa Tawiil" , arabic = "إسمها طويل" , meaning = "Her name is long." } , { latin = "Sadiiqhaa buub qariib min baythaa" , arabic = "صديقها بوب قريب من بيتها" , meaning = "Her friend PI:NAME:<NAME>END_PI is close to her house." } , { latin = "ismhu PI:NAME:<NAME>END_PI" , arabic = "إسمه بوب" , meaning = "His name is PI:NAME:<NAME>END_PI." } , { latin = "baythu qariib min baythaa" , arabic = "بيته قريب من بيتها" , meaning = "His house is close to her house." } , { latin = "hadhaa shay2 Sa3b" , arabic = "هذا شيء صعب" , meaning = "This is a difficult thing." } , { latin = "3alaaqa" , arabic = "عَلاقَة" , meaning = "relationship" } , { latin = "alqiTTa" , arabic = "اَلْقِطّة" , meaning = "the cat" } , { latin = "la 2uhib" , arabic = "لا أُحِب" , meaning = "I do not like" } , { latin = "al2akl mumti3" , arabic = "اَلْأَكْل مُمْتع" , meaning = "Eating is fun." } , { latin = "alqiraa2a" , arabic = "اَلْقِراءة" , meaning = "reading" } , { latin = "alkitaaba" , arabic = "الْكِتابة" , meaning = "writing" } , { latin = "alkiraa2a wa-alkitaaba" , arabic = "اَلْقِراءة وَالْكِتابة" , meaning = "reading and writing" } , { latin = "muhimm" , arabic = "مُهِمّ" , meaning = "important" } , { latin = "alkiaaba shay2 muhimm" , arabic = "اَلْكِتابة شَيْء مُهِمّ" , meaning = "Writing is an important thing." } , { latin = "aljara wa-alqiTTa" , arabic = "اَلْجارة وَالْقِطّة" , meaning = "the neighbor and the cat" } , { latin = "qiTTa wa-alqiTTa" , arabic = "قِطّة وَالْقِطّة" , meaning = "a cat and the cat" } , { latin = "2ayDaan" , arabic = "أَيْضاً" , meaning = "also" } , { latin = "almaT3m" , arabic = "الْمَطْعْم" , meaning = "the restaurant" } , { latin = "aljarii" , arabic = "اَلْجَري" , meaning = "the running" } , { latin = "maa2" , arabic = "ماء" , meaning = "water" } , { latin = "maT3am" , arabic = "مَطْعَم" , meaning = "a restaurant" } , { latin = "alttaSwiir" , arabic = "اَلْتَّصْوير" , meaning = "photography" } , { latin = "alnnawm" , arabic = "اَلْنَّوْم" , meaning = "sleeping" } , { latin = "as-sibaaha" , arabic = "اَلْسِّباحة" , meaning = "swimming" } , { latin = "Sabaahaan 2uhibb al2akl hunaa" , arabic = "صَباحاً أُحِبّ اَلْأَكْل هُنا" , meaning = "Inn the morning, I like eating here." } , { latin = "kathiiraan" , arabic = "كَثيراً" , meaning = "much" } , { latin = "hunaa" , arabic = "هُنا" , meaning = "here" } , { latin = "jiddan" , arabic = "جِدَّاً" , meaning = "very" } , { latin = "3an" , arabic = "عَن" , meaning = "about" } , { latin = "2uhibb al-ssafar 2ilaa 2iiiTaaliiaa" , arabic = "أُحِبّ اَلْسَّفَر إِلى إيطالْيا" , meaning = "I like traveling to Italy." } , { latin = "alkalaam ma3a 2abii" , arabic = "اَلْكَلام مَعَ أَبي" , meaning = "talking with my father" } , { latin = "alkalaam ma3a 2abii ba3d alDHDHahr" , arabic = "اَلْكَلام معَ أَبي بَعْد اَلْظَّهْر" , meaning = "talking with my father in the afternoon" } , { latin = "2uhibb alssafar 2ilaa 2almaaniiaa" , arabic = "أُحِب اَلْسَّفَر إِلى أَلْمانيا" , meaning = "I like travelling to Germany" } , { latin = "2uHibb aljarii bialllyl" , arabic = "أُحِبّ اَلْجَري بِالْلَّيْل" , meaning = "I like running at night." } , { latin = "2uriidu" , arabic = "أُريدُ" , meaning = "I want" } , { latin = "2uHibb 2iiiTaaliiaa 2ayDan" , arabic = "أُحِبّ إيطاليا أَيْضاً" , meaning = "I like Italy also." } , { latin = "2uHibb alnnawm ba3d alDHDHhr" , arabic = "أحِبّ اَلْنَّوْم بَعْد اَلْظَّهْر" , meaning = "I like sleeping in the afternoon." } , { latin = "2uHibb alqiraa2a 3an kuubaa biaalllayl" , arabic = "أُحِبّ اَلْقِراءة عَن كوبا بِالْلَّيْل" , meaning = "I like to read about Cuba at night." } , { latin = "2uHibb alkalaam 3an alkitaaba" , arabic = "أحِبّ اَلْكَلام عَن اَلْكِتابة" , meaning = "I like talking about writing." } , { latin = "alqur2aan" , arabic = "اَلْقُرْآن" , meaning = "Koran" } , { latin = "bayt jamiil" , arabic = "بَيْت جَميل" , meaning = "a pretty house" } , { latin = "bint suuriyya" , arabic = "بِنْت سورِيّة" , meaning = "a Syrian girl" } , { latin = "mutarjim mumtaaz" , arabic = "مُتَرْجِم مُمْتاز" , meaning = "an amazing translator" } , { latin = "jaami3a mashhuura" , arabic = "جامِعة مَشْهورة" , meaning = "a famous university" } , { latin = "al-bayt al-jamiil" , arabic = "اَلْبَيْت اَلْجَميل" , meaning = "the pretty house" } , { latin = "al-bint al-ssuuriyya" , arabic = "اَلْبِنْت اَلْسّورِيّة" , meaning = "a Syrian girl" } , { latin = "al-mutarjim al-mumtaaz" , arabic = "اَلْمُتَرْجِم اَلْمُمْتاز" , meaning = "the amazing translator" } , { latin = "al-jaami3a al-mashhuura" , arabic = "اَلْجامِعة اَلْمَشْهورة" , meaning = "the famous university" } , { latin = "al-bayt jamiil" , arabic = "اَلْبَيْت جَميل" , meaning = "The house is pretty." } , { latin = "al-bint suuriyya" , arabic = "البنت سورِيّة" , meaning = "The girl is Syrian." } , { latin = "al-mutarjim mumtaaz" , arabic = "اَلْمُتَرْجِم مُمْتاز" , meaning = "The translator is amazing." } , { latin = "al-jaami3a mashhuura" , arabic = "اَلْجامِعة مَشْهورة" , meaning = "" } , { latin = "Haarr" , arabic = "حارّ" , meaning = "hot" } , { latin = "maTar" , arabic = "مَطَر" , meaning = "rain" } , { latin = "yawm Tawiil" , arabic = "يَوْم طَويل" , meaning = "a long day" } , { latin = "Taqs baarid" , arabic = "طَقْس بارِد" , meaning = "cold weather" } , { latin = "haathaa yawm Tawiil" , arabic = "هَذا يَوْم طَويل" , meaning = "This is a long day." } , { latin = "shanTa fafiifa" , arabic = "شَنْطة خَفيفة" , meaning = "a light bag" } , { latin = "mi3Taf khafiif" , arabic = "مِعْطَف خَفيف" , meaning = "a light coat" } , { latin = "al-maTar al-ththaqiil mumtaaz" , arabic = "اَلْمَطَر اَلْثَّقيل مُمْتاز" , meaning = "The heavy rain is amazing." } , { latin = "Taqs ghariib" , arabic = "طَقْس غَريب" , meaning = "a weird weather" } , { latin = "yawm Haarr" , arabic = "يَوْم حارّ" , meaning = "a hot day" } , { latin = "maTar khafiif" , arabic = "مَطَر خفيف" , meaning = "a light rain" } , { latin = "Taawila khafiifa" , arabic = "طاوِلة خَفيفة" , meaning = "a light table" } , { latin = "Taqs jamiil" , arabic = "طَقْس جَميل" , meaning = "a pretty weather" } , { latin = "al-maTar al-ththaqiil mumtaaz" , arabic = "اَلْمَطَر اَلْثَّقيل مُمْتاز" , meaning = "The heavy rain is amazing." } , { latin = "haathaa yawm Haarr" , arabic = "هَذا يَوْم حارّ" , meaning = "This is a hot day." } , { latin = "shanTa khafiifa" , arabic = "شَنْطة خَفيفة" , meaning = "a light bag" } , { latin = "hunaak maTar baarid jiddan" , arabic = "هُناك مَطَر بارِد جِدّاً" , meaning = "There is a very cold rain." } , { latin = "Sayf" , arabic = "صّيْف" , meaning = "summer" } , { latin = "shitaa2" , arabic = "شِتاء" , meaning = "winter" } , { latin = "thitaa2 baarid" , arabic = "شِتاء بارِد" , meaning = "cold winter" } , { latin = "binaaya 3aalya" , arabic = "بِناية عالْية" , meaning = "a high building" } , { latin = "yawm baarid" , arabic = "يَوْم بارِد" , meaning = "a cold day" } , { latin = "alyawm yawm baarid" , arabic = "اَلْيَوْم يَوْم بارِد" , meaning = "Today is a cold day." } , { latin = "ruTwwba 3aalya" , arabic = "رُطوبة عالْية" , meaning = "high humidity" } , { latin = "al-rruTuuba al-3aalya" , arabic = "اَلْرَّطوبة الْعالْية" , meaning = "the high humidity" } , { latin = "Sayf mumTir" , arabic = "صَيْف مُمْطِر" , meaning = "a rainy summer" } , { latin = "al-rruTuuba al3aalya" , arabic = "اَلْرُّطوبة الْعالْية" , meaning = "the high humidity" } , { latin = "al-TTaqs al-mushmis" , arabic = "اّلْطَّقْس الّْمُشْمِس" , meaning = "the sunny weather" } , { latin = "shitaa2 mumTir" , arabic = "شِتاء مُمْطِر" , meaning = "a rainy winter" } , { latin = "Sayf Haarr" , arabic = "صَيْف حارّ" , meaning = "a hot summer" } , { latin = "al-yawm yawm Tawiil" , arabic = "اَلْيَوْم يَوْم طَويل" , meaning = "Today is a long day." } , { latin = "laa 2uhibb al-Taqs al-mushmis" , arabic = "لا أُحِبّ اَلْطَقْس اَلْمُشْمِس" , meaning = "I do not like sunny weather." } , { latin = "al-Taqs mumTir jiddan al-yawm" , arabic = "اَلْطَقْس مُمْطِر جِدّاً اَلْيَوْم" , meaning = "The weather is very rainy today." } , { latin = "laa 2uhibb al-TTaqs al-mumTir" , arabic = "لا أحِبّ اَلْطَّقْس اَلْمُمْطِر" , meaning = "I do not like the rainy weather." } , { latin = "al-TTaqs mushmis al-yawm" , arabic = "اَلْطَّقْس مُشْمِس اَلْيَوْم" , meaning = "The weather is sunny today." } , { latin = "khariif" , arabic = "خَريف" , meaning = "fall, autumn" } , { latin = "qamar" , arabic = "قَمَر" , meaning = "moon" } , { latin = "rabiir" , arabic = "رَبيع" , meaning = "spring" } , { latin = "al-shishitaa2 mumTir" , arabic = "اَلْشِّتاء مُمْطِر" , meaning = "The winter is rainy." } , { latin = "al-SSayf al-baarid" , arabic = "اَلْصَّيْف اَلْبارِد" , meaning = "the cold summer" } , { latin = "al-qamar al-2abyab" , arabic = "اَلْقَمَر اَلْأَبْيَض" , meaning = "the white moon" } , { latin = "al-shishitaa2 Tawiil wa-baarid" , arabic = "اَلْشِّتاء طَويل وَبارِد" , meaning = "The winter is long and cold." } , { latin = "al-rrabii3 mumTir al-aan" , arabic = "اَلْرَّبيع مُمْطِر اَلآن" , meaning = "The winter is rainy now" } , { latin = "Saghiir" , arabic = "صَغير" , meaning = "small" } , { latin = "kashiiran" , arabic = "كَثيراً" , meaning = "a lot, much" } , { latin = "al-ssuudaan" , arabic = "اَلْسّودان" , meaning = "Sudan" } , { latin = "as-siin" , arabic = "اَلْصّين" , meaning = "China" } , { latin = "al-qaahira" , arabic = "اَلْقاهِرة" , meaning = "Cairo" } , { latin = "al-bunduqiyya" , arabic = "اَلْبُنْدُقِية" , meaning = "Venice" } , { latin = "filasTiin" , arabic = "فِلَسْطين" , meaning = "Palestine" } , { latin = "huulandaa" , arabic = "هولَنْدا" , meaning = "Netherlands" } , { latin = "baghdaad" , arabic = "بَغْداد" , meaning = "Bagdad" } , { latin = "Tuukyuu" , arabic = "طوكْيو" , meaning = "Tokyo" } , { latin = "al-yaman" , arabic = "اَلْيَمَن" , meaning = "Yemen" } , { latin = "SaaHil Tawiil" , arabic = "ساحَل طَويل" , meaning = "a long coast" } , { latin = "al-2urdun" , arabic = "اَلْأُرْدُن" , meaning = "Jordan" } , { latin = "haathaa al-balad" , arabic = "هَذا الْبَلَد" , meaning = "this country" } , { latin = "2ayn baladik yaa riim" , arabic = "أَيْن بَلَدِك يا ريم" , meaning = "Where is your country, Reem?" } , { latin = "baldii mumtaaz" , arabic = "بَلَدي مُمْتاز" , meaning = "My country is amazing." } , { latin = "haathaa balad-haa" , arabic = "هَذا بَلَدها" , meaning = "This is her country." } , { latin = "hal baladak jamiil yaa juurj?" , arabic = "هَل بَلَدَك جَميل يا جورْج" , meaning = "Is your country pretty, George" } , { latin = "al-yaman balad Saghiir" , arabic = "اَلْيَمَن بَلَد صَغير" , meaning = "Yemen is a small country." } , { latin = "qaari2" , arabic = "قارِئ" , meaning = "reader" } , { latin = "ghaa2ib" , arabic = "غائِب" , meaning = "absent" } , { latin = "mas2uul" , arabic = "مَسْؤول" , meaning = "responsoble, administrator" } , { latin = "jaa2at" , arabic = "جاءَت" , meaning = "she came" } , { latin = "3indii" , arabic = "عِنْدي" , meaning = "I have" } , { latin = "3indik" , arabic = "عِنْدِك" , meaning = "you have" } , { latin = "ladii kitaab" , arabic = "لَدي كِتاب" , meaning = "I have a book." } , { latin = "3indhaa" , arabic = "عِنْدها" , meaning = "she has" } , { latin = "3indhu" , arabic = "عِنْدهُ" , meaning = "he has" } , { latin = "laysa 3indhu" , arabic = "لَيْسَ عِنْدهُ" , meaning = "he does not have" } , { latin = "laysa 3indhaa" , arabic = "لَيْسَ عِنْدها" , meaning = "she does not have" } , { latin = "hunaak maTar thaqiil" , arabic = "هُناك مَطَر ثَقيل" , meaning = "There is a heavy rain." } , { latin = "hunaak wishaaH fii shanTatii" , arabic = "هُناك وِشاح في شَنْطتي" , meaning = "There is a scarf in my bag." } , { latin = "laysa hunaak lugha Sa3ba" , arabic = "لَيْسَ هُناك لُغة صَعْبة" , meaning = "There is no difficult language." } , { latin = "2amaamii rajul ghariib" , arabic = "أَمامي رَجُل غَريب" , meaning = "There is a weird man in front of me." } , { latin = "fii al-khalfiyya bayt" , arabic = "في الْخَلفِيْة بَيْت" , meaning = "There is a house in the background." } , { latin = "fii shanTatii wishaaH" , arabic = "في شَنْطَتي وِشاح" , meaning = "There is a scarf in my bag." } , { latin = "asad" , arabic = "أَسَد" , meaning = "a lion" } , { latin = "2uHibb 2asadii laakibb la 2uHibb 2usadhaa" , arabic = "أحِبَ أَسَدي لَكِنّ لا أُحِبّ أَسَدها" , meaning = "I like my lion but I do not like her lion." } , { latin = "laysa 3indhu" , arabic = "لَيْسَ عِنْدهُ" , meaning = "he does not have" } , { latin = "3indhaa kalb wa-qiTTa" , arabic = "عِنْدها كَلْب وَقِطّة" , meaning = "She has a doc and a cat." } , { latin = "Sadiiqatu" , arabic = "صَديقَتهُ سامْية غَنِيّة" , meaning = "His friend PI:NAME:<NAME>END_PI is rich." } , { latin = "taariikhiyya" , arabic = "تاريخِيّة" , meaning = "historical" } , { latin = "juurj 3indhu 3amal mumtaaz" , arabic = "جورْج عِنْدهُ عَمَل مُمْتاز" , meaning = "George has an amazing work." } , { latin = "Sadiiqii taamir ghaniyy jiddan" , arabic = "صَديقي تامِر غَنِيّ جِدّاً" , meaning = "My friend PI:NAME:<NAME>END_PI is very rich" } , { latin = "laa 2a3rif haadhaa l-2asad" , arabic = "لا أَعْرِف هَذا الْأَسّد" , meaning = "I do not know this lion." } , { latin = "laysa 3indhu mi3Taf" , arabic = "لَيْسَ عِنْدهُ مِعْطَف" , meaning = "He does not have a coat." } , { latin = "fii l-khalfiyya zawjatak ya siith" , arabic = "في الْخَلْفِيّة زَوْجَتَك يا سيث" , meaning = "There is your wife in background, Seth" } , { latin = "su2uaal" , arabic = "سُؤال" , meaning = "a question" } , { latin = "Sadiiqat-hu saamya laabisa tannuura" , arabic = "صدَيقَتهُ سامْية لابِسة تّنّورة" , meaning = "His friend Samia is wering a skirt." } , { latin = "wa-hunaa fii l-khalfitta rajul muDHik" , arabic = "وَهُنا في الْخَلْفِتّة رَجُل مُضْحِك" , meaning = "And here in the background there is a funny man." } , { latin = "man haadhaa" , arabic = "مَن هَذا" , meaning = "Who is this?" } , { latin = "hal 2anti labisa wishaaH ya lamaa" , arabic = "هَل أَنْتِ لابِسة وِشاح يا لَمى" , meaning = "Are you wering a scarf, Lama?" } , { latin = "2akhii bashiir mashghuul" , arabic = "أَخي بَشير مَشْغول" , meaning = "My brother PI:NAME:<NAME>END_PI is busy." } , { latin = "fii haadhihi l-s-Suura imraa muDHika" , arabic = "في هَذِهِ الْصّورة اِمْرأة مُضْحِكة" , meaning = "Thre is a funny woman in this picture." } , { latin = "hal 2anta laabis qubb3a ya siith" , arabic = "هَل أَنْتَ لابِس قُبَّعة يا سيث" , meaning = "Are you wearing a hat, Seth?" } , { latin = "fii l-khalfiyya rajul muDHik" , arabic = "في الْخَلْفِيّة رَجُل مُضْحِك" , meaning = "There is a funny man in the background." } , { latin = "shubbaak" , arabic = "شُبّاك" , meaning = "a window" } , { latin = "sariir" , arabic = "سَرير" , meaning = "a bed" } , { latin = "muHammad 2ustaadhii" , arabic = "مُحَمَّد أُسْتاذي" , meaning = "Muhammed is my teacher." } , { latin = "saadii 2ustaadhii" , arabic = "شادي أُسْتاذي" , meaning = "Sadie is my teacher." } , { latin = "2ummhu" , arabic = "أُمّهُ" , meaning = "his mother" } , { latin = "tilfaaz" , arabic = "تِلْفاز" , meaning = "a television" } , { latin = "ma haadhaa as-sawt" , arabic = "ما هَذا الْصَّوْت" , meaning = "What is this noise" } , { latin = "2adkhul al-Hammaam" , arabic = "أَدْخُل اَلْحَمّام" , meaning = "I enter the bathroom." } , { latin = "2uHibb al-ssariir al-kabiir" , arabic = "أُحِبّ اَلْسَّرير اَلْكَبير" , meaning = "I love the big bed." } , { latin = "hunaak mushkila ma3 lt-tilfaaz" , arabic = "هُناك مُشْكِلة مَعَ الْتِّلْفاز" , meaning = "There is a problem with the television." } , { latin = "al-haatif mu3aTTal wa-lt-tilfaaz 2ayDan" , arabic = "اَلْهاتِف مُعَطَّل وَالْتَّلْفاز أَيضاً" , meaning = "The telephone is out of order and the television also." } , { latin = "hunaak Sawt ghariib fii l-maTbakh" , arabic = "هُناك صَوْت غَريب في الْمَطْبَخ" , meaning = "There is a weird nose in the kitchen." } , { latin = "2anaam fii l-ghurfa" , arabic = "أَنام في الْغُرْفة" , meaning = "I sleep in the room." } , { latin = "tilfaaz Saghiir fii Saaluun kabiir" , arabic = "تِلْفاز صَغير في صالون كَبير" , meaning = "a small television in a big living room" } , { latin = "2anaam fii sariir maksuur" , arabic = "أَنام في سَرير مَكْسور" , meaning = "I sleep in a broken bed." } , { latin = "as-sariir al-kabiir" , arabic = "اَلْسَّرير اَلْكَبير" , meaning = "the big bed" } , { latin = "maa haadhaa aSSwut" , arabic = "ما هَذا الصّوُت" , meaning = "What is this noise?" } , { latin = "sariirii mumtaaz al-Hamdu lila" , arabic = "سَريري مُمتاز اَلْحَمْدُ لِله" , meaning = "My bed is amazing, praise be to God" } , { latin = "2anaam kathiiran" , arabic = "أَنام كَشيراً" , meaning = "I sleep a lot" } , { latin = "hunaak Sawt ghariib" , arabic = "هُناك صَوْت غَريب" , meaning = "There is a weird noise." } , { latin = "shubbaak" , arabic = "شُبّاك" , meaning = "a window" } , { latin = "2anaam fii sariir Saghiir" , arabic = "أَنام في سَرير صَغير" , meaning = "I sleep in a small bed." } , { latin = "muHammad 2ustaadhii" , arabic = "مُحَمَّد أُسْتاذي" , meaning = "Muhammad is my teacher." } , { latin = "mahaa 2ummhu" , arabic = "مَها أُمّهُ" , meaning = "Maha is his mother." } , { latin = "fii haadhaa lsh-shaari3 Sawt ghariib" , arabic = "في هٰذا ٱلْشّارِع صَوْت غَريب" , meaning = "There is a weird nose on this street" } , { latin = "2askun fii ls-saaluun" , arabic = "أَسْكُن في الْصّالون" , meaning = "I live in the living room." } , { latin = "haadhaa lsh-shaar3" , arabic = "هَذا الْشّارِع" , meaning = "this street" } , { latin = "fii lT-Taabiq al-2awwal" , arabic = "في الْطّابِق اَلْأَوَّل" , meaning = "on the first floor" } , { latin = "Hammaam" , arabic = "حَمّام" , meaning = "bathroom" } , { latin = "alsh-shaanii" , arabic = "اَلْثّاني" , meaning = "the second" } , { latin = "3and-hu ghurfa nawm Saghiira" , arabic = "عِندهُ غُرْفة نَوْم صَغيرة" , meaning = "He has a small bedroom." } , { latin = "laa 2aftaH albaab bisabab lT-Taqs" , arabic = "لا أَفْتَح اَلْباب بِسَبَب اّلْطَّقْس" , meaning = "I do not open the door because of the weather." } , { latin = "Sifr" , arabic = "صِفْر" , meaning = "zero" } , { latin = "3ashara" , arabic = "عَشَرَة" , meaning = "ten" } , { latin = "waaHid" , arabic = "وَاحِد" , meaning = "one" } , { latin = "2ithnaan" , arabic = "اِثْنان" , meaning = "two" } , { latin = "kayf ta3uddiin min waaHid 2ilaa sitta" , arabic = "كَيْف تَعُدّين مِن ١ إِلى ٦" , meaning = "How do you count from one to six?" } , { latin = "bil-lugha" , arabic = "بِالْلُّغة" , meaning = "in language" } , { latin = "bil-lugha l-3arabiya" , arabic = "بِالْلُّغة الْعَرَبِيّة" , meaning = "in the arabic language" } , { latin = "ta3rifiin" , arabic = "تَعْرِفين" , meaning = "you know" } , { latin = "hal ta3rifiin kull shay2 yaa mahaa" , arabic = "هَل تَعْرِفين كُلّ شَيء يا مَها" , meaning = "Do you know everything Maha?" } , { latin = "kayf ta3udd yaa 3umar" , arabic = "كَيْف تَعُدّ يا عُمَر" , meaning = "How do you count Omar?" } , { latin = "Kayf ta3udd min Sifr 2ilaa 2ashara yaa muHammad" , arabic = "كَيْف تَعُدّ مِن٠ إِلى ١٠ يا مُحَمَّد" , meaning = "How do you count from 0 to 10 , Mohammed?" } , { latin = "hal ta3rif yaa siith" , arabic = "هَل تَعْرِف يا سيث" , meaning = "Do you know Seth?" } , { latin = "bayt buub" , arabic = "بَيْت بوب" , meaning = "Bob's house" } , { latin = "maT3am muHammad" , arabic = "مَطْعَم مُحَمَّد" , meaning = "Mohammed's restaurant" } , { latin = "SaHiifat al-muhandis" , arabic = "صَحيفة اَلْمُهَنْدِس" , meaning = "the enginner's newspaper" } , { latin = "madiinat diitruuyt" , arabic = "مَدينة ديتْرويْت" , meaning = "the city of Detroit" } , { latin = "wilaayat taksaas" , arabic = "وِلاية تَكْساس" , meaning = "the state of Texas" } , { latin = "jaami3at juurj waashinTun" , arabic = "جامِعة جورْج واشِنْطُن" , meaning = "George Washinton University" } , { latin = "shukuran" , arabic = "شُكْراً" , meaning = "thank you" } , { latin = "SabaaHan" , arabic = "صَباحاً" , meaning = "in the morning" } , { latin = "masaa-an" , arabic = "مَساءً" , meaning = "in the evening" } , { latin = "wayaatak" , arabic = "وِلايَتَك" , meaning = "your state" } , { latin = "madiina saaHiliyya" , arabic = "مَدينة ساحِلِيّة" , meaning = "a coastal city" } , { latin = "muzdaHima" , arabic = "مُزْدَحِمة" , meaning = "crowded" } , { latin = "wilaaya kaaliifuurniyaa" , arabic = "وِلاية كاليفورْنْيا" , meaning = "the state of California" } , { latin = "luus 2anjiaalis" , arabic = "لوس أَنْجِلِس" , meaning = "Los Angeles" } , { latin = "baHr" , arabic = "بَحْر" , meaning = "sea" } , { latin = "al-baHr al-2abyaD al-mutawassaT" , arabic = "اَاْبَحْر اَلْأَبْيَض اَلْمُتَوَسِّط" , meaning = "the Meditteranean Sea" } , { latin = "lil2asaf" , arabic = "لٍلْأَسَف" , meaning = "unfortunately" } , { latin = "DawaaHii" , arabic = "ضَواحي" , meaning = "suburbs" } , { latin = "taskuniin" , arabic = "تَسْكُنين" , meaning = "you live" } , { latin = "nyuuyuurk" , arabic = "نْيويورْك" , meaning = "New York" } , { latin = "qaryatik" , arabic = "قَرْيَتِك" , meaning = "your village" } , { latin = "shubbaak" , arabic = "شُبّاك" , meaning = "a window" } , { latin = "jaziira" , arabic = "جَزيرة" , meaning = "an island" } , { latin = "Tabii3a" , arabic = "طَبيعة" , meaning = "nature" } , { latin = "al-2iskandariyya" , arabic = "اَلْإِسْكَندَرِيّة" , meaning = "Alexandria" } , { latin = "miSr" , arabic = "مِصْر" , meaning = "Egypt" } , { latin = "na3am" , arabic = "نَعَم" , meaning = "yes" } , { latin = "SabaaH l-khayr" , arabic = "صَباح اَلْخَيْر" , meaning = "Good morning." } , { latin = "SabaaH an-nuur" , arabic = "صَباح اَلْنّور" , meaning = "Good morning." } , { latin = "masaa2 al-khayr" , arabic = "مَساء اَلْخَيْر" , meaning = "Good evening" } , { latin = "masaa2 an-nuur" , arabic = "مَساء اَلْنّور" , meaning = "Good evening." } , { latin = "as-salaamu 3alaykum" , arabic = "اَلْسَّلامُ عَلَيْكُم" , meaning = "Peace be upon you." } , { latin = "wa-3alaykumu as-salaam" , arabic = "وَعَلَيْكُمُ ٲلْسَّلام" , meaning = "" } , { latin = "tasharrafnaa" , arabic = "تَشَرَّفْنا" , meaning = "It's a pleasure to meet you." } , { latin = "hal 2anta bikhyr" , arabic = "هَل أَنْتَ بِخَيْر" , meaning = "Are you well?" } , { latin = "kayfak" , arabic = "كَيْفَك" , meaning = "How are you?" } , { latin = "al-yawm" , arabic = "اَلْيَوْم" , meaning = "today" } , { latin = "kayfik al-yawm" , arabic = "كَيْفِك اَلْيَوْم" , meaning = "How are you today?" } , { latin = "marHaban ismii buub" , arabic = "مَرْحَباً اِسْمي بوب" , meaning = "Hello, my name is PI:NAME:<NAME>END_PI." } , { latin = "Haziin" , arabic = "حَزين" , meaning = "sad" } , { latin = "mariiD" , arabic = "مَريض" , meaning = "sick" } , { latin = "yawm sa3iid" , arabic = "يَوْم سَعيد" , meaning = "Have a nice day." } , { latin = "sa3iid" , arabic = "سَعيد" , meaning = "happy" } , { latin = "2anaa Haziinat l-yawm" , arabic = "أَنا حَزينة الْيَوْم" , meaning = "I am sad today." } , { latin = "2anaa Haziin jiddan" , arabic = "أَنا حَزين جِدّاً" , meaning = "I am very sad." } , { latin = "2anaa mariiDa lil2asaf" , arabic = "أَنا مَريضة لِلْأَسَف" , meaning = "I am sick unfortunately." } , { latin = "2ilaa l-laqaa2 yaa Sadiiqii" , arabic = "إِلى الْلِّقاء يا صَديقي" , meaning = "Until next time, my friend." } , { latin = "na3saana" , arabic = "نَعْسانة" , meaning = "sleepy" } , { latin = "mutaHammis" , arabic = "مُتَحَمِّس" , meaning = "excited" } , { latin = "maa 2ismak" , arabic = "ما إِسْمَك" , meaning = "What is your name?" } , { latin = "2ana na3saan" , arabic = "أَنا نَعْسان" , meaning = "I am sleepy." } , { latin = "yallaa 2ilaa l-liqaa2" , arabic = "يَلّإِ إِلى الْلَّقاء" , meaning = "Alriht, until next time." } , { latin = "ma3a as-alaama" , arabic = "مَعَ الْسَّلامة" , meaning = "Goodbye." } , { latin = "tamaam" , arabic = "تَمام" , meaning = "OK" } , { latin = "2ana tamaam al-Hamdu lillah" , arabic = "أَنا تَمام اَلْحَمْدُ لِله" , meaning = "I am OK , praise be to God." } , { latin = "maa al2akhbaar" , arabic = "ما الْأَخْبار" , meaning = "What is new?" } , { latin = "al-bathu alhii" , arabic = "اَلْبَثُ اَلْحي" , meaning = "live broadcast" } , { latin = "2ikhtar" , arabic = "إِخْتَر" , meaning = "choose" } , { latin = "sayyaara" , arabic = "سَيّارة" , meaning = "a car" } , { latin = "2ahlan wa-sahlan" , arabic = "أَهْلاً وَسَهْلاً" , meaning = "welcom" } , { latin = "2akh ghariib" , arabic = "أَخ غَريب" , meaning = "a weird brother" } , { latin = "2ukht muhimma" , arabic = "أُخْت مُهِمّة" , meaning = "an important sister" } , { latin = "ibn kariim wa-mumtaaz" , arabic = "اِبْن كَريم وَمُمْتاز" , meaning = "a generous and amazing son" } , { latin = "2ab" , arabic = "أَب" , meaning = "a father" } , { latin = "2umm" , arabic = "أُمّ" , meaning = "a mother" } , { latin = "abn" , arabic = "اِبْن" , meaning = "a son" } , { latin = "mumti3" , arabic = "مُمْتِع" , meaning = "fun" } , { latin = "muHaasib" , arabic = "مُحاسِب" , meaning = "an accountant" } , { latin = "ma-smika ya 2ustaadha" , arabic = "ما اسْمِك يا أُسْتاذة" , meaning = "Whatis your name ma'am?" } , { latin = "qiTTatak malika" , arabic = "قِطَّتَك مَلِكة" , meaning = "Your cat is a queen." } , { latin = "jadda laTiifa wa-jadd laTiif" , arabic = "جَدّة لَطيفة وَجَدّ لَطيف" , meaning = "a kind grandmother and a kind grandfather" } , { latin = "qiTTa jadiida" , arabic = "قِطّة جَديدة" , meaning = "a new cat" } , { latin = "hal jaddatak 2ustaadha" , arabic = "هَل جَدَّتَك أُسْتاذة" , meaning = "Is your grandmother a professor?" } , { latin = "hal zawjatak 2urduniyya" , arabic = "هَل زَوْجَتَك أُرْدُنِتّة" , meaning = "Is your wife a Jordanian?" } , { latin = "mu3allim" , arabic = "مُعَلِّم" , meaning = "a teacher" } , { latin = "dhakiyya" , arabic = "ذَكِيّة" , meaning = "smart" } , { latin = "jaaratii" , arabic = "جارَتي" , meaning = "my neighbor" } , { latin = "ma3Taf" , arabic = "مَعْطَف" , meaning = "a coat" } , { latin = "qubba3a zarqaa2 wa-bunniyya" , arabic = "قُبَّعة زَرْقاء وَبُنّية" , meaning = "a blue ad brown hat" } , { latin = "bayDaa2" , arabic = "بَيْضاء" , meaning = "white" } , { latin = "al-2iijaar jayyd al-Hamdu lila" , arabic = "اَلْإِيجار جَيِّد اَلْحَمْدُ لِله" , meaning = "The rent is good, praise be to God." } , { latin = "jaami3a ghaalya" , arabic = "جامِعة غالْية" , meaning = "an expensive university" } , { latin = "haadhaa Saaluun qadiim" , arabic = "هَذا صالون قَديم" , meaning = "This is an old living room." } , { latin = "haadhihi Hadiiqa 3arabiyya" , arabic = "هَذِهِ حَديقة عَرَبِيّة" , meaning = "" } , { latin = "al-HaaiT" , arabic = "اَلْحائِط" , meaning = "the wall" } , { latin = "hunaak shanTa Saghiira" , arabic = "هُناك شَنطة صَغيرة" , meaning = "There is a small bag." } , { latin = "2abii hunaak" , arabic = "أَبي هُناك" , meaning = "My father is there." } , { latin = "haatifak hunaak yaa buub" , arabic = "هاتِفَك هُناك يا بوب" , meaning = "Your telephone is there, Bob." } , { latin = "haatifii hunaak" , arabic = "هاتِفي هُناك" , meaning = "My telephone is there." } , { latin = "hunaak 3ilka wa-laab tuub fii shanTatik" , arabic = "هُناك عِلكة وَلاب توب في شَنطَتِك" , meaning = "There is a chewing gum and a laptop in your bag." } , { latin = "raSaaS" , arabic = "رَصاص" , meaning = "lead" } , { latin = "qalam raSaaS" , arabic = "قَلَم رَصاص" , meaning = "a pencil" } , { latin = "mu2al-lif" , arabic = "مُؤَلِّف" , meaning = "an author" } , { latin = "shaahid al-bath il-Hayy" , arabic = "شاهد البث الحي" , meaning = "Watch the live braodcast" } , { latin = "Tayyib" , arabic = "طَيِّب" , meaning = "Ok, good" } , { latin = "2ahlan wa-sahlan" , arabic = "أَهْلاً وَسَهْلاً" , meaning = "Welcome." } , { latin = "2a3iish" , arabic = "أَعيش" , meaning = "I live" } , { latin = "2a3iish fi l-yaabaan" , arabic = "أَعيش في لايابان" , meaning = "I live in Japan." } , { latin = "2ana 2ismii faaTima" , arabic = "أَنا إِسمي فاطِمة" , meaning = "My name is PI:NAME:<NAME>END_PI." } , { latin = "2a3iish fii miSr" , arabic = "أَعيش في مِصر" , meaning = "I live in Egypt." } , { latin = "al3mr" , arabic = "العمر" , meaning = "age" } , { latin = "2ukhtii wa-Sadiiqhaa juurj" , arabic = "أُخْتي وَصَديقهل جورْج" , meaning = "my sister and her friend George" } , { latin = "3amalii wa-eamala" , arabic = "عَمَلي وَعَمَله" , meaning = "my work and his work" } , { latin = "haadhihi Sadiiqat-hu saamiya" , arabic = "هَذِهِ صَديقَتهُ سامية" , meaning = "This is his girlfriend PI:NAME:<NAME>END_PIia." } ]
elm
[ { "context": " ]\n\n _ ->\n [ { order = 3, seed = Marigold, scale = 0.7 }\n , { order = 9, se", "end": 3210, "score": 0.5298895836, "start": 3207, "tag": "NAME", "value": "Mar" }, { "context": "pin, scale = 1 }\n , { order = 5, seed = Marigold, scale = 0.6 }\n ]\n\n\nseedsRight : ", "end": 3438, "score": 0.5455874205, "start": 3435, "tag": "NAME", "value": "Mar" } ]
src/elm/Scene/Intro/GrowingSeeds.elm
lydell/seeds-game
97
module Scene.Intro.GrowingSeeds exposing ( State(..) , view ) import Element exposing (..) import Element.Animation.Bounce as Bounce import Element.Scale as Scale import Element.Seed as Seed import Scene.Level.Board.Tile.Scale as Scale import Seed exposing (Seed(..)) import Simple.Animation as Animation exposing (Animation) import Simple.Animation.Property as P import Utils.Animated as Animated import Utils.Element as Element import Utils.Transition as Transition import Window exposing (Window) -- Growing Seeds type State = Entering | Leaving -- View view : Window -> State -> Element msg view window state = row [ centerX , spacing -Scale.extraSmall , moveUp 20 ] [ sideSeeds window state (List.reverse (seedsLeft window)) , viewMainSeed window state , sideSeeds window state (seedsRight window) ] viewMainSeed : Window -> State -> Element msg viewMainSeed window state = case state of Leaving -> Animated.el slideDownScaleOut [] (staticSeed window mainSeed) Entering -> growingSeed window mainSeed slideDownScaleOut : Animation slideDownScaleOut = Animation.steps { startAt = [ P.y 0, P.scale 1 ] , options = [ Animation.delay 500, Animation.easeInOutBack ] } [ Animation.step 1000 [ P.y 50, P.scale 1 ] , Animation.step 750 [ P.y 50, P.scale 0 ] ] sideSeeds : Window -> State -> List GrowingSeed -> Element msg sideSeeds window state seeds = row [ Transition.alpha 1000 , Element.visibleIf (isEntering state) , spacing -Scale.extraSmall ] (List.map (growingSeed window) seeds) isEntering : State -> Bool isEntering state = case state of Entering -> True Leaving -> False growingSeed : Window -> GrowingSeed -> Element msg growingSeed window seed = Animated.el (bulgeFade seed) [ Element.originBottom , alignBottom ] (staticSeed window seed) staticSeed : Window -> GrowingSeed -> Element msg staticSeed window seed = Seed.view (seedSize window seed) seed.seed seedSize : Window -> GrowingSeed -> Seed.Options seedSize window seed = Seed.size (round (75 * seed.scale * Scale.factor window)) bulgeFade : GrowingSeed -> Animation bulgeFade seed = Bounce.animation { options = [ Animation.delay (seed.order * 100) ] , duration = 1800 , property = P.scale , bounce = Bounce.springy , from = 0 , to = 1 } type alias GrowingSeed = { order : Int , seed : Seed , scale : Float } mainSeed : GrowingSeed mainSeed = { order = 0 , seed = Sunflower , scale = 1.1 } seedsLeft : Window -> List GrowingSeed seedsLeft window = case Window.size window of Window.Small -> [ { order = 3, seed = Marigold, scale = 0.7 } , { order = 5, seed = Chrysanthemum, scale = 0.5 } , { order = 1, seed = Rose, scale = 0.8 } , { order = 7, seed = Lupin, scale = 0.5 } ] _ -> [ { order = 3, seed = Marigold, scale = 0.7 } , { order = 9, seed = Chrysanthemum, scale = 0.5 } , { order = 7, seed = Rose, scale = 0.8 } , { order = 1, seed = Lupin, scale = 1 } , { order = 5, seed = Marigold, scale = 0.6 } ] seedsRight : Window -> List GrowingSeed seedsRight window = case Window.size window of Window.Small -> [ { order = 4, seed = Chrysanthemum, scale = 0.6 } , { order = 6, seed = Marigold, scale = 0.7 } , { order = 2, seed = Sunflower, scale = 0.5 } , { order = 8, seed = Lupin, scale = 0.5 } ] _ -> [ { order = 10, seed = Chrysanthemum, scale = 0.6 } , { order = 2, seed = Marigold, scale = 0.7 } , { order = 8, seed = Sunflower, scale = 0.5 } , { order = 6, seed = Rose, scale = 1 } , { order = 4, seed = Lupin, scale = 0.8 } ]
11941
module Scene.Intro.GrowingSeeds exposing ( State(..) , view ) import Element exposing (..) import Element.Animation.Bounce as Bounce import Element.Scale as Scale import Element.Seed as Seed import Scene.Level.Board.Tile.Scale as Scale import Seed exposing (Seed(..)) import Simple.Animation as Animation exposing (Animation) import Simple.Animation.Property as P import Utils.Animated as Animated import Utils.Element as Element import Utils.Transition as Transition import Window exposing (Window) -- Growing Seeds type State = Entering | Leaving -- View view : Window -> State -> Element msg view window state = row [ centerX , spacing -Scale.extraSmall , moveUp 20 ] [ sideSeeds window state (List.reverse (seedsLeft window)) , viewMainSeed window state , sideSeeds window state (seedsRight window) ] viewMainSeed : Window -> State -> Element msg viewMainSeed window state = case state of Leaving -> Animated.el slideDownScaleOut [] (staticSeed window mainSeed) Entering -> growingSeed window mainSeed slideDownScaleOut : Animation slideDownScaleOut = Animation.steps { startAt = [ P.y 0, P.scale 1 ] , options = [ Animation.delay 500, Animation.easeInOutBack ] } [ Animation.step 1000 [ P.y 50, P.scale 1 ] , Animation.step 750 [ P.y 50, P.scale 0 ] ] sideSeeds : Window -> State -> List GrowingSeed -> Element msg sideSeeds window state seeds = row [ Transition.alpha 1000 , Element.visibleIf (isEntering state) , spacing -Scale.extraSmall ] (List.map (growingSeed window) seeds) isEntering : State -> Bool isEntering state = case state of Entering -> True Leaving -> False growingSeed : Window -> GrowingSeed -> Element msg growingSeed window seed = Animated.el (bulgeFade seed) [ Element.originBottom , alignBottom ] (staticSeed window seed) staticSeed : Window -> GrowingSeed -> Element msg staticSeed window seed = Seed.view (seedSize window seed) seed.seed seedSize : Window -> GrowingSeed -> Seed.Options seedSize window seed = Seed.size (round (75 * seed.scale * Scale.factor window)) bulgeFade : GrowingSeed -> Animation bulgeFade seed = Bounce.animation { options = [ Animation.delay (seed.order * 100) ] , duration = 1800 , property = P.scale , bounce = Bounce.springy , from = 0 , to = 1 } type alias GrowingSeed = { order : Int , seed : Seed , scale : Float } mainSeed : GrowingSeed mainSeed = { order = 0 , seed = Sunflower , scale = 1.1 } seedsLeft : Window -> List GrowingSeed seedsLeft window = case Window.size window of Window.Small -> [ { order = 3, seed = Marigold, scale = 0.7 } , { order = 5, seed = Chrysanthemum, scale = 0.5 } , { order = 1, seed = Rose, scale = 0.8 } , { order = 7, seed = Lupin, scale = 0.5 } ] _ -> [ { order = 3, seed = <NAME>igold, scale = 0.7 } , { order = 9, seed = Chrysanthemum, scale = 0.5 } , { order = 7, seed = Rose, scale = 0.8 } , { order = 1, seed = Lupin, scale = 1 } , { order = 5, seed = <NAME>igold, scale = 0.6 } ] seedsRight : Window -> List GrowingSeed seedsRight window = case Window.size window of Window.Small -> [ { order = 4, seed = Chrysanthemum, scale = 0.6 } , { order = 6, seed = Marigold, scale = 0.7 } , { order = 2, seed = Sunflower, scale = 0.5 } , { order = 8, seed = Lupin, scale = 0.5 } ] _ -> [ { order = 10, seed = Chrysanthemum, scale = 0.6 } , { order = 2, seed = Marigold, scale = 0.7 } , { order = 8, seed = Sunflower, scale = 0.5 } , { order = 6, seed = Rose, scale = 1 } , { order = 4, seed = Lupin, scale = 0.8 } ]
true
module Scene.Intro.GrowingSeeds exposing ( State(..) , view ) import Element exposing (..) import Element.Animation.Bounce as Bounce import Element.Scale as Scale import Element.Seed as Seed import Scene.Level.Board.Tile.Scale as Scale import Seed exposing (Seed(..)) import Simple.Animation as Animation exposing (Animation) import Simple.Animation.Property as P import Utils.Animated as Animated import Utils.Element as Element import Utils.Transition as Transition import Window exposing (Window) -- Growing Seeds type State = Entering | Leaving -- View view : Window -> State -> Element msg view window state = row [ centerX , spacing -Scale.extraSmall , moveUp 20 ] [ sideSeeds window state (List.reverse (seedsLeft window)) , viewMainSeed window state , sideSeeds window state (seedsRight window) ] viewMainSeed : Window -> State -> Element msg viewMainSeed window state = case state of Leaving -> Animated.el slideDownScaleOut [] (staticSeed window mainSeed) Entering -> growingSeed window mainSeed slideDownScaleOut : Animation slideDownScaleOut = Animation.steps { startAt = [ P.y 0, P.scale 1 ] , options = [ Animation.delay 500, Animation.easeInOutBack ] } [ Animation.step 1000 [ P.y 50, P.scale 1 ] , Animation.step 750 [ P.y 50, P.scale 0 ] ] sideSeeds : Window -> State -> List GrowingSeed -> Element msg sideSeeds window state seeds = row [ Transition.alpha 1000 , Element.visibleIf (isEntering state) , spacing -Scale.extraSmall ] (List.map (growingSeed window) seeds) isEntering : State -> Bool isEntering state = case state of Entering -> True Leaving -> False growingSeed : Window -> GrowingSeed -> Element msg growingSeed window seed = Animated.el (bulgeFade seed) [ Element.originBottom , alignBottom ] (staticSeed window seed) staticSeed : Window -> GrowingSeed -> Element msg staticSeed window seed = Seed.view (seedSize window seed) seed.seed seedSize : Window -> GrowingSeed -> Seed.Options seedSize window seed = Seed.size (round (75 * seed.scale * Scale.factor window)) bulgeFade : GrowingSeed -> Animation bulgeFade seed = Bounce.animation { options = [ Animation.delay (seed.order * 100) ] , duration = 1800 , property = P.scale , bounce = Bounce.springy , from = 0 , to = 1 } type alias GrowingSeed = { order : Int , seed : Seed , scale : Float } mainSeed : GrowingSeed mainSeed = { order = 0 , seed = Sunflower , scale = 1.1 } seedsLeft : Window -> List GrowingSeed seedsLeft window = case Window.size window of Window.Small -> [ { order = 3, seed = Marigold, scale = 0.7 } , { order = 5, seed = Chrysanthemum, scale = 0.5 } , { order = 1, seed = Rose, scale = 0.8 } , { order = 7, seed = Lupin, scale = 0.5 } ] _ -> [ { order = 3, seed = PI:NAME:<NAME>END_PIigold, scale = 0.7 } , { order = 9, seed = Chrysanthemum, scale = 0.5 } , { order = 7, seed = Rose, scale = 0.8 } , { order = 1, seed = Lupin, scale = 1 } , { order = 5, seed = PI:NAME:<NAME>END_PIigold, scale = 0.6 } ] seedsRight : Window -> List GrowingSeed seedsRight window = case Window.size window of Window.Small -> [ { order = 4, seed = Chrysanthemum, scale = 0.6 } , { order = 6, seed = Marigold, scale = 0.7 } , { order = 2, seed = Sunflower, scale = 0.5 } , { order = 8, seed = Lupin, scale = 0.5 } ] _ -> [ { order = 10, seed = Chrysanthemum, scale = 0.6 } , { order = 2, seed = Marigold, scale = 0.7 } , { order = 8, seed = Sunflower, scale = 0.5 } , { order = 6, seed = Rose, scale = 1 } , { order = 4, seed = Lupin, scale = 0.8 } ]
elm
[ { "context": "rings here.\n\n@docs Config\n\nCopyright (c) 2016-2018 Robin Luiten\n\n-}\n\nimport Date exposing (Day, Month)\nimport Dat", "end": 249, "score": 0.999873817, "start": 237, "tag": "NAME", "value": "Robin Luiten" } ]
src/Date/Extra/Config.elm
AdrianRibao/elm-date-extra
81
module Date.Extra.Config exposing (..) {-| Date configuration. For i18n for day and month names. Parameter to Format.format* functions. There is scope to put in some default format strings here. @docs Config Copyright (c) 2016-2018 Robin Luiten -} import Date exposing (Day, Month) import Date.Extra.TwelveHourClock exposing (TwelveHourPeriod) {-| Configuration for formatting dates. -} type alias Config = { i18n : { dayShort : Day -> String , dayName : Day -> String , monthShort : Month -> String , monthName : Month -> String , dayOfMonthWithSuffix : Bool -> Int -> String , twelveHourPeriod : TwelveHourPeriod -> String } , format : { date : String , longDate : String , time : String , longTime : String , dateTime : String , firstDayOfWeek : Date.Day } }
18951
module Date.Extra.Config exposing (..) {-| Date configuration. For i18n for day and month names. Parameter to Format.format* functions. There is scope to put in some default format strings here. @docs Config Copyright (c) 2016-2018 <NAME> -} import Date exposing (Day, Month) import Date.Extra.TwelveHourClock exposing (TwelveHourPeriod) {-| Configuration for formatting dates. -} type alias Config = { i18n : { dayShort : Day -> String , dayName : Day -> String , monthShort : Month -> String , monthName : Month -> String , dayOfMonthWithSuffix : Bool -> Int -> String , twelveHourPeriod : TwelveHourPeriod -> String } , format : { date : String , longDate : String , time : String , longTime : String , dateTime : String , firstDayOfWeek : Date.Day } }
true
module Date.Extra.Config exposing (..) {-| Date configuration. For i18n for day and month names. Parameter to Format.format* functions. There is scope to put in some default format strings here. @docs Config Copyright (c) 2016-2018 PI:NAME:<NAME>END_PI -} import Date exposing (Day, Month) import Date.Extra.TwelveHourClock exposing (TwelveHourPeriod) {-| Configuration for formatting dates. -} type alias Config = { i18n : { dayShort : Day -> String , dayName : Day -> String , monthShort : Month -> String , monthName : Month -> String , dayOfMonthWithSuffix : Bool -> Int -> String , twelveHourPeriod : TwelveHourPeriod -> String } , format : { date : String , longDate : String , time : String , longTime : String , dateTime : String , firstDayOfWeek : Date.Day } }
elm
[ { "context": "informatiques\"]\n , p [] [text \"Chaque jeudi, Marie-Agnès Gaime anime deux ateliers informatiques \n ", "end": 2787, "score": 0.9998055696, "start": 2770, "tag": "NAME", "value": "Marie-Agnès Gaime" }, { "context": "ignements et inscriptions \"]\n , p [] [text \"Marie-Agnès Gaime : 04 73 88 65 24\"]\n\n , h5 [] [text \"Le repas", "end": 3293, "score": 0.9995779991, "start": 3276, "tag": "NAME", "value": "Marie-Agnès Gaime" }, { "context": " ,text \"Circonscription d’action médico-sociale Sancy Val d’Allier au 04 \n 73 89 48 55\"]\n , a [", "end": 8515, "score": 0.9738125205, "start": 8497, "tag": "NAME", "value": "Sancy Val d’Allier" } ]
src/LesSeniors.elm
eniac314/mairieMurol
0
module LesSeniors where import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) import StartApp.Simple as StartApp import List exposing (..) import String exposing (words, join, cons, uncons) import Char import Dict exposing (..) import TiledMenu exposing (initAtWithLink,view,update,Action) import StarTable exposing (makeTable, emptyTe, Label(..)) import Utils exposing (mainMenu, renderMainMenu, pageFooter, capitalize, renderListImg, logos, renderSubMenu, mail, site, link) -- Model subMenu : Utils.Submenu subMenu = { current = "", entries = []} type alias MainContent = { wrapper : (Html -> Bool -> Html) , tiledMenu : TiledMenu.Model } type alias Model = { mainMenu : Utils.Menu , subMenu : Utils.Submenu , mainContent : MainContent , showIntro : Bool } initialModel = { mainMenu = mainMenu , subMenu = subMenu , mainContent = initialContent , showIntro = if String.isEmpty locationSearch then True else False } -- View view : Signal.Address Action -> Model -> Html view address model = div [ id "container"] [ renderMainMenu ["Vie locale", "Les seniors"] (.mainMenu model) , div [ id "subContainer"] [ (.wrapper (.mainContent model)) (TiledMenu.view (Signal.forwardTo address TiledMenuAction) (.tiledMenu (.mainContent model))) (.showIntro model) ] , pageFooter ] -- Update type Action = NoOp | TiledMenuAction (TiledMenu.Action) update : Action -> Model -> Model update action model = case action of NoOp -> model TiledMenuAction act -> let mc = (.mainContent model) tm = (.tiledMenu (.mainContent model)) in { model | showIntro = not (.showIntro model) , mainContent = { mc | tiledMenu = TiledMenu.update act tm } } --Main main = StartApp.start { model = initialModel , view = view , update = update } port locationSearch : String initialContent = { wrapper = (\content showIntro -> div [ class "subContainerData noSubmenu", id "lesSeniors"] [ h2 [] [text "Les seniors"] , content]) , tiledMenu = initAtWithLink locationSearch seniors } -- Data seniors = [ ("Activités et animations" ,"/images/tiles/seniors/info.jpg" , [ h5 [] [text "Les ateliers informatiques"] , p [] [text "Chaque jeudi, Marie-Agnès Gaime anime deux ateliers informatiques pour les membres de l’association les Amis du Vieux Murol, dans la salle de réunion du 1er étage de la mairie, équipée de 5 postes de travail, mise à disposition gratuitement pour permettre cette initiation. "] , p [] [text "Horaires : 9H/10H30 et 10H30/12H "] , p [] [text "Renseignements et inscriptions "] , p [] [text "Marie-Agnès Gaime : 04 73 88 65 24"] , h5 [] [text "Le repas du CCAS de Murol "] , p [] [text "Chaque année, au mois de janvier, le CCAS organise une journée conviviale pour les murolais de 65 ans et plus. "] , p [] [text "La journée commence par les vœux du maire à toute la population. Il retrace les réalisations et les projets en cours pendant qu’un diaporama de l’année écoulée est présenté. "] , p [] [text "Ensuite, les personnes de 65 ans et plus sont conviées à partager un repas festif dans l’un des restaurants de la commune. Dans l’après-midi, une animation musicale invite les convives à danser et à chanter. "] , h5 [] [text "Les activités de l’association des Amis du Vieux Murol "] , a [href "/Associations.html?bloc=00"] [text "Les associations culturelles"] , h5 [] [text "Les animations du SIVOM de Besse et le bus des montagnes"] , p [] [text "Ce service propose des activités, déplacements et voyages à l’ensemble des seniors du territoire. "] , text "Au programme pour 2017 : " , a [href "baseDocumentaire/animation/animations SIVOM 2017.pdf", target "_blank"] [text "voir le programme 2017"] , p [] [ text "pour tout renseignement contactez le " , a [ href "/LesSeniors.html?bloc=01"] [ text "SIVOM de Besse"] ] ] , "" ) , ("Services du SIVOM de BESSE" ,"/images/tiles/seniors/SIVOM.jpg" , [ div [ id "SIVOMAddress"] [ p [] [text "SIVOM DE BESSE "] , p [] [text "14, place du Grand Mèze"] , p [] [text "63610 BESSE "] , p [] [text "Tél : 04 73 79 52 82"] ] , p [] [text "Le SIVOM de Besse est une structure intercommunale qui offre de multiples services pour améliorer le quotidien des personnes de plus de 60 ans. "] , h5 [] [text "Le service d’aide à domicile "] , text "Ce service est composé de 20 aides à domicile qui assistent les personnes de plus de 60 ans pour la réalisation des tâches de la vie quotidienne: " , ul [] [ li [] [text "Entretien du logement"] , li [] [text "Courses et préparation des repas "] , li [] [text "Aide aux démarches simples "] ] , p [] [text "La participation des bénéficiaires est calculée en fonction des ressources."] , h5 [] [text "Le portage des repas "] , p [] [text "Les repas sont livrés à domicile les mardis, jeudis et vendredis et couvrent les besoins quotidiens de la personne. "] , p [] [text "Ils comprennent 6 plats accompagnés de pain : entrée, potage, viande ou poisson, légume ou féculent, fromage ou yaourt, dessert."] , p [] [text "Possibilité de repas de régimes (sans sel/ diabétique/ coupé) "] , h5 [] [text "Le Service de Soins Infirmiers à Domicile (SSIAD) "] , p [] [text "Les aides-soignantes interviennent à domicile 7 jours sur 7. "] , p [] [text "Le forfait de soins est intégralement pris en charge par l’ ARS (agence régionale de santé). "] , h5 [] [text "La distribution de colis alimentaires"] , p [] [text "Ce service s’adresse aux personnes à faibles ressources du territoire sur la base d’un diagnostic effectué par les assistants sociaux. "] , p [] [text "Pour pouvoir bénéficier de ce service, prenez rendez-vous avec un(e) assistant(e) social(e) de la circonscription en appelant le : 04 73 89 48 55. "] , h5 [] [text "Les " , a [ href "/LesSeniors.html?bloc=00" , target "_blank"] [text "animations du 3ème âge et le bus des montagnes"] ] , p [] [text "Ce service propose des activités, déplacements et voyages à l’ensemble des seniors du territoire. "] ] , "" ) , ("Autres services" ,"/images/tiles/seniors/autres.jpg" , [ a [href "/CCAS.html"] [text "Le CCAS de Murol"] , br [] [] , a [href "http://www.puydedome.com/MobiPlus-67262.html?1=1" , target "_blank" ] [text "Les chèques transport mobiplus "] , h5 [] [text "Les assistants sociaux de la circonscription"] , p [] [text "Les assistants sociaux peuvent vous aider dans vos démarches administratives ou en cas de difficultés financières. Ils assurent des permanences à Besse et se déplacent à domicile."] , p [] [text "N’hésitez pas à les contacter pour prendre rendez-vous: " , br [] [] ,text "Circonscription d’action médico-sociale Sancy Val d’Allier au 04 73 89 48 55"] , a [href "http://www.pour-les-personnes-agees.gouv.fr " , target "_blank" ] [text "Le portail dédié aux personnes âgées"] ] , "" ) ]
17201
module LesSeniors where import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) import StartApp.Simple as StartApp import List exposing (..) import String exposing (words, join, cons, uncons) import Char import Dict exposing (..) import TiledMenu exposing (initAtWithLink,view,update,Action) import StarTable exposing (makeTable, emptyTe, Label(..)) import Utils exposing (mainMenu, renderMainMenu, pageFooter, capitalize, renderListImg, logos, renderSubMenu, mail, site, link) -- Model subMenu : Utils.Submenu subMenu = { current = "", entries = []} type alias MainContent = { wrapper : (Html -> Bool -> Html) , tiledMenu : TiledMenu.Model } type alias Model = { mainMenu : Utils.Menu , subMenu : Utils.Submenu , mainContent : MainContent , showIntro : Bool } initialModel = { mainMenu = mainMenu , subMenu = subMenu , mainContent = initialContent , showIntro = if String.isEmpty locationSearch then True else False } -- View view : Signal.Address Action -> Model -> Html view address model = div [ id "container"] [ renderMainMenu ["Vie locale", "Les seniors"] (.mainMenu model) , div [ id "subContainer"] [ (.wrapper (.mainContent model)) (TiledMenu.view (Signal.forwardTo address TiledMenuAction) (.tiledMenu (.mainContent model))) (.showIntro model) ] , pageFooter ] -- Update type Action = NoOp | TiledMenuAction (TiledMenu.Action) update : Action -> Model -> Model update action model = case action of NoOp -> model TiledMenuAction act -> let mc = (.mainContent model) tm = (.tiledMenu (.mainContent model)) in { model | showIntro = not (.showIntro model) , mainContent = { mc | tiledMenu = TiledMenu.update act tm } } --Main main = StartApp.start { model = initialModel , view = view , update = update } port locationSearch : String initialContent = { wrapper = (\content showIntro -> div [ class "subContainerData noSubmenu", id "lesSeniors"] [ h2 [] [text "Les seniors"] , content]) , tiledMenu = initAtWithLink locationSearch seniors } -- Data seniors = [ ("Activités et animations" ,"/images/tiles/seniors/info.jpg" , [ h5 [] [text "Les ateliers informatiques"] , p [] [text "Chaque jeudi, <NAME> anime deux ateliers informatiques pour les membres de l’association les Amis du Vieux Murol, dans la salle de réunion du 1er étage de la mairie, équipée de 5 postes de travail, mise à disposition gratuitement pour permettre cette initiation. "] , p [] [text "Horaires : 9H/10H30 et 10H30/12H "] , p [] [text "Renseignements et inscriptions "] , p [] [text "<NAME> : 04 73 88 65 24"] , h5 [] [text "Le repas du CCAS de Murol "] , p [] [text "Chaque année, au mois de janvier, le CCAS organise une journée conviviale pour les murolais de 65 ans et plus. "] , p [] [text "La journée commence par les vœux du maire à toute la population. Il retrace les réalisations et les projets en cours pendant qu’un diaporama de l’année écoulée est présenté. "] , p [] [text "Ensuite, les personnes de 65 ans et plus sont conviées à partager un repas festif dans l’un des restaurants de la commune. Dans l’après-midi, une animation musicale invite les convives à danser et à chanter. "] , h5 [] [text "Les activités de l’association des Amis du Vieux Murol "] , a [href "/Associations.html?bloc=00"] [text "Les associations culturelles"] , h5 [] [text "Les animations du SIVOM de Besse et le bus des montagnes"] , p [] [text "Ce service propose des activités, déplacements et voyages à l’ensemble des seniors du territoire. "] , text "Au programme pour 2017 : " , a [href "baseDocumentaire/animation/animations SIVOM 2017.pdf", target "_blank"] [text "voir le programme 2017"] , p [] [ text "pour tout renseignement contactez le " , a [ href "/LesSeniors.html?bloc=01"] [ text "SIVOM de Besse"] ] ] , "" ) , ("Services du SIVOM de BESSE" ,"/images/tiles/seniors/SIVOM.jpg" , [ div [ id "SIVOMAddress"] [ p [] [text "SIVOM DE BESSE "] , p [] [text "14, place du Grand Mèze"] , p [] [text "63610 BESSE "] , p [] [text "Tél : 04 73 79 52 82"] ] , p [] [text "Le SIVOM de Besse est une structure intercommunale qui offre de multiples services pour améliorer le quotidien des personnes de plus de 60 ans. "] , h5 [] [text "Le service d’aide à domicile "] , text "Ce service est composé de 20 aides à domicile qui assistent les personnes de plus de 60 ans pour la réalisation des tâches de la vie quotidienne: " , ul [] [ li [] [text "Entretien du logement"] , li [] [text "Courses et préparation des repas "] , li [] [text "Aide aux démarches simples "] ] , p [] [text "La participation des bénéficiaires est calculée en fonction des ressources."] , h5 [] [text "Le portage des repas "] , p [] [text "Les repas sont livrés à domicile les mardis, jeudis et vendredis et couvrent les besoins quotidiens de la personne. "] , p [] [text "Ils comprennent 6 plats accompagnés de pain : entrée, potage, viande ou poisson, légume ou féculent, fromage ou yaourt, dessert."] , p [] [text "Possibilité de repas de régimes (sans sel/ diabétique/ coupé) "] , h5 [] [text "Le Service de Soins Infirmiers à Domicile (SSIAD) "] , p [] [text "Les aides-soignantes interviennent à domicile 7 jours sur 7. "] , p [] [text "Le forfait de soins est intégralement pris en charge par l’ ARS (agence régionale de santé). "] , h5 [] [text "La distribution de colis alimentaires"] , p [] [text "Ce service s’adresse aux personnes à faibles ressources du territoire sur la base d’un diagnostic effectué par les assistants sociaux. "] , p [] [text "Pour pouvoir bénéficier de ce service, prenez rendez-vous avec un(e) assistant(e) social(e) de la circonscription en appelant le : 04 73 89 48 55. "] , h5 [] [text "Les " , a [ href "/LesSeniors.html?bloc=00" , target "_blank"] [text "animations du 3ème âge et le bus des montagnes"] ] , p [] [text "Ce service propose des activités, déplacements et voyages à l’ensemble des seniors du territoire. "] ] , "" ) , ("Autres services" ,"/images/tiles/seniors/autres.jpg" , [ a [href "/CCAS.html"] [text "Le CCAS de Murol"] , br [] [] , a [href "http://www.puydedome.com/MobiPlus-67262.html?1=1" , target "_blank" ] [text "Les chèques transport mobiplus "] , h5 [] [text "Les assistants sociaux de la circonscription"] , p [] [text "Les assistants sociaux peuvent vous aider dans vos démarches administratives ou en cas de difficultés financières. Ils assurent des permanences à Besse et se déplacent à domicile."] , p [] [text "N’hésitez pas à les contacter pour prendre rendez-vous: " , br [] [] ,text "Circonscription d’action médico-sociale <NAME> au 04 73 89 48 55"] , a [href "http://www.pour-les-personnes-agees.gouv.fr " , target "_blank" ] [text "Le portail dédié aux personnes âgées"] ] , "" ) ]
true
module LesSeniors where import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) import StartApp.Simple as StartApp import List exposing (..) import String exposing (words, join, cons, uncons) import Char import Dict exposing (..) import TiledMenu exposing (initAtWithLink,view,update,Action) import StarTable exposing (makeTable, emptyTe, Label(..)) import Utils exposing (mainMenu, renderMainMenu, pageFooter, capitalize, renderListImg, logos, renderSubMenu, mail, site, link) -- Model subMenu : Utils.Submenu subMenu = { current = "", entries = []} type alias MainContent = { wrapper : (Html -> Bool -> Html) , tiledMenu : TiledMenu.Model } type alias Model = { mainMenu : Utils.Menu , subMenu : Utils.Submenu , mainContent : MainContent , showIntro : Bool } initialModel = { mainMenu = mainMenu , subMenu = subMenu , mainContent = initialContent , showIntro = if String.isEmpty locationSearch then True else False } -- View view : Signal.Address Action -> Model -> Html view address model = div [ id "container"] [ renderMainMenu ["Vie locale", "Les seniors"] (.mainMenu model) , div [ id "subContainer"] [ (.wrapper (.mainContent model)) (TiledMenu.view (Signal.forwardTo address TiledMenuAction) (.tiledMenu (.mainContent model))) (.showIntro model) ] , pageFooter ] -- Update type Action = NoOp | TiledMenuAction (TiledMenu.Action) update : Action -> Model -> Model update action model = case action of NoOp -> model TiledMenuAction act -> let mc = (.mainContent model) tm = (.tiledMenu (.mainContent model)) in { model | showIntro = not (.showIntro model) , mainContent = { mc | tiledMenu = TiledMenu.update act tm } } --Main main = StartApp.start { model = initialModel , view = view , update = update } port locationSearch : String initialContent = { wrapper = (\content showIntro -> div [ class "subContainerData noSubmenu", id "lesSeniors"] [ h2 [] [text "Les seniors"] , content]) , tiledMenu = initAtWithLink locationSearch seniors } -- Data seniors = [ ("Activités et animations" ,"/images/tiles/seniors/info.jpg" , [ h5 [] [text "Les ateliers informatiques"] , p [] [text "Chaque jeudi, PI:NAME:<NAME>END_PI anime deux ateliers informatiques pour les membres de l’association les Amis du Vieux Murol, dans la salle de réunion du 1er étage de la mairie, équipée de 5 postes de travail, mise à disposition gratuitement pour permettre cette initiation. "] , p [] [text "Horaires : 9H/10H30 et 10H30/12H "] , p [] [text "Renseignements et inscriptions "] , p [] [text "PI:NAME:<NAME>END_PI : 04 73 88 65 24"] , h5 [] [text "Le repas du CCAS de Murol "] , p [] [text "Chaque année, au mois de janvier, le CCAS organise une journée conviviale pour les murolais de 65 ans et plus. "] , p [] [text "La journée commence par les vœux du maire à toute la population. Il retrace les réalisations et les projets en cours pendant qu’un diaporama de l’année écoulée est présenté. "] , p [] [text "Ensuite, les personnes de 65 ans et plus sont conviées à partager un repas festif dans l’un des restaurants de la commune. Dans l’après-midi, une animation musicale invite les convives à danser et à chanter. "] , h5 [] [text "Les activités de l’association des Amis du Vieux Murol "] , a [href "/Associations.html?bloc=00"] [text "Les associations culturelles"] , h5 [] [text "Les animations du SIVOM de Besse et le bus des montagnes"] , p [] [text "Ce service propose des activités, déplacements et voyages à l’ensemble des seniors du territoire. "] , text "Au programme pour 2017 : " , a [href "baseDocumentaire/animation/animations SIVOM 2017.pdf", target "_blank"] [text "voir le programme 2017"] , p [] [ text "pour tout renseignement contactez le " , a [ href "/LesSeniors.html?bloc=01"] [ text "SIVOM de Besse"] ] ] , "" ) , ("Services du SIVOM de BESSE" ,"/images/tiles/seniors/SIVOM.jpg" , [ div [ id "SIVOMAddress"] [ p [] [text "SIVOM DE BESSE "] , p [] [text "14, place du Grand Mèze"] , p [] [text "63610 BESSE "] , p [] [text "Tél : 04 73 79 52 82"] ] , p [] [text "Le SIVOM de Besse est une structure intercommunale qui offre de multiples services pour améliorer le quotidien des personnes de plus de 60 ans. "] , h5 [] [text "Le service d’aide à domicile "] , text "Ce service est composé de 20 aides à domicile qui assistent les personnes de plus de 60 ans pour la réalisation des tâches de la vie quotidienne: " , ul [] [ li [] [text "Entretien du logement"] , li [] [text "Courses et préparation des repas "] , li [] [text "Aide aux démarches simples "] ] , p [] [text "La participation des bénéficiaires est calculée en fonction des ressources."] , h5 [] [text "Le portage des repas "] , p [] [text "Les repas sont livrés à domicile les mardis, jeudis et vendredis et couvrent les besoins quotidiens de la personne. "] , p [] [text "Ils comprennent 6 plats accompagnés de pain : entrée, potage, viande ou poisson, légume ou féculent, fromage ou yaourt, dessert."] , p [] [text "Possibilité de repas de régimes (sans sel/ diabétique/ coupé) "] , h5 [] [text "Le Service de Soins Infirmiers à Domicile (SSIAD) "] , p [] [text "Les aides-soignantes interviennent à domicile 7 jours sur 7. "] , p [] [text "Le forfait de soins est intégralement pris en charge par l’ ARS (agence régionale de santé). "] , h5 [] [text "La distribution de colis alimentaires"] , p [] [text "Ce service s’adresse aux personnes à faibles ressources du territoire sur la base d’un diagnostic effectué par les assistants sociaux. "] , p [] [text "Pour pouvoir bénéficier de ce service, prenez rendez-vous avec un(e) assistant(e) social(e) de la circonscription en appelant le : 04 73 89 48 55. "] , h5 [] [text "Les " , a [ href "/LesSeniors.html?bloc=00" , target "_blank"] [text "animations du 3ème âge et le bus des montagnes"] ] , p [] [text "Ce service propose des activités, déplacements et voyages à l’ensemble des seniors du territoire. "] ] , "" ) , ("Autres services" ,"/images/tiles/seniors/autres.jpg" , [ a [href "/CCAS.html"] [text "Le CCAS de Murol"] , br [] [] , a [href "http://www.puydedome.com/MobiPlus-67262.html?1=1" , target "_blank" ] [text "Les chèques transport mobiplus "] , h5 [] [text "Les assistants sociaux de la circonscription"] , p [] [text "Les assistants sociaux peuvent vous aider dans vos démarches administratives ou en cas de difficultés financières. Ils assurent des permanences à Besse et se déplacent à domicile."] , p [] [text "N’hésitez pas à les contacter pour prendre rendez-vous: " , br [] [] ,text "Circonscription d’action médico-sociale PI:NAME:<NAME>END_PI au 04 73 89 48 55"] , a [href "http://www.pour-les-personnes-agees.gouv.fr " , target "_blank" ] [text "Le portail dédié aux personnes âgées"] ] , "" ) ]
elm
[ { "context": "backgroundColor = backgroundColor\n , name = name\n , fontSize = fontSize\n , updateAt ", "end": 3003, "score": 0.9878496528, "start": 2999, "tag": "NAME", "value": "name" }, { "context": "backgroundColor = backgroundColor\n , name = name\n , fontSize = fontSize\n , updateAt ", "end": 3565, "score": 0.9971938729, "start": 3561, "tag": "NAME", "value": "name" } ]
src/elm/Model/Object.elm
WorksApplications/office-maker
33
module Model.Object exposing (..) import Time exposing (Time) import CoreType exposing (..) type alias FloorVersion = Int type Shape = Rectangle | Ellipse type Object = Object { id : ObjectId , floorId : FloorId , floorVersion : Maybe FloorVersion , position : Position , size : Size , backgroundColor : String , name : String , fontSize : Float , updateAt : Maybe Time , extension : ObjectExtension } type alias LabelFields = { color : String , bold : Bool , url : String , shape : Shape } type ObjectExtension = Desk (Maybe PersonId) | Label LabelFields type ObjectPropertyChange = ChangeName String String | ChangeSize Size Size | ChangePosition Position Position | ChangeBackgroundColor String String | ChangeColor String String | ChangeFontSize Float Float | ChangeBold Bool Bool | ChangeUrl String String | ChangeShape Shape Shape | ChangePerson (Maybe PersonId) (Maybe PersonId) modifyAll : List ObjectPropertyChange -> Object -> Object modifyAll changes object = changes |> List.foldl modify object modify : ObjectPropertyChange -> Object -> Object modify change object = case change of ChangeName new old -> changeName new object ChangeSize new old -> changeSize new object ChangePosition new old -> changePosition new object ChangeBackgroundColor new old -> changeBackgroundColor new object ChangeColor new old -> changeColor new object ChangeFontSize new old -> changeFontSize new object ChangeBold new old -> changeBold new object ChangeUrl new old -> changeUrl new object ChangeShape new old -> changeShape new object ChangePerson new old -> setPerson new object copyUpdateAt : Object -> Object -> Object copyUpdateAt (Object src) (Object dest) = Object { dest | updateAt = src.updateAt } setUpdateAt : Time -> Object -> Object setUpdateAt updateAt (Object object) = Object { object | updateAt = Just updateAt } isDesk : Object -> Bool isDesk (Object object) = case object.extension of Desk _ -> True _ -> False isLabel : Object -> Bool isLabel (Object object) = case object.extension of Label _ -> True _ -> False initDesk : ObjectId -> FloorId -> Maybe FloorVersion -> Position -> Size -> String -> String -> Float -> Maybe Time -> Maybe PersonId -> Object initDesk id floorId floorVersion position size backgroundColor name fontSize updateAt personId = Object { id = id , floorId = floorId , floorVersion = floorVersion , position = position , size = size , backgroundColor = backgroundColor , name = name , fontSize = fontSize , updateAt = updateAt , extension = Desk personId } initLabel : ObjectId -> FloorId -> Maybe FloorVersion -> Position -> Size -> String -> String -> Float -> Maybe Time -> LabelFields -> Object initLabel id floorId floorVersion position size backgroundColor name fontSize updateAt extension = Object { id = id , floorId = floorId , floorVersion = floorVersion , position = position , size = size , backgroundColor = backgroundColor , name = name , fontSize = fontSize , updateAt = updateAt , extension = Label extension } changeId : ObjectId -> Object -> Object changeId id (Object object) = Object { object | id = id } changeFloorId : FloorId -> Object -> Object changeFloorId floorId (Object object) = Object { object | floorId = floorId } changeBackgroundColor : String -> Object -> Object changeBackgroundColor backgroundColor (Object object) = Object { object | backgroundColor = backgroundColor } changeColor : String -> Object -> Object changeColor color (Object object) = case object.extension of Desk _ -> Object object Label additionalFields -> Object { object | extension = Label { additionalFields | color = color } } changeName : String -> Object -> Object changeName name (Object object) = Object { object | name = name } changeSize : Size -> Object -> Object changeSize size (Object object) = Object { object | size = size } changePosition : Position -> Object -> Object changePosition position (Object object) = Object { object | position = position } rotate : Object -> Object rotate (Object object) = Object { object | size = Size object.size.height object.size.width } setPerson : Maybe PersonId -> Object -> Object setPerson personId ((Object object) as obj) = case object.extension of Desk _ -> Object { object | extension = Desk personId } _ -> obj changeFontSize : Float -> Object -> Object changeFontSize fontSize (Object object) = Object { object | fontSize = fontSize } changeBold : Bool -> Object -> Object changeBold bold ((Object object) as obj) = case object.extension of Desk _ -> obj Label fields -> Object { object | extension = Label { fields | bold = bold } } changeUrl : String -> Object -> Object changeUrl url ((Object object) as obj) = case object.extension of Desk _ -> obj Label fields -> Object { object | extension = Label { fields | url = url } } changeShape : Shape -> Object -> Object changeShape shape ((Object object) as obj) = case object.extension of Desk _ -> obj Label additionalFields -> Object { object | extension = Label { additionalFields | shape = shape } } idOf : Object -> ObjectId idOf (Object object) = object.id floorIdOf : Object -> FloorId floorIdOf (Object object) = object.floorId floorVersionOf : Object -> Maybe FloorVersion floorVersionOf (Object object) = object.floorVersion updateAtOf : Object -> Maybe Time updateAtOf (Object object) = object.updateAt nameOf : Object -> String nameOf (Object object) = object.name backgroundColorOf : Object -> String backgroundColorOf (Object object) = object.backgroundColor colorOf : Object -> String colorOf (Object object) = case object.extension of Desk _ -> "#000" Label { color } -> color defaultFontSize : Float defaultFontSize = 20 fontSizeOf : Object -> Float fontSizeOf (Object object) = object.fontSize isBold : Object -> Bool isBold (Object object) = case object.extension of Desk _ -> False Label { bold } -> bold urlOf : Object -> String urlOf (Object object) = case object.extension of Desk _ -> "" Label { url } -> url shapeOf : Object -> Shape shapeOf (Object object) = case object.extension of Desk _ -> Rectangle Label { shape } -> shape sizeOf : Object -> Size sizeOf (Object object) = object.size positionOf : Object -> Position positionOf (Object object) = object.position left : Object -> Int left object = .x <| positionOf object top : Object -> Int top object = .y <| positionOf object right : Object -> Int right (Object object) = object.position.x + object.size.width bottom : Object -> Int bottom (Object object) = object.position.y + object.size.height relatedPerson : Object -> Maybe PersonId relatedPerson (Object object) = case object.extension of Desk personId -> personId _ -> Nothing backgroundColorEditable : Object -> Bool backgroundColorEditable _ = True colorEditable : Object -> Bool colorEditable = isLabel shapeEditable : Object -> Bool shapeEditable = isLabel fontSizeEditable : Object -> Bool fontSizeEditable _ = True urlEditable : Object -> Bool urlEditable = isLabel --
39702
module Model.Object exposing (..) import Time exposing (Time) import CoreType exposing (..) type alias FloorVersion = Int type Shape = Rectangle | Ellipse type Object = Object { id : ObjectId , floorId : FloorId , floorVersion : Maybe FloorVersion , position : Position , size : Size , backgroundColor : String , name : String , fontSize : Float , updateAt : Maybe Time , extension : ObjectExtension } type alias LabelFields = { color : String , bold : Bool , url : String , shape : Shape } type ObjectExtension = Desk (Maybe PersonId) | Label LabelFields type ObjectPropertyChange = ChangeName String String | ChangeSize Size Size | ChangePosition Position Position | ChangeBackgroundColor String String | ChangeColor String String | ChangeFontSize Float Float | ChangeBold Bool Bool | ChangeUrl String String | ChangeShape Shape Shape | ChangePerson (Maybe PersonId) (Maybe PersonId) modifyAll : List ObjectPropertyChange -> Object -> Object modifyAll changes object = changes |> List.foldl modify object modify : ObjectPropertyChange -> Object -> Object modify change object = case change of ChangeName new old -> changeName new object ChangeSize new old -> changeSize new object ChangePosition new old -> changePosition new object ChangeBackgroundColor new old -> changeBackgroundColor new object ChangeColor new old -> changeColor new object ChangeFontSize new old -> changeFontSize new object ChangeBold new old -> changeBold new object ChangeUrl new old -> changeUrl new object ChangeShape new old -> changeShape new object ChangePerson new old -> setPerson new object copyUpdateAt : Object -> Object -> Object copyUpdateAt (Object src) (Object dest) = Object { dest | updateAt = src.updateAt } setUpdateAt : Time -> Object -> Object setUpdateAt updateAt (Object object) = Object { object | updateAt = Just updateAt } isDesk : Object -> Bool isDesk (Object object) = case object.extension of Desk _ -> True _ -> False isLabel : Object -> Bool isLabel (Object object) = case object.extension of Label _ -> True _ -> False initDesk : ObjectId -> FloorId -> Maybe FloorVersion -> Position -> Size -> String -> String -> Float -> Maybe Time -> Maybe PersonId -> Object initDesk id floorId floorVersion position size backgroundColor name fontSize updateAt personId = Object { id = id , floorId = floorId , floorVersion = floorVersion , position = position , size = size , backgroundColor = backgroundColor , name = <NAME> , fontSize = fontSize , updateAt = updateAt , extension = Desk personId } initLabel : ObjectId -> FloorId -> Maybe FloorVersion -> Position -> Size -> String -> String -> Float -> Maybe Time -> LabelFields -> Object initLabel id floorId floorVersion position size backgroundColor name fontSize updateAt extension = Object { id = id , floorId = floorId , floorVersion = floorVersion , position = position , size = size , backgroundColor = backgroundColor , name = <NAME> , fontSize = fontSize , updateAt = updateAt , extension = Label extension } changeId : ObjectId -> Object -> Object changeId id (Object object) = Object { object | id = id } changeFloorId : FloorId -> Object -> Object changeFloorId floorId (Object object) = Object { object | floorId = floorId } changeBackgroundColor : String -> Object -> Object changeBackgroundColor backgroundColor (Object object) = Object { object | backgroundColor = backgroundColor } changeColor : String -> Object -> Object changeColor color (Object object) = case object.extension of Desk _ -> Object object Label additionalFields -> Object { object | extension = Label { additionalFields | color = color } } changeName : String -> Object -> Object changeName name (Object object) = Object { object | name = name } changeSize : Size -> Object -> Object changeSize size (Object object) = Object { object | size = size } changePosition : Position -> Object -> Object changePosition position (Object object) = Object { object | position = position } rotate : Object -> Object rotate (Object object) = Object { object | size = Size object.size.height object.size.width } setPerson : Maybe PersonId -> Object -> Object setPerson personId ((Object object) as obj) = case object.extension of Desk _ -> Object { object | extension = Desk personId } _ -> obj changeFontSize : Float -> Object -> Object changeFontSize fontSize (Object object) = Object { object | fontSize = fontSize } changeBold : Bool -> Object -> Object changeBold bold ((Object object) as obj) = case object.extension of Desk _ -> obj Label fields -> Object { object | extension = Label { fields | bold = bold } } changeUrl : String -> Object -> Object changeUrl url ((Object object) as obj) = case object.extension of Desk _ -> obj Label fields -> Object { object | extension = Label { fields | url = url } } changeShape : Shape -> Object -> Object changeShape shape ((Object object) as obj) = case object.extension of Desk _ -> obj Label additionalFields -> Object { object | extension = Label { additionalFields | shape = shape } } idOf : Object -> ObjectId idOf (Object object) = object.id floorIdOf : Object -> FloorId floorIdOf (Object object) = object.floorId floorVersionOf : Object -> Maybe FloorVersion floorVersionOf (Object object) = object.floorVersion updateAtOf : Object -> Maybe Time updateAtOf (Object object) = object.updateAt nameOf : Object -> String nameOf (Object object) = object.name backgroundColorOf : Object -> String backgroundColorOf (Object object) = object.backgroundColor colorOf : Object -> String colorOf (Object object) = case object.extension of Desk _ -> "#000" Label { color } -> color defaultFontSize : Float defaultFontSize = 20 fontSizeOf : Object -> Float fontSizeOf (Object object) = object.fontSize isBold : Object -> Bool isBold (Object object) = case object.extension of Desk _ -> False Label { bold } -> bold urlOf : Object -> String urlOf (Object object) = case object.extension of Desk _ -> "" Label { url } -> url shapeOf : Object -> Shape shapeOf (Object object) = case object.extension of Desk _ -> Rectangle Label { shape } -> shape sizeOf : Object -> Size sizeOf (Object object) = object.size positionOf : Object -> Position positionOf (Object object) = object.position left : Object -> Int left object = .x <| positionOf object top : Object -> Int top object = .y <| positionOf object right : Object -> Int right (Object object) = object.position.x + object.size.width bottom : Object -> Int bottom (Object object) = object.position.y + object.size.height relatedPerson : Object -> Maybe PersonId relatedPerson (Object object) = case object.extension of Desk personId -> personId _ -> Nothing backgroundColorEditable : Object -> Bool backgroundColorEditable _ = True colorEditable : Object -> Bool colorEditable = isLabel shapeEditable : Object -> Bool shapeEditable = isLabel fontSizeEditable : Object -> Bool fontSizeEditable _ = True urlEditable : Object -> Bool urlEditable = isLabel --
true
module Model.Object exposing (..) import Time exposing (Time) import CoreType exposing (..) type alias FloorVersion = Int type Shape = Rectangle | Ellipse type Object = Object { id : ObjectId , floorId : FloorId , floorVersion : Maybe FloorVersion , position : Position , size : Size , backgroundColor : String , name : String , fontSize : Float , updateAt : Maybe Time , extension : ObjectExtension } type alias LabelFields = { color : String , bold : Bool , url : String , shape : Shape } type ObjectExtension = Desk (Maybe PersonId) | Label LabelFields type ObjectPropertyChange = ChangeName String String | ChangeSize Size Size | ChangePosition Position Position | ChangeBackgroundColor String String | ChangeColor String String | ChangeFontSize Float Float | ChangeBold Bool Bool | ChangeUrl String String | ChangeShape Shape Shape | ChangePerson (Maybe PersonId) (Maybe PersonId) modifyAll : List ObjectPropertyChange -> Object -> Object modifyAll changes object = changes |> List.foldl modify object modify : ObjectPropertyChange -> Object -> Object modify change object = case change of ChangeName new old -> changeName new object ChangeSize new old -> changeSize new object ChangePosition new old -> changePosition new object ChangeBackgroundColor new old -> changeBackgroundColor new object ChangeColor new old -> changeColor new object ChangeFontSize new old -> changeFontSize new object ChangeBold new old -> changeBold new object ChangeUrl new old -> changeUrl new object ChangeShape new old -> changeShape new object ChangePerson new old -> setPerson new object copyUpdateAt : Object -> Object -> Object copyUpdateAt (Object src) (Object dest) = Object { dest | updateAt = src.updateAt } setUpdateAt : Time -> Object -> Object setUpdateAt updateAt (Object object) = Object { object | updateAt = Just updateAt } isDesk : Object -> Bool isDesk (Object object) = case object.extension of Desk _ -> True _ -> False isLabel : Object -> Bool isLabel (Object object) = case object.extension of Label _ -> True _ -> False initDesk : ObjectId -> FloorId -> Maybe FloorVersion -> Position -> Size -> String -> String -> Float -> Maybe Time -> Maybe PersonId -> Object initDesk id floorId floorVersion position size backgroundColor name fontSize updateAt personId = Object { id = id , floorId = floorId , floorVersion = floorVersion , position = position , size = size , backgroundColor = backgroundColor , name = PI:NAME:<NAME>END_PI , fontSize = fontSize , updateAt = updateAt , extension = Desk personId } initLabel : ObjectId -> FloorId -> Maybe FloorVersion -> Position -> Size -> String -> String -> Float -> Maybe Time -> LabelFields -> Object initLabel id floorId floorVersion position size backgroundColor name fontSize updateAt extension = Object { id = id , floorId = floorId , floorVersion = floorVersion , position = position , size = size , backgroundColor = backgroundColor , name = PI:NAME:<NAME>END_PI , fontSize = fontSize , updateAt = updateAt , extension = Label extension } changeId : ObjectId -> Object -> Object changeId id (Object object) = Object { object | id = id } changeFloorId : FloorId -> Object -> Object changeFloorId floorId (Object object) = Object { object | floorId = floorId } changeBackgroundColor : String -> Object -> Object changeBackgroundColor backgroundColor (Object object) = Object { object | backgroundColor = backgroundColor } changeColor : String -> Object -> Object changeColor color (Object object) = case object.extension of Desk _ -> Object object Label additionalFields -> Object { object | extension = Label { additionalFields | color = color } } changeName : String -> Object -> Object changeName name (Object object) = Object { object | name = name } changeSize : Size -> Object -> Object changeSize size (Object object) = Object { object | size = size } changePosition : Position -> Object -> Object changePosition position (Object object) = Object { object | position = position } rotate : Object -> Object rotate (Object object) = Object { object | size = Size object.size.height object.size.width } setPerson : Maybe PersonId -> Object -> Object setPerson personId ((Object object) as obj) = case object.extension of Desk _ -> Object { object | extension = Desk personId } _ -> obj changeFontSize : Float -> Object -> Object changeFontSize fontSize (Object object) = Object { object | fontSize = fontSize } changeBold : Bool -> Object -> Object changeBold bold ((Object object) as obj) = case object.extension of Desk _ -> obj Label fields -> Object { object | extension = Label { fields | bold = bold } } changeUrl : String -> Object -> Object changeUrl url ((Object object) as obj) = case object.extension of Desk _ -> obj Label fields -> Object { object | extension = Label { fields | url = url } } changeShape : Shape -> Object -> Object changeShape shape ((Object object) as obj) = case object.extension of Desk _ -> obj Label additionalFields -> Object { object | extension = Label { additionalFields | shape = shape } } idOf : Object -> ObjectId idOf (Object object) = object.id floorIdOf : Object -> FloorId floorIdOf (Object object) = object.floorId floorVersionOf : Object -> Maybe FloorVersion floorVersionOf (Object object) = object.floorVersion updateAtOf : Object -> Maybe Time updateAtOf (Object object) = object.updateAt nameOf : Object -> String nameOf (Object object) = object.name backgroundColorOf : Object -> String backgroundColorOf (Object object) = object.backgroundColor colorOf : Object -> String colorOf (Object object) = case object.extension of Desk _ -> "#000" Label { color } -> color defaultFontSize : Float defaultFontSize = 20 fontSizeOf : Object -> Float fontSizeOf (Object object) = object.fontSize isBold : Object -> Bool isBold (Object object) = case object.extension of Desk _ -> False Label { bold } -> bold urlOf : Object -> String urlOf (Object object) = case object.extension of Desk _ -> "" Label { url } -> url shapeOf : Object -> Shape shapeOf (Object object) = case object.extension of Desk _ -> Rectangle Label { shape } -> shape sizeOf : Object -> Size sizeOf (Object object) = object.size positionOf : Object -> Position positionOf (Object object) = object.position left : Object -> Int left object = .x <| positionOf object top : Object -> Int top object = .y <| positionOf object right : Object -> Int right (Object object) = object.position.x + object.size.width bottom : Object -> Int bottom (Object object) = object.position.y + object.size.height relatedPerson : Object -> Maybe PersonId relatedPerson (Object object) = case object.extension of Desk personId -> personId _ -> Nothing backgroundColorEditable : Object -> Bool backgroundColorEditable _ = True colorEditable : Object -> Bool colorEditable = isLabel shapeEditable : Object -> Bool shapeEditable = isLabel fontSizeEditable : Object -> Bool fontSizeEditable _ = True urlEditable : Object -> Bool urlEditable = isLabel --
elm
[ { "context": "-- Copyright 2018 Gregor Uhlenheuer\n--\n-- Licensed under the Apache License, Version ", "end": 35, "score": 0.9998848438, "start": 18, "tag": "NAME", "value": "Gregor Uhlenheuer" } ]
client/src/View/Buildings.elm
kongo2002/ogonek
1
-- Copyright 2018 Gregor Uhlenheuer -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. module View.Buildings exposing (buildings) import Const import Dict import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick) import Routing import Types exposing (..) import Utils exposing (buildingLevel, capacityPercent, zonedIso8601) import View.Utils exposing (..) type alias ResourceRow = { name : ResourceType , resources : Int , capacity : Int , production : Int } buildings : ActivePlanet -> Model -> List (Html Msg) buildings active model = let planet = active.planet cap = active.capacity prod = active.production name = planetName planet header name0 = th [] [ text name0 ] rHeader resource = th [ class "text-centered" ] [ resourceIcon resource ] buildings0 = Dict.values active.buildings res = active.resources maxConstr = maxConcurrentConstructions active numConstr = Dict.size active.constructions toRow = buildingRow model active (maxConstr > numConstr) desc rowDesc = let progStr = capacityPercent rowDesc.resources rowDesc.capacity hasProduction = rowDesc.production > 0 prodStr = if hasProduction then String.fromInt rowDesc.production ++ " /h" else "" prodTitle = if hasProduction then [ title prodStr ] else [] prodSpan = if hasProduction then [ span [ class "mobile light" ] [ text <| " (" ++ prodStr ++ ")" ] ] else [] in div ([ class "resource four columns" ] ++ prodTitle) [ div [ class "meter" ] [ h6 [ class "description" ] ([ resourceIcon rowDesc.name , span [ class "spaced" ] [ numberSpan rowDesc.resources ] ] ++ prodSpan ) , span [ style "width" progStr ] [] ] ] constructionInfo = if maxConstr <= numConstr then div [ class "row cinfo" ] [ p [] [ text ("Max. number of concurrent constructions: " ++ String.fromInt maxConstr) ] ] else div [] [] filterButton filter = let isActive = active.buildingsFilter == filter name0 = buildingFilterName filter click = onClick (SetBuildingsFilter filter) cls = if isActive then [ class "button-primary u-full-width", click ] else [ class "u-full-width", click ] in div [ class "four columns" ] [ button cls [ text name0 ] ] buildingFilters = div [ class "row" ] [ filterButton AllBuildings , filterButton AvailableBuildings , filterButton InProgressBuildings ] filteredBuildings = case active.buildingsFilter of AllBuildings -> buildings0 AvailableBuildings -> if maxConstr > numConstr then let possible = buildPossible res in List.filter possible buildings0 else [] InProgressBuildings -> let inProgress b = Dict.member b.name active.constructions in List.filter inProgress buildings0 groupedBuildings = Utils.groupBy .group filteredBuildings groupedRows ( group, buildings1 ) = let translated = translateBuildingGroup group header0 = tr [ class "subheader" ] [ td [ colspan 14 ] [ text translated ] ] rows = List.map toRow buildings1 in header0 :: rows energies = [ ResourceRow Workers res.workers 0 0 , ResourceRow Power res.power 0 0 ] resourceRow1 = [ ResourceRow IronOre res.ironOre cap.ironOre prod.ironOre , ResourceRow Gold res.gold cap.gold prod.gold , ResourceRow H2O res.h2o cap.h2o prod.h2o ] resourceRow2 = [ ResourceRow Oil res.oil cap.oil prod.oil , ResourceRow H2 res.h2 cap.h2 prod.h2 , ResourceRow Uranium res.uranium cap.uranium prod.uranium ] resourceRow3 = [ ResourceRow PVC res.pvc cap.pvc prod.pvc , ResourceRow Titan res.titan cap.titan prod.titan , ResourceRow Kyanite res.kyanite cap.kyanite prod.kyanite ] productionLink = let route = ProductionRoute planet.id link = Routing.routeToPath route title0 = title "Production" in span [ class "spaced", toRight, title0 ] [ a [ href link ] [ icon "sliders-h" ] ] in [ h2 [] [ text name ] , h3 [] [ text "Resources", productionLink ] , div [ id "resources" ] [ div [ class "row" ] (List.map desc energies) , div [ class "row" ] (List.map desc resourceRow1) , div [ class "row" ] (List.map desc resourceRow2) , div [ class "row" ] (List.map desc resourceRow3) ] , div [ class "row" ] [ h3 [] [ text "Buildings" ] , constructionInfo , buildingFilters , table [ id "buildings", class "table-responsive table-resources u-full-width" ] [ thead [] [ tr [] [ header Const.building , header Const.level , rHeader Workers , rHeader Power , rHeader IronOre , rHeader Gold , rHeader H2O , rHeader Oil , rHeader H2 , rHeader Uranium , rHeader PVC , rHeader Titan , rHeader Kyanite , header "" ] ] , tbody [] (Dict.toList groupedBuildings |> List.concatMap groupedRows) ] ] ] buildingFilterName : BuildingsFilter -> String buildingFilterName filter = case filter of AllBuildings -> "all" AvailableBuildings -> "available" InProgressBuildings -> "in progress" maxConcurrentConstructions : ActivePlanet -> Int maxConcurrentConstructions planet = let ccLevel = buildingLevel planet "construction_center" in ccLevel // 10 + 1 buildingRow : Model -> ActivePlanet -> Bool -> BuildingInfo -> Html Msg buildingRow model planet constrPossible binfo = let col label val relative = let dataLabel = attribute "data-label" label attrs = if val == relative then [ class "no-mobile", dataLabel ] else [ dataLabel ] in td attrs [ numberSpanTo relative val ] rCol resource = col (translateResource resource) res = planet.resources construction = Dict.get binfo.name planet.constructions buildColumns = [ rCol Workers binfo.workers res.workers , rCol Power binfo.power res.power , rCol IronOre binfo.ironOre res.ironOre , rCol Gold binfo.gold res.gold , rCol H2O binfo.h2o res.h2o , rCol Oil binfo.oil res.oil , rCol H2 binfo.h2 res.h2 , rCol Uranium binfo.uranium res.uranium , rCol PVC binfo.pvc res.pvc , rCol Titan binfo.titan res.titan , rCol Kyanite binfo.kyanite res.kyanite ] columns = case construction of Just constr -> [ td [ class "operations", colspan 12 ] [ constructionOperation model constr ] ] Nothing -> buildColumns ++ [ td [ class "operations" ] [ buildOperation constrPossible res binfo ] ] name = let route = BuildingRoute binfo.name translated = translateBuilding binfo link = Routing.routeToPath route in a [ href link ] [ text translated ] in tr [] ([ td [ class "header" ] [ name ] , col Const.level binfo.level -1 ] ++ columns ) constructionOperation : Model -> ConstructionInfo -> Html Msg constructionOperation model constr = let finishStr = zonedIso8601 model constr.finish finish = title ("finished: " ++ finishStr) durationDesc = case model.lastTimeStamp of Just now -> "finished in " ++ Utils.deltaToString (Utils.posixDelta constr.finish now) ++ " " Nothing -> "in construction " in button [ class "icon inactive construction", finish ] [ span [] [ text durationDesc ] , span [] [ icon "gavel" ] ] buildOperation : Bool -> ResourceInfo -> BuildingInfo -> Html Msg buildOperation constrPossible res binfo = let possible = constrPossible && buildPossible res binfo buildReq = BuildBuildingRequest res.planetId binfo.name (binfo.level + 1) request = ApiRequest buildReq duration = Utils.deltaToString binfo.duration buildCls = if possible then [ numbClick request, class "button-primary" ] else [ class "inactive" ] desc = span [ class "description" ] [ text <| "Build (" ++ duration ++ ") " ] in button (title duration :: class "icon" :: buildCls) [ desc, icon "cog" ] buildPossible : ResourceInfo -> BuildingInfo -> Bool buildPossible res info = res.workers >= info.workers && res.power >= info.power && res.ironOre >= info.ironOre && res.gold >= info.gold && res.h2o >= info.h2o && res.oil >= info.oil && res.h2 >= info.h2 && res.uranium >= info.uranium && res.pvc >= info.pvc && res.titan >= info.titan && res.kyanite >= info.kyanite -- vim: et sw=2 sts=2
55515
-- Copyright 2018 <NAME> -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. module View.Buildings exposing (buildings) import Const import Dict import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick) import Routing import Types exposing (..) import Utils exposing (buildingLevel, capacityPercent, zonedIso8601) import View.Utils exposing (..) type alias ResourceRow = { name : ResourceType , resources : Int , capacity : Int , production : Int } buildings : ActivePlanet -> Model -> List (Html Msg) buildings active model = let planet = active.planet cap = active.capacity prod = active.production name = planetName planet header name0 = th [] [ text name0 ] rHeader resource = th [ class "text-centered" ] [ resourceIcon resource ] buildings0 = Dict.values active.buildings res = active.resources maxConstr = maxConcurrentConstructions active numConstr = Dict.size active.constructions toRow = buildingRow model active (maxConstr > numConstr) desc rowDesc = let progStr = capacityPercent rowDesc.resources rowDesc.capacity hasProduction = rowDesc.production > 0 prodStr = if hasProduction then String.fromInt rowDesc.production ++ " /h" else "" prodTitle = if hasProduction then [ title prodStr ] else [] prodSpan = if hasProduction then [ span [ class "mobile light" ] [ text <| " (" ++ prodStr ++ ")" ] ] else [] in div ([ class "resource four columns" ] ++ prodTitle) [ div [ class "meter" ] [ h6 [ class "description" ] ([ resourceIcon rowDesc.name , span [ class "spaced" ] [ numberSpan rowDesc.resources ] ] ++ prodSpan ) , span [ style "width" progStr ] [] ] ] constructionInfo = if maxConstr <= numConstr then div [ class "row cinfo" ] [ p [] [ text ("Max. number of concurrent constructions: " ++ String.fromInt maxConstr) ] ] else div [] [] filterButton filter = let isActive = active.buildingsFilter == filter name0 = buildingFilterName filter click = onClick (SetBuildingsFilter filter) cls = if isActive then [ class "button-primary u-full-width", click ] else [ class "u-full-width", click ] in div [ class "four columns" ] [ button cls [ text name0 ] ] buildingFilters = div [ class "row" ] [ filterButton AllBuildings , filterButton AvailableBuildings , filterButton InProgressBuildings ] filteredBuildings = case active.buildingsFilter of AllBuildings -> buildings0 AvailableBuildings -> if maxConstr > numConstr then let possible = buildPossible res in List.filter possible buildings0 else [] InProgressBuildings -> let inProgress b = Dict.member b.name active.constructions in List.filter inProgress buildings0 groupedBuildings = Utils.groupBy .group filteredBuildings groupedRows ( group, buildings1 ) = let translated = translateBuildingGroup group header0 = tr [ class "subheader" ] [ td [ colspan 14 ] [ text translated ] ] rows = List.map toRow buildings1 in header0 :: rows energies = [ ResourceRow Workers res.workers 0 0 , ResourceRow Power res.power 0 0 ] resourceRow1 = [ ResourceRow IronOre res.ironOre cap.ironOre prod.ironOre , ResourceRow Gold res.gold cap.gold prod.gold , ResourceRow H2O res.h2o cap.h2o prod.h2o ] resourceRow2 = [ ResourceRow Oil res.oil cap.oil prod.oil , ResourceRow H2 res.h2 cap.h2 prod.h2 , ResourceRow Uranium res.uranium cap.uranium prod.uranium ] resourceRow3 = [ ResourceRow PVC res.pvc cap.pvc prod.pvc , ResourceRow Titan res.titan cap.titan prod.titan , ResourceRow Kyanite res.kyanite cap.kyanite prod.kyanite ] productionLink = let route = ProductionRoute planet.id link = Routing.routeToPath route title0 = title "Production" in span [ class "spaced", toRight, title0 ] [ a [ href link ] [ icon "sliders-h" ] ] in [ h2 [] [ text name ] , h3 [] [ text "Resources", productionLink ] , div [ id "resources" ] [ div [ class "row" ] (List.map desc energies) , div [ class "row" ] (List.map desc resourceRow1) , div [ class "row" ] (List.map desc resourceRow2) , div [ class "row" ] (List.map desc resourceRow3) ] , div [ class "row" ] [ h3 [] [ text "Buildings" ] , constructionInfo , buildingFilters , table [ id "buildings", class "table-responsive table-resources u-full-width" ] [ thead [] [ tr [] [ header Const.building , header Const.level , rHeader Workers , rHeader Power , rHeader IronOre , rHeader Gold , rHeader H2O , rHeader Oil , rHeader H2 , rHeader Uranium , rHeader PVC , rHeader Titan , rHeader Kyanite , header "" ] ] , tbody [] (Dict.toList groupedBuildings |> List.concatMap groupedRows) ] ] ] buildingFilterName : BuildingsFilter -> String buildingFilterName filter = case filter of AllBuildings -> "all" AvailableBuildings -> "available" InProgressBuildings -> "in progress" maxConcurrentConstructions : ActivePlanet -> Int maxConcurrentConstructions planet = let ccLevel = buildingLevel planet "construction_center" in ccLevel // 10 + 1 buildingRow : Model -> ActivePlanet -> Bool -> BuildingInfo -> Html Msg buildingRow model planet constrPossible binfo = let col label val relative = let dataLabel = attribute "data-label" label attrs = if val == relative then [ class "no-mobile", dataLabel ] else [ dataLabel ] in td attrs [ numberSpanTo relative val ] rCol resource = col (translateResource resource) res = planet.resources construction = Dict.get binfo.name planet.constructions buildColumns = [ rCol Workers binfo.workers res.workers , rCol Power binfo.power res.power , rCol IronOre binfo.ironOre res.ironOre , rCol Gold binfo.gold res.gold , rCol H2O binfo.h2o res.h2o , rCol Oil binfo.oil res.oil , rCol H2 binfo.h2 res.h2 , rCol Uranium binfo.uranium res.uranium , rCol PVC binfo.pvc res.pvc , rCol Titan binfo.titan res.titan , rCol Kyanite binfo.kyanite res.kyanite ] columns = case construction of Just constr -> [ td [ class "operations", colspan 12 ] [ constructionOperation model constr ] ] Nothing -> buildColumns ++ [ td [ class "operations" ] [ buildOperation constrPossible res binfo ] ] name = let route = BuildingRoute binfo.name translated = translateBuilding binfo link = Routing.routeToPath route in a [ href link ] [ text translated ] in tr [] ([ td [ class "header" ] [ name ] , col Const.level binfo.level -1 ] ++ columns ) constructionOperation : Model -> ConstructionInfo -> Html Msg constructionOperation model constr = let finishStr = zonedIso8601 model constr.finish finish = title ("finished: " ++ finishStr) durationDesc = case model.lastTimeStamp of Just now -> "finished in " ++ Utils.deltaToString (Utils.posixDelta constr.finish now) ++ " " Nothing -> "in construction " in button [ class "icon inactive construction", finish ] [ span [] [ text durationDesc ] , span [] [ icon "gavel" ] ] buildOperation : Bool -> ResourceInfo -> BuildingInfo -> Html Msg buildOperation constrPossible res binfo = let possible = constrPossible && buildPossible res binfo buildReq = BuildBuildingRequest res.planetId binfo.name (binfo.level + 1) request = ApiRequest buildReq duration = Utils.deltaToString binfo.duration buildCls = if possible then [ numbClick request, class "button-primary" ] else [ class "inactive" ] desc = span [ class "description" ] [ text <| "Build (" ++ duration ++ ") " ] in button (title duration :: class "icon" :: buildCls) [ desc, icon "cog" ] buildPossible : ResourceInfo -> BuildingInfo -> Bool buildPossible res info = res.workers >= info.workers && res.power >= info.power && res.ironOre >= info.ironOre && res.gold >= info.gold && res.h2o >= info.h2o && res.oil >= info.oil && res.h2 >= info.h2 && res.uranium >= info.uranium && res.pvc >= info.pvc && res.titan >= info.titan && res.kyanite >= info.kyanite -- vim: et sw=2 sts=2
true
-- Copyright 2018 PI:NAME:<NAME>END_PI -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. module View.Buildings exposing (buildings) import Const import Dict import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick) import Routing import Types exposing (..) import Utils exposing (buildingLevel, capacityPercent, zonedIso8601) import View.Utils exposing (..) type alias ResourceRow = { name : ResourceType , resources : Int , capacity : Int , production : Int } buildings : ActivePlanet -> Model -> List (Html Msg) buildings active model = let planet = active.planet cap = active.capacity prod = active.production name = planetName planet header name0 = th [] [ text name0 ] rHeader resource = th [ class "text-centered" ] [ resourceIcon resource ] buildings0 = Dict.values active.buildings res = active.resources maxConstr = maxConcurrentConstructions active numConstr = Dict.size active.constructions toRow = buildingRow model active (maxConstr > numConstr) desc rowDesc = let progStr = capacityPercent rowDesc.resources rowDesc.capacity hasProduction = rowDesc.production > 0 prodStr = if hasProduction then String.fromInt rowDesc.production ++ " /h" else "" prodTitle = if hasProduction then [ title prodStr ] else [] prodSpan = if hasProduction then [ span [ class "mobile light" ] [ text <| " (" ++ prodStr ++ ")" ] ] else [] in div ([ class "resource four columns" ] ++ prodTitle) [ div [ class "meter" ] [ h6 [ class "description" ] ([ resourceIcon rowDesc.name , span [ class "spaced" ] [ numberSpan rowDesc.resources ] ] ++ prodSpan ) , span [ style "width" progStr ] [] ] ] constructionInfo = if maxConstr <= numConstr then div [ class "row cinfo" ] [ p [] [ text ("Max. number of concurrent constructions: " ++ String.fromInt maxConstr) ] ] else div [] [] filterButton filter = let isActive = active.buildingsFilter == filter name0 = buildingFilterName filter click = onClick (SetBuildingsFilter filter) cls = if isActive then [ class "button-primary u-full-width", click ] else [ class "u-full-width", click ] in div [ class "four columns" ] [ button cls [ text name0 ] ] buildingFilters = div [ class "row" ] [ filterButton AllBuildings , filterButton AvailableBuildings , filterButton InProgressBuildings ] filteredBuildings = case active.buildingsFilter of AllBuildings -> buildings0 AvailableBuildings -> if maxConstr > numConstr then let possible = buildPossible res in List.filter possible buildings0 else [] InProgressBuildings -> let inProgress b = Dict.member b.name active.constructions in List.filter inProgress buildings0 groupedBuildings = Utils.groupBy .group filteredBuildings groupedRows ( group, buildings1 ) = let translated = translateBuildingGroup group header0 = tr [ class "subheader" ] [ td [ colspan 14 ] [ text translated ] ] rows = List.map toRow buildings1 in header0 :: rows energies = [ ResourceRow Workers res.workers 0 0 , ResourceRow Power res.power 0 0 ] resourceRow1 = [ ResourceRow IronOre res.ironOre cap.ironOre prod.ironOre , ResourceRow Gold res.gold cap.gold prod.gold , ResourceRow H2O res.h2o cap.h2o prod.h2o ] resourceRow2 = [ ResourceRow Oil res.oil cap.oil prod.oil , ResourceRow H2 res.h2 cap.h2 prod.h2 , ResourceRow Uranium res.uranium cap.uranium prod.uranium ] resourceRow3 = [ ResourceRow PVC res.pvc cap.pvc prod.pvc , ResourceRow Titan res.titan cap.titan prod.titan , ResourceRow Kyanite res.kyanite cap.kyanite prod.kyanite ] productionLink = let route = ProductionRoute planet.id link = Routing.routeToPath route title0 = title "Production" in span [ class "spaced", toRight, title0 ] [ a [ href link ] [ icon "sliders-h" ] ] in [ h2 [] [ text name ] , h3 [] [ text "Resources", productionLink ] , div [ id "resources" ] [ div [ class "row" ] (List.map desc energies) , div [ class "row" ] (List.map desc resourceRow1) , div [ class "row" ] (List.map desc resourceRow2) , div [ class "row" ] (List.map desc resourceRow3) ] , div [ class "row" ] [ h3 [] [ text "Buildings" ] , constructionInfo , buildingFilters , table [ id "buildings", class "table-responsive table-resources u-full-width" ] [ thead [] [ tr [] [ header Const.building , header Const.level , rHeader Workers , rHeader Power , rHeader IronOre , rHeader Gold , rHeader H2O , rHeader Oil , rHeader H2 , rHeader Uranium , rHeader PVC , rHeader Titan , rHeader Kyanite , header "" ] ] , tbody [] (Dict.toList groupedBuildings |> List.concatMap groupedRows) ] ] ] buildingFilterName : BuildingsFilter -> String buildingFilterName filter = case filter of AllBuildings -> "all" AvailableBuildings -> "available" InProgressBuildings -> "in progress" maxConcurrentConstructions : ActivePlanet -> Int maxConcurrentConstructions planet = let ccLevel = buildingLevel planet "construction_center" in ccLevel // 10 + 1 buildingRow : Model -> ActivePlanet -> Bool -> BuildingInfo -> Html Msg buildingRow model planet constrPossible binfo = let col label val relative = let dataLabel = attribute "data-label" label attrs = if val == relative then [ class "no-mobile", dataLabel ] else [ dataLabel ] in td attrs [ numberSpanTo relative val ] rCol resource = col (translateResource resource) res = planet.resources construction = Dict.get binfo.name planet.constructions buildColumns = [ rCol Workers binfo.workers res.workers , rCol Power binfo.power res.power , rCol IronOre binfo.ironOre res.ironOre , rCol Gold binfo.gold res.gold , rCol H2O binfo.h2o res.h2o , rCol Oil binfo.oil res.oil , rCol H2 binfo.h2 res.h2 , rCol Uranium binfo.uranium res.uranium , rCol PVC binfo.pvc res.pvc , rCol Titan binfo.titan res.titan , rCol Kyanite binfo.kyanite res.kyanite ] columns = case construction of Just constr -> [ td [ class "operations", colspan 12 ] [ constructionOperation model constr ] ] Nothing -> buildColumns ++ [ td [ class "operations" ] [ buildOperation constrPossible res binfo ] ] name = let route = BuildingRoute binfo.name translated = translateBuilding binfo link = Routing.routeToPath route in a [ href link ] [ text translated ] in tr [] ([ td [ class "header" ] [ name ] , col Const.level binfo.level -1 ] ++ columns ) constructionOperation : Model -> ConstructionInfo -> Html Msg constructionOperation model constr = let finishStr = zonedIso8601 model constr.finish finish = title ("finished: " ++ finishStr) durationDesc = case model.lastTimeStamp of Just now -> "finished in " ++ Utils.deltaToString (Utils.posixDelta constr.finish now) ++ " " Nothing -> "in construction " in button [ class "icon inactive construction", finish ] [ span [] [ text durationDesc ] , span [] [ icon "gavel" ] ] buildOperation : Bool -> ResourceInfo -> BuildingInfo -> Html Msg buildOperation constrPossible res binfo = let possible = constrPossible && buildPossible res binfo buildReq = BuildBuildingRequest res.planetId binfo.name (binfo.level + 1) request = ApiRequest buildReq duration = Utils.deltaToString binfo.duration buildCls = if possible then [ numbClick request, class "button-primary" ] else [ class "inactive" ] desc = span [ class "description" ] [ text <| "Build (" ++ duration ++ ") " ] in button (title duration :: class "icon" :: buildCls) [ desc, icon "cog" ] buildPossible : ResourceInfo -> BuildingInfo -> Bool buildPossible res info = res.workers >= info.workers && res.power >= info.power && res.ironOre >= info.ironOre && res.gold >= info.gold && res.h2o >= info.h2o && res.oil >= info.oil && res.h2 >= info.h2 && res.uranium >= info.uranium && res.pvc >= info.pvc && res.titan >= info.titan && res.kyanite >= info.kyanite -- vim: et sw=2 sts=2
elm
[ { "context": "`javascript\nvar app = Elm.MyThing.worker({ user: 'Tom', token: 1234 });\n```\n\nWhatever argument you prov", "end": 2305, "score": 0.8541795611, "start": 2302, "tag": "USERNAME", "value": "Tom" }, { "context": "ar app = Elm.MyThing.worker({ user: 'Tom', token: 1234 });\n```\n\nWhatever argument you provide to `worker", "end": 2319, "score": 0.7858486176, "start": 2315, "tag": "PASSWORD", "value": "1234" } ]
src/Platform.elm
dbrgn/elm-core
0
module Platform exposing ( Program, program, programWithFlags , Task, ProcessId , Router, sendToApp, sendToSelf ) {-| # Programs @docs Program, program, programWithFlags # Platform Internals ## Tasks and Processes @docs Task, ProcessId ## Effect Manager Helpers An extremely tiny portion of library authors should ever write effect managers. Fundamentally, Elm needs maybe 10 of them total. I get that people are smart, curious, etc. but that is not a substitute for a legitimate reason to make an effect manager. Do you have an *organic need* this fills? Or are you just curious? Public discussions of your explorations should be framed accordingly. @docs Router, sendToApp, sendToSelf -} import Basics exposing (Never) import Elm.Kernel.Platform import Elm.Kernel.Scheduler import Platform.Cmd exposing (Cmd) import Platform.Sub exposing (Sub) -- PROGRAMS {-| A `Program` describes how to manage your Elm app. You can create [headless][] programs with the [`program`](#program) and [`programWithFlags`](#programWithFlags) functions. Similar functions exist in [`Html`][html] that let you specify a view. [headless]: https://en.wikipedia.org/wiki/Headless_software [html]: http://package.elm-lang.org/packages/elm-lang/html/latest/Html Honestly, it is totally normal if this seems crazy at first. The best way to understand is to work through [guide.elm-lang.org](http://guide.elm-lang.org/). It makes way more sense in context! -} type Program flags model msg = Program {-| Create a [headless][] program. This is great if you want to use Elm as the &ldquo;brain&rdquo; for something else. You can still communicate with JS via ports and manage your model, you just do not have to specify a `view`. [headless]: https://en.wikipedia.org/wiki/Headless_software Initializing a headless program from JavaScript looks like this: ```javascript var app = Elm.MyThing.worker(); ``` -} program : { init : (model, Cmd msg) , update : msg -> model -> (model, Cmd msg) , subscriptions : model -> Sub msg } -> Program Never model msg program = Elm.Kernel.Platform.program {-| Same as [`program`](#program), but you can provide flags. Initializing a headless program (with flags) from JavaScript looks like this: ```javascript var app = Elm.MyThing.worker({ user: 'Tom', token: 1234 }); ``` Whatever argument you provide to `worker` will get converted to an Elm value, allowing you to configure your Elm program however you want from JavaScript! -} programWithFlags : { init : flags -> (model, Cmd msg) , update : msg -> model -> (model, Cmd msg) , subscriptions : model -> Sub msg } -> Program flags model msg programWithFlags = Elm.Kernel.Platform.programWithFlags -- TASKS and PROCESSES {-| Head over to the documentation for the [`Task`](Task) module for more information on this. It is only defined here because it is a platform primitive. -} type Task err ok = Task {-| Head over to the documentation for the [`Process`](Process) module for information on this. It is only defined here because it is a platform primitive. -} type ProcessId = ProcessId -- EFFECT MANAGER INTERNALS {-| An effect manager has access to a “router” that routes messages between the main app and your individual effect manager. -} type Router appMsg selfMsg = Router {-| Send the router a message for the main loop of your app. This message will be handled by the overall `update` function, just like events from `Html`. -} sendToApp : Router msg a -> msg -> Task x () sendToApp = Elm.Kernel.Platform.sendToApp {-| Send the router a message for your effect manager. This message will be routed to the `onSelfMsg` function, where you can update the state of your effect manager as necessary. As an example, the effect manager for web sockets -} sendToSelf : Router a msg -> msg -> Task x () sendToSelf = Elm.Kernel.Platform.sendToSelf hack = Elm.Kernel.Scheduler.succeed
2944
module Platform exposing ( Program, program, programWithFlags , Task, ProcessId , Router, sendToApp, sendToSelf ) {-| # Programs @docs Program, program, programWithFlags # Platform Internals ## Tasks and Processes @docs Task, ProcessId ## Effect Manager Helpers An extremely tiny portion of library authors should ever write effect managers. Fundamentally, Elm needs maybe 10 of them total. I get that people are smart, curious, etc. but that is not a substitute for a legitimate reason to make an effect manager. Do you have an *organic need* this fills? Or are you just curious? Public discussions of your explorations should be framed accordingly. @docs Router, sendToApp, sendToSelf -} import Basics exposing (Never) import Elm.Kernel.Platform import Elm.Kernel.Scheduler import Platform.Cmd exposing (Cmd) import Platform.Sub exposing (Sub) -- PROGRAMS {-| A `Program` describes how to manage your Elm app. You can create [headless][] programs with the [`program`](#program) and [`programWithFlags`](#programWithFlags) functions. Similar functions exist in [`Html`][html] that let you specify a view. [headless]: https://en.wikipedia.org/wiki/Headless_software [html]: http://package.elm-lang.org/packages/elm-lang/html/latest/Html Honestly, it is totally normal if this seems crazy at first. The best way to understand is to work through [guide.elm-lang.org](http://guide.elm-lang.org/). It makes way more sense in context! -} type Program flags model msg = Program {-| Create a [headless][] program. This is great if you want to use Elm as the &ldquo;brain&rdquo; for something else. You can still communicate with JS via ports and manage your model, you just do not have to specify a `view`. [headless]: https://en.wikipedia.org/wiki/Headless_software Initializing a headless program from JavaScript looks like this: ```javascript var app = Elm.MyThing.worker(); ``` -} program : { init : (model, Cmd msg) , update : msg -> model -> (model, Cmd msg) , subscriptions : model -> Sub msg } -> Program Never model msg program = Elm.Kernel.Platform.program {-| Same as [`program`](#program), but you can provide flags. Initializing a headless program (with flags) from JavaScript looks like this: ```javascript var app = Elm.MyThing.worker({ user: 'Tom', token: <PASSWORD> }); ``` Whatever argument you provide to `worker` will get converted to an Elm value, allowing you to configure your Elm program however you want from JavaScript! -} programWithFlags : { init : flags -> (model, Cmd msg) , update : msg -> model -> (model, Cmd msg) , subscriptions : model -> Sub msg } -> Program flags model msg programWithFlags = Elm.Kernel.Platform.programWithFlags -- TASKS and PROCESSES {-| Head over to the documentation for the [`Task`](Task) module for more information on this. It is only defined here because it is a platform primitive. -} type Task err ok = Task {-| Head over to the documentation for the [`Process`](Process) module for information on this. It is only defined here because it is a platform primitive. -} type ProcessId = ProcessId -- EFFECT MANAGER INTERNALS {-| An effect manager has access to a “router” that routes messages between the main app and your individual effect manager. -} type Router appMsg selfMsg = Router {-| Send the router a message for the main loop of your app. This message will be handled by the overall `update` function, just like events from `Html`. -} sendToApp : Router msg a -> msg -> Task x () sendToApp = Elm.Kernel.Platform.sendToApp {-| Send the router a message for your effect manager. This message will be routed to the `onSelfMsg` function, where you can update the state of your effect manager as necessary. As an example, the effect manager for web sockets -} sendToSelf : Router a msg -> msg -> Task x () sendToSelf = Elm.Kernel.Platform.sendToSelf hack = Elm.Kernel.Scheduler.succeed
true
module Platform exposing ( Program, program, programWithFlags , Task, ProcessId , Router, sendToApp, sendToSelf ) {-| # Programs @docs Program, program, programWithFlags # Platform Internals ## Tasks and Processes @docs Task, ProcessId ## Effect Manager Helpers An extremely tiny portion of library authors should ever write effect managers. Fundamentally, Elm needs maybe 10 of them total. I get that people are smart, curious, etc. but that is not a substitute for a legitimate reason to make an effect manager. Do you have an *organic need* this fills? Or are you just curious? Public discussions of your explorations should be framed accordingly. @docs Router, sendToApp, sendToSelf -} import Basics exposing (Never) import Elm.Kernel.Platform import Elm.Kernel.Scheduler import Platform.Cmd exposing (Cmd) import Platform.Sub exposing (Sub) -- PROGRAMS {-| A `Program` describes how to manage your Elm app. You can create [headless][] programs with the [`program`](#program) and [`programWithFlags`](#programWithFlags) functions. Similar functions exist in [`Html`][html] that let you specify a view. [headless]: https://en.wikipedia.org/wiki/Headless_software [html]: http://package.elm-lang.org/packages/elm-lang/html/latest/Html Honestly, it is totally normal if this seems crazy at first. The best way to understand is to work through [guide.elm-lang.org](http://guide.elm-lang.org/). It makes way more sense in context! -} type Program flags model msg = Program {-| Create a [headless][] program. This is great if you want to use Elm as the &ldquo;brain&rdquo; for something else. You can still communicate with JS via ports and manage your model, you just do not have to specify a `view`. [headless]: https://en.wikipedia.org/wiki/Headless_software Initializing a headless program from JavaScript looks like this: ```javascript var app = Elm.MyThing.worker(); ``` -} program : { init : (model, Cmd msg) , update : msg -> model -> (model, Cmd msg) , subscriptions : model -> Sub msg } -> Program Never model msg program = Elm.Kernel.Platform.program {-| Same as [`program`](#program), but you can provide flags. Initializing a headless program (with flags) from JavaScript looks like this: ```javascript var app = Elm.MyThing.worker({ user: 'Tom', token: PI:PASSWORD:<PASSWORD>END_PI }); ``` Whatever argument you provide to `worker` will get converted to an Elm value, allowing you to configure your Elm program however you want from JavaScript! -} programWithFlags : { init : flags -> (model, Cmd msg) , update : msg -> model -> (model, Cmd msg) , subscriptions : model -> Sub msg } -> Program flags model msg programWithFlags = Elm.Kernel.Platform.programWithFlags -- TASKS and PROCESSES {-| Head over to the documentation for the [`Task`](Task) module for more information on this. It is only defined here because it is a platform primitive. -} type Task err ok = Task {-| Head over to the documentation for the [`Process`](Process) module for information on this. It is only defined here because it is a platform primitive. -} type ProcessId = ProcessId -- EFFECT MANAGER INTERNALS {-| An effect manager has access to a “router” that routes messages between the main app and your individual effect manager. -} type Router appMsg selfMsg = Router {-| Send the router a message for the main loop of your app. This message will be handled by the overall `update` function, just like events from `Html`. -} sendToApp : Router msg a -> msg -> Task x () sendToApp = Elm.Kernel.Platform.sendToApp {-| Send the router a message for your effect manager. This message will be routed to the `onSelfMsg` function, where you can update the state of your effect manager as necessary. As an example, the effect manager for web sockets -} sendToSelf : Router a msg -> msg -> Task x () sendToSelf = Elm.Kernel.Platform.sendToSelf hack = Elm.Kernel.Scheduler.succeed
elm
[ { "context": "ionary.\n\n animals = fromList [ (\"Tom\", Cat), (\"Jerry\", Mouse) ]\n\n get \"Tom\" animals == Just C", "end": 6435, "score": 0.5455937386, "start": 6434, "tag": "NAME", "value": "J" }, { "context": " from lowest to highest.\n\n keys (fromList [(0,\"Alice\"),(1,\"Bob\")]) == [0,1]\n\nkeys: Dict.Dict k v -> Li", "end": 7976, "score": 0.9722595811, "start": 7971, "tag": "NAME", "value": "Alice" }, { "context": " to highest.\n\n keys (fromList [(0,\"Alice\"),(1,\"Bob\")]) == [0,1]\n\nkeys: Dict.Dict k v -> List k\n-}\nke", "end": 7986, "score": 0.6529858112, "start": 7983, "tag": "NAME", "value": "Bob" }, { "context": "e order of their keys.\n\n values (fromList [(0,\"Alice\"),(1,\"Bob\")]) == [\"Alice\", \"Bob\"]\n\nvalues: Dict.D", "end": 8685, "score": 0.9863500595, "start": 8680, "tag": "NAME", "value": "Alice" }, { "context": "heir keys.\n\n values (fromList [(0,\"Alice\"),(1,\"Bob\")]) == [\"Alice\", \"Bob\"]\n\nvalues: Dict.Dict k v ->", "end": 8695, "score": 0.8976173997, "start": 8692, "tag": "NAME", "value": "Bob" }, { "context": " values (fromList [(0,\"Alice\"),(1,\"Bob\")]) == [\"Alice\", \"Bob\"]\n\nvalues: Dict.Dict k v -> List v\n-}\nvalu", "end": 8710, "score": 0.8884318471, "start": 8705, "tag": "NAME", "value": "Alice" }, { "context": " (fromList [(0,\"Alice\"),(1,\"Bob\")]) == [\"Alice\", \"Bob\"]\n\nvalues: Dict.Dict k v -> List v\n-}\nvalues : El", "end": 8717, "score": 0.6103367805, "start": 8714, "tag": "NAME", "value": "Bob" } ]
cli/gen-package/codegen/Gen/Dict.elm
miniBill/elm-prefab
19
module Gen.Dict exposing (annotation_, call_, diff, empty, filter, foldl, foldr, fromList, get, insert, intersect, isEmpty, keys, map, member, merge, moduleName_, partition, remove, singleton, size, toList, union, update, values, values_) {-| @docs moduleName_, empty, singleton, insert, update, remove, isEmpty, member, get, size, keys, values, toList, fromList, map, foldl, foldr, filter, partition, union, intersect, diff, merge, annotation_, call_, values_ -} import Elm import Elm.Annotation as Type {-| The name of this module. -} moduleName_ : List String moduleName_ = [ "Dict" ] {-| Create an empty dictionary. empty: Dict.Dict k v -} empty : Elm.Expression empty = Elm.value { importFrom = [ "Dict" ] , name = "empty" , annotation = Just (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ) } {-| Create a dictionary with one key-value pair. singleton: comparable -> v -> Dict.Dict comparable v -} singleton : Elm.Expression -> Elm.Expression -> Elm.Expression singleton arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "singleton" , annotation = Just (Type.function [ Type.var "comparable", Type.var "v" ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Insert a key-value pair into a dictionary. Replaces value when there is a collision. insert: comparable -> v -> Dict.Dict comparable v -> Dict.Dict comparable v -} insert : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression insert arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "insert" , annotation = Just (Type.function [ Type.var "comparable" , Type.var "v" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0, arg1 ] {-| Update the value of a dictionary for a specific key with a given function. update: comparable -> (Maybe v -> Maybe v) -> Dict.Dict comparable v -> Dict.Dict comparable v -} update : Elm.Expression -> (Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression update arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "update" , annotation = Just (Type.function [ Type.var "comparable" , Type.function [ Type.maybe (Type.var "v") ] (Type.maybe (Type.var "v")) , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, Elm.functionReduced "unpack" arg0, arg1 ] {-| Remove a key-value pair from a dictionary. If the key is not found, no changes are made. remove: comparable -> Dict.Dict comparable v -> Dict.Dict comparable v -} remove : Elm.Expression -> Elm.Expression -> Elm.Expression remove arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "remove" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Determine if a dictionary is empty. isEmpty empty == True isEmpty: Dict.Dict k v -> Bool -} isEmpty : Elm.Expression -> Elm.Expression isEmpty arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "isEmpty" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.bool ) } ) [ arg ] {-| Determine if a key is in a dictionary. member: comparable -> Dict.Dict comparable v -> Bool -} member : Elm.Expression -> Elm.Expression -> Elm.Expression member arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "member" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] Type.bool ) } ) [ arg, arg0 ] {-| Get the value associated with a key. If the key is not found, return `Nothing`. This is useful when you are not sure if a key will be in the dictionary. animals = fromList [ ("Tom", Cat), ("Jerry", Mouse) ] get "Tom" animals == Just Cat get "Jerry" animals == Just Mouse get "Spike" animals == Nothing get: comparable -> Dict.Dict comparable v -> Maybe v -} get : Elm.Expression -> Elm.Expression -> Elm.Expression get arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "get" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.maybe (Type.var "v")) ) } ) [ arg, arg0 ] {-| Determine the number of key-value pairs in the dictionary. size: Dict.Dict k v -> Int -} size : Elm.Expression -> Elm.Expression size arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "size" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.int ) } ) [ arg ] {-| Get all of the keys in a dictionary, sorted from lowest to highest. keys (fromList [(0,"Alice"),(1,"Bob")]) == [0,1] keys: Dict.Dict k v -> List k -} keys : Elm.Expression -> Elm.Expression keys arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "keys" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "k")) ) } ) [ arg ] {-| Get all of the values in a dictionary, in the order of their keys. values (fromList [(0,"Alice"),(1,"Bob")]) == ["Alice", "Bob"] values: Dict.Dict k v -> List v -} values : Elm.Expression -> Elm.Expression values arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "values" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "v")) ) } ) [ arg ] {-| Convert a dictionary into an association list of key-value pairs, sorted by keys. toList: Dict.Dict k v -> List ( k, v ) -} toList : Elm.Expression -> Elm.Expression toList arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "toList" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.tuple (Type.var "k") (Type.var "v"))) ) } ) [ arg ] {-| Convert an association list into a dictionary. fromList: List ( comparable, v ) -> Dict.Dict comparable v -} fromList : List Elm.Expression -> Elm.Expression fromList arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "fromList" , annotation = Just (Type.function [ Type.list (Type.tuple (Type.var "comparable") (Type.var "v")) ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ Elm.list arg ] {-| Apply a function to all values in a dictionary. map: (k -> a -> b) -> Dict.Dict k a -> Dict.Dict k b -} map : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression map arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "map" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "a" ] (Type.var "b") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "a" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "b" ] ) ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (arg unpack)) , arg0 ] {-| Fold over the key-value pairs in a dictionary from lowest key to highest key. import Dict exposing (Dict) getAges : Dict String User -> List String getAges users = Dict.foldl addAge [] users addAge : String -> User -> List String -> List String addAge _ user ages = user.age :: ages -- getAges users == [33,19,28] foldl: (k -> v -> b -> b) -> b -> Dict.Dict k v -> b -} foldl : (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression -> Elm.Expression foldl arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldl" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg unpack unpack0) ) ) , arg0 , arg1 ] {-| Fold over the key-value pairs in a dictionary from highest key to lowest key. import Dict exposing (Dict) getAges : Dict String User -> List String getAges users = Dict.foldr addAge [] users addAge : String -> User -> List String -> List String addAge _ user ages = user.age :: ages -- getAges users == [28,19,33] foldr: (k -> v -> b -> b) -> b -> Dict.Dict k v -> b -} foldr : (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression -> Elm.Expression foldr arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldr" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg unpack unpack0) ) ) , arg0 , arg1 ] {-| Keep only the key-value pairs that pass the given test. filter: (comparable -> v -> Bool) -> Dict.Dict comparable v -> Dict.Dict comparable v -} filter : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression filter arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "filter" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (arg unpack)) , arg0 ] {-| Partition a dictionary according to some test. The first dictionary contains all key-value pairs which passed the test, and the second contains the pairs that did not. partition: (comparable -> v -> Bool) -> Dict.Dict comparable v -> ( Dict.Dict comparable v, Dict.Dict comparable v ) -} partition : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression partition arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "partition" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.tuple (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (arg unpack)) , arg0 ] {-| Combine two dictionaries. If there is a collision, preference is given to the first dictionary. union: Dict.Dict comparable v -> Dict.Dict comparable v -> Dict.Dict comparable v -} union : Elm.Expression -> Elm.Expression -> Elm.Expression union arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "union" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Keep a key-value pair when its key appears in the second dictionary. Preference is given to values in the first dictionary. intersect: Dict.Dict comparable v -> Dict.Dict comparable v -> Dict.Dict comparable v -} intersect : Elm.Expression -> Elm.Expression -> Elm.Expression intersect arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "intersect" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Keep a key-value pair when its key does not appear in the second dictionary. diff: Dict.Dict comparable a -> Dict.Dict comparable b -> Dict.Dict comparable a -} diff : Elm.Expression -> Elm.Expression -> Elm.Expression diff arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "diff" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] ) ) } ) [ arg, arg0 ] {-| The most general way of combining two dictionaries. You provide three accumulators for when a given key appears: 1. Only in the left dictionary. 2. In both dictionaries. 3. Only in the right dictionary. You then traverse all the keys from lowest to highest, building up whatever you want. merge: (comparable -> a -> result -> result) -> (comparable -> a -> b -> result -> result) -> (comparable -> b -> result -> result) -> Dict.Dict comparable a -> Dict.Dict comparable b -> result -> result -} merge : (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression merge arg arg0 arg1 arg2 arg3 arg4 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "merge" , annotation = Just (Type.function [ Type.function [ Type.var "comparable" , Type.var "a" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "a" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] , Type.var "result" ] (Type.var "result") ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg unpack unpack0) ) ) , Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (\unpack_4_3_4_3_0 -> Elm.functionReduced "unpack" (arg0 unpack unpack0 unpack_4_3_4_3_0) ) ) ) , Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg1 unpack unpack0) ) ) , arg2 , arg3 , arg4 ] annotation_ : { dict : Type.Annotation -> Type.Annotation -> Type.Annotation } annotation_ = { dict = \arg0 arg1 -> Type.namedWith moduleName_ "Dict" [ arg0, arg1 ] } call_ : { singleton : Elm.Expression -> Elm.Expression -> Elm.Expression , insert : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , update : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , remove : Elm.Expression -> Elm.Expression -> Elm.Expression , isEmpty : Elm.Expression -> Elm.Expression , member : Elm.Expression -> Elm.Expression -> Elm.Expression , get : Elm.Expression -> Elm.Expression -> Elm.Expression , size : Elm.Expression -> Elm.Expression , keys : Elm.Expression -> Elm.Expression , values : Elm.Expression -> Elm.Expression , toList : Elm.Expression -> Elm.Expression , fromList : Elm.Expression -> Elm.Expression , map : Elm.Expression -> Elm.Expression -> Elm.Expression , foldl : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , foldr : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , filter : Elm.Expression -> Elm.Expression -> Elm.Expression , partition : Elm.Expression -> Elm.Expression -> Elm.Expression , union : Elm.Expression -> Elm.Expression -> Elm.Expression , intersect : Elm.Expression -> Elm.Expression -> Elm.Expression , diff : Elm.Expression -> Elm.Expression -> Elm.Expression , merge : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression } call_ = { singleton = \arg arg0 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "singleton" , annotation = Just (Type.function [ Type.var "comparable", Type.var "v" ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] , insert = \arg arg1 arg2 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "insert" , annotation = Just (Type.function [ Type.var "comparable" , Type.var "v" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg1, arg2 ] , update = \arg arg2 arg3 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "update" , annotation = Just (Type.function [ Type.var "comparable" , Type.function [ Type.maybe (Type.var "v") ] (Type.maybe (Type.var "v")) , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg2, arg3 ] , remove = \arg arg3 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "remove" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg3 ] , isEmpty = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "isEmpty" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.bool ) } ) [ arg ] , member = \arg arg5 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "member" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] Type.bool ) } ) [ arg, arg5 ] , get = \arg arg6 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "get" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.maybe (Type.var "v")) ) } ) [ arg, arg6 ] , size = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "size" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.int ) } ) [ arg ] , keys = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "keys" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "k")) ) } ) [ arg ] , values = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "values" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "v")) ) } ) [ arg ] , toList = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "toList" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.tuple (Type.var "k") (Type.var "v")) ) ) } ) [ arg ] , fromList = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "fromList" , annotation = Just (Type.function [ Type.list (Type.tuple (Type.var "comparable") (Type.var "v") ) ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg ] , map = \arg arg12 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "map" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "a" ] (Type.var "b") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "a" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "b" ] ) ) } ) [ arg, arg12 ] , foldl = \arg arg13 arg14 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldl" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ arg, arg13, arg14 ] , foldr = \arg arg14 arg15 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldr" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ arg, arg14, arg15 ] , filter = \arg arg15 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "filter" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg15 ] , partition = \arg arg16 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "partition" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.tuple (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) ) } ) [ arg, arg16 ] , union = \arg arg17 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "union" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg17 ] , intersect = \arg arg18 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "intersect" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg18 ] , diff = \arg arg19 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "diff" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] ) ) } ) [ arg, arg19 ] , merge = \arg arg20 arg21 arg22 arg23 arg24 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "merge" , annotation = Just (Type.function [ Type.function [ Type.var "comparable" , Type.var "a" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "a" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] , Type.var "result" ] (Type.var "result") ) } ) [ arg, arg20, arg21, arg22, arg23, arg24 ] } values_ : { empty : Elm.Expression , singleton : Elm.Expression , insert : Elm.Expression , update : Elm.Expression , remove : Elm.Expression , isEmpty : Elm.Expression , member : Elm.Expression , get : Elm.Expression , size : Elm.Expression , keys : Elm.Expression , values : Elm.Expression , toList : Elm.Expression , fromList : Elm.Expression , map : Elm.Expression , foldl : Elm.Expression , foldr : Elm.Expression , filter : Elm.Expression , partition : Elm.Expression , union : Elm.Expression , intersect : Elm.Expression , diff : Elm.Expression , merge : Elm.Expression } values_ = { empty = Elm.value { importFrom = [ "Dict" ] , name = "empty" , annotation = Just (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ) } , singleton = Elm.value { importFrom = [ "Dict" ] , name = "singleton" , annotation = Just (Type.function [ Type.var "comparable", Type.var "v" ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , insert = Elm.value { importFrom = [ "Dict" ] , name = "insert" , annotation = Just (Type.function [ Type.var "comparable" , Type.var "v" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , update = Elm.value { importFrom = [ "Dict" ] , name = "update" , annotation = Just (Type.function [ Type.var "comparable" , Type.function [ Type.maybe (Type.var "v") ] (Type.maybe (Type.var "v")) , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , remove = Elm.value { importFrom = [ "Dict" ] , name = "remove" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , isEmpty = Elm.value { importFrom = [ "Dict" ] , name = "isEmpty" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.bool ) } , member = Elm.value { importFrom = [ "Dict" ] , name = "member" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] Type.bool ) } , get = Elm.value { importFrom = [ "Dict" ] , name = "get" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.maybe (Type.var "v")) ) } , size = Elm.value { importFrom = [ "Dict" ] , name = "size" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.int ) } , keys = Elm.value { importFrom = [ "Dict" ] , name = "keys" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "k")) ) } , values = Elm.value { importFrom = [ "Dict" ] , name = "values" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "v")) ) } , toList = Elm.value { importFrom = [ "Dict" ] , name = "toList" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.tuple (Type.var "k") (Type.var "v"))) ) } , fromList = Elm.value { importFrom = [ "Dict" ] , name = "fromList" , annotation = Just (Type.function [ Type.list (Type.tuple (Type.var "comparable") (Type.var "v")) ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , map = Elm.value { importFrom = [ "Dict" ] , name = "map" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "a" ] (Type.var "b") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "a" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "b" ] ) ) } , foldl = Elm.value { importFrom = [ "Dict" ] , name = "foldl" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } , foldr = Elm.value { importFrom = [ "Dict" ] , name = "foldr" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } , filter = Elm.value { importFrom = [ "Dict" ] , name = "filter" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , partition = Elm.value { importFrom = [ "Dict" ] , name = "partition" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.tuple (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) ) } , union = Elm.value { importFrom = [ "Dict" ] , name = "union" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , intersect = Elm.value { importFrom = [ "Dict" ] , name = "intersect" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , diff = Elm.value { importFrom = [ "Dict" ] , name = "diff" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] ) ) } , merge = Elm.value { importFrom = [ "Dict" ] , name = "merge" , annotation = Just (Type.function [ Type.function [ Type.var "comparable" , Type.var "a" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "a" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] , Type.var "result" ] (Type.var "result") ) } }
26045
module Gen.Dict exposing (annotation_, call_, diff, empty, filter, foldl, foldr, fromList, get, insert, intersect, isEmpty, keys, map, member, merge, moduleName_, partition, remove, singleton, size, toList, union, update, values, values_) {-| @docs moduleName_, empty, singleton, insert, update, remove, isEmpty, member, get, size, keys, values, toList, fromList, map, foldl, foldr, filter, partition, union, intersect, diff, merge, annotation_, call_, values_ -} import Elm import Elm.Annotation as Type {-| The name of this module. -} moduleName_ : List String moduleName_ = [ "Dict" ] {-| Create an empty dictionary. empty: Dict.Dict k v -} empty : Elm.Expression empty = Elm.value { importFrom = [ "Dict" ] , name = "empty" , annotation = Just (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ) } {-| Create a dictionary with one key-value pair. singleton: comparable -> v -> Dict.Dict comparable v -} singleton : Elm.Expression -> Elm.Expression -> Elm.Expression singleton arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "singleton" , annotation = Just (Type.function [ Type.var "comparable", Type.var "v" ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Insert a key-value pair into a dictionary. Replaces value when there is a collision. insert: comparable -> v -> Dict.Dict comparable v -> Dict.Dict comparable v -} insert : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression insert arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "insert" , annotation = Just (Type.function [ Type.var "comparable" , Type.var "v" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0, arg1 ] {-| Update the value of a dictionary for a specific key with a given function. update: comparable -> (Maybe v -> Maybe v) -> Dict.Dict comparable v -> Dict.Dict comparable v -} update : Elm.Expression -> (Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression update arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "update" , annotation = Just (Type.function [ Type.var "comparable" , Type.function [ Type.maybe (Type.var "v") ] (Type.maybe (Type.var "v")) , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, Elm.functionReduced "unpack" arg0, arg1 ] {-| Remove a key-value pair from a dictionary. If the key is not found, no changes are made. remove: comparable -> Dict.Dict comparable v -> Dict.Dict comparable v -} remove : Elm.Expression -> Elm.Expression -> Elm.Expression remove arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "remove" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Determine if a dictionary is empty. isEmpty empty == True isEmpty: Dict.Dict k v -> Bool -} isEmpty : Elm.Expression -> Elm.Expression isEmpty arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "isEmpty" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.bool ) } ) [ arg ] {-| Determine if a key is in a dictionary. member: comparable -> Dict.Dict comparable v -> Bool -} member : Elm.Expression -> Elm.Expression -> Elm.Expression member arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "member" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] Type.bool ) } ) [ arg, arg0 ] {-| Get the value associated with a key. If the key is not found, return `Nothing`. This is useful when you are not sure if a key will be in the dictionary. animals = fromList [ ("Tom", Cat), ("<NAME>erry", Mouse) ] get "Tom" animals == Just Cat get "Jerry" animals == Just Mouse get "Spike" animals == Nothing get: comparable -> Dict.Dict comparable v -> Maybe v -} get : Elm.Expression -> Elm.Expression -> Elm.Expression get arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "get" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.maybe (Type.var "v")) ) } ) [ arg, arg0 ] {-| Determine the number of key-value pairs in the dictionary. size: Dict.Dict k v -> Int -} size : Elm.Expression -> Elm.Expression size arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "size" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.int ) } ) [ arg ] {-| Get all of the keys in a dictionary, sorted from lowest to highest. keys (fromList [(0,"<NAME>"),(1,"<NAME>")]) == [0,1] keys: Dict.Dict k v -> List k -} keys : Elm.Expression -> Elm.Expression keys arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "keys" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "k")) ) } ) [ arg ] {-| Get all of the values in a dictionary, in the order of their keys. values (fromList [(0,"<NAME>"),(1,"<NAME>")]) == ["<NAME>", "<NAME>"] values: Dict.Dict k v -> List v -} values : Elm.Expression -> Elm.Expression values arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "values" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "v")) ) } ) [ arg ] {-| Convert a dictionary into an association list of key-value pairs, sorted by keys. toList: Dict.Dict k v -> List ( k, v ) -} toList : Elm.Expression -> Elm.Expression toList arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "toList" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.tuple (Type.var "k") (Type.var "v"))) ) } ) [ arg ] {-| Convert an association list into a dictionary. fromList: List ( comparable, v ) -> Dict.Dict comparable v -} fromList : List Elm.Expression -> Elm.Expression fromList arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "fromList" , annotation = Just (Type.function [ Type.list (Type.tuple (Type.var "comparable") (Type.var "v")) ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ Elm.list arg ] {-| Apply a function to all values in a dictionary. map: (k -> a -> b) -> Dict.Dict k a -> Dict.Dict k b -} map : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression map arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "map" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "a" ] (Type.var "b") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "a" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "b" ] ) ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (arg unpack)) , arg0 ] {-| Fold over the key-value pairs in a dictionary from lowest key to highest key. import Dict exposing (Dict) getAges : Dict String User -> List String getAges users = Dict.foldl addAge [] users addAge : String -> User -> List String -> List String addAge _ user ages = user.age :: ages -- getAges users == [33,19,28] foldl: (k -> v -> b -> b) -> b -> Dict.Dict k v -> b -} foldl : (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression -> Elm.Expression foldl arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldl" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg unpack unpack0) ) ) , arg0 , arg1 ] {-| Fold over the key-value pairs in a dictionary from highest key to lowest key. import Dict exposing (Dict) getAges : Dict String User -> List String getAges users = Dict.foldr addAge [] users addAge : String -> User -> List String -> List String addAge _ user ages = user.age :: ages -- getAges users == [28,19,33] foldr: (k -> v -> b -> b) -> b -> Dict.Dict k v -> b -} foldr : (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression -> Elm.Expression foldr arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldr" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg unpack unpack0) ) ) , arg0 , arg1 ] {-| Keep only the key-value pairs that pass the given test. filter: (comparable -> v -> Bool) -> Dict.Dict comparable v -> Dict.Dict comparable v -} filter : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression filter arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "filter" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (arg unpack)) , arg0 ] {-| Partition a dictionary according to some test. The first dictionary contains all key-value pairs which passed the test, and the second contains the pairs that did not. partition: (comparable -> v -> Bool) -> Dict.Dict comparable v -> ( Dict.Dict comparable v, Dict.Dict comparable v ) -} partition : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression partition arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "partition" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.tuple (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (arg unpack)) , arg0 ] {-| Combine two dictionaries. If there is a collision, preference is given to the first dictionary. union: Dict.Dict comparable v -> Dict.Dict comparable v -> Dict.Dict comparable v -} union : Elm.Expression -> Elm.Expression -> Elm.Expression union arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "union" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Keep a key-value pair when its key appears in the second dictionary. Preference is given to values in the first dictionary. intersect: Dict.Dict comparable v -> Dict.Dict comparable v -> Dict.Dict comparable v -} intersect : Elm.Expression -> Elm.Expression -> Elm.Expression intersect arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "intersect" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Keep a key-value pair when its key does not appear in the second dictionary. diff: Dict.Dict comparable a -> Dict.Dict comparable b -> Dict.Dict comparable a -} diff : Elm.Expression -> Elm.Expression -> Elm.Expression diff arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "diff" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] ) ) } ) [ arg, arg0 ] {-| The most general way of combining two dictionaries. You provide three accumulators for when a given key appears: 1. Only in the left dictionary. 2. In both dictionaries. 3. Only in the right dictionary. You then traverse all the keys from lowest to highest, building up whatever you want. merge: (comparable -> a -> result -> result) -> (comparable -> a -> b -> result -> result) -> (comparable -> b -> result -> result) -> Dict.Dict comparable a -> Dict.Dict comparable b -> result -> result -} merge : (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression merge arg arg0 arg1 arg2 arg3 arg4 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "merge" , annotation = Just (Type.function [ Type.function [ Type.var "comparable" , Type.var "a" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "a" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] , Type.var "result" ] (Type.var "result") ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg unpack unpack0) ) ) , Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (\unpack_4_3_4_3_0 -> Elm.functionReduced "unpack" (arg0 unpack unpack0 unpack_4_3_4_3_0) ) ) ) , Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg1 unpack unpack0) ) ) , arg2 , arg3 , arg4 ] annotation_ : { dict : Type.Annotation -> Type.Annotation -> Type.Annotation } annotation_ = { dict = \arg0 arg1 -> Type.namedWith moduleName_ "Dict" [ arg0, arg1 ] } call_ : { singleton : Elm.Expression -> Elm.Expression -> Elm.Expression , insert : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , update : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , remove : Elm.Expression -> Elm.Expression -> Elm.Expression , isEmpty : Elm.Expression -> Elm.Expression , member : Elm.Expression -> Elm.Expression -> Elm.Expression , get : Elm.Expression -> Elm.Expression -> Elm.Expression , size : Elm.Expression -> Elm.Expression , keys : Elm.Expression -> Elm.Expression , values : Elm.Expression -> Elm.Expression , toList : Elm.Expression -> Elm.Expression , fromList : Elm.Expression -> Elm.Expression , map : Elm.Expression -> Elm.Expression -> Elm.Expression , foldl : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , foldr : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , filter : Elm.Expression -> Elm.Expression -> Elm.Expression , partition : Elm.Expression -> Elm.Expression -> Elm.Expression , union : Elm.Expression -> Elm.Expression -> Elm.Expression , intersect : Elm.Expression -> Elm.Expression -> Elm.Expression , diff : Elm.Expression -> Elm.Expression -> Elm.Expression , merge : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression } call_ = { singleton = \arg arg0 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "singleton" , annotation = Just (Type.function [ Type.var "comparable", Type.var "v" ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] , insert = \arg arg1 arg2 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "insert" , annotation = Just (Type.function [ Type.var "comparable" , Type.var "v" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg1, arg2 ] , update = \arg arg2 arg3 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "update" , annotation = Just (Type.function [ Type.var "comparable" , Type.function [ Type.maybe (Type.var "v") ] (Type.maybe (Type.var "v")) , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg2, arg3 ] , remove = \arg arg3 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "remove" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg3 ] , isEmpty = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "isEmpty" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.bool ) } ) [ arg ] , member = \arg arg5 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "member" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] Type.bool ) } ) [ arg, arg5 ] , get = \arg arg6 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "get" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.maybe (Type.var "v")) ) } ) [ arg, arg6 ] , size = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "size" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.int ) } ) [ arg ] , keys = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "keys" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "k")) ) } ) [ arg ] , values = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "values" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "v")) ) } ) [ arg ] , toList = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "toList" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.tuple (Type.var "k") (Type.var "v")) ) ) } ) [ arg ] , fromList = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "fromList" , annotation = Just (Type.function [ Type.list (Type.tuple (Type.var "comparable") (Type.var "v") ) ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg ] , map = \arg arg12 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "map" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "a" ] (Type.var "b") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "a" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "b" ] ) ) } ) [ arg, arg12 ] , foldl = \arg arg13 arg14 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldl" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ arg, arg13, arg14 ] , foldr = \arg arg14 arg15 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldr" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ arg, arg14, arg15 ] , filter = \arg arg15 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "filter" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg15 ] , partition = \arg arg16 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "partition" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.tuple (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) ) } ) [ arg, arg16 ] , union = \arg arg17 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "union" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg17 ] , intersect = \arg arg18 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "intersect" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg18 ] , diff = \arg arg19 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "diff" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] ) ) } ) [ arg, arg19 ] , merge = \arg arg20 arg21 arg22 arg23 arg24 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "merge" , annotation = Just (Type.function [ Type.function [ Type.var "comparable" , Type.var "a" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "a" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] , Type.var "result" ] (Type.var "result") ) } ) [ arg, arg20, arg21, arg22, arg23, arg24 ] } values_ : { empty : Elm.Expression , singleton : Elm.Expression , insert : Elm.Expression , update : Elm.Expression , remove : Elm.Expression , isEmpty : Elm.Expression , member : Elm.Expression , get : Elm.Expression , size : Elm.Expression , keys : Elm.Expression , values : Elm.Expression , toList : Elm.Expression , fromList : Elm.Expression , map : Elm.Expression , foldl : Elm.Expression , foldr : Elm.Expression , filter : Elm.Expression , partition : Elm.Expression , union : Elm.Expression , intersect : Elm.Expression , diff : Elm.Expression , merge : Elm.Expression } values_ = { empty = Elm.value { importFrom = [ "Dict" ] , name = "empty" , annotation = Just (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ) } , singleton = Elm.value { importFrom = [ "Dict" ] , name = "singleton" , annotation = Just (Type.function [ Type.var "comparable", Type.var "v" ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , insert = Elm.value { importFrom = [ "Dict" ] , name = "insert" , annotation = Just (Type.function [ Type.var "comparable" , Type.var "v" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , update = Elm.value { importFrom = [ "Dict" ] , name = "update" , annotation = Just (Type.function [ Type.var "comparable" , Type.function [ Type.maybe (Type.var "v") ] (Type.maybe (Type.var "v")) , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , remove = Elm.value { importFrom = [ "Dict" ] , name = "remove" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , isEmpty = Elm.value { importFrom = [ "Dict" ] , name = "isEmpty" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.bool ) } , member = Elm.value { importFrom = [ "Dict" ] , name = "member" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] Type.bool ) } , get = Elm.value { importFrom = [ "Dict" ] , name = "get" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.maybe (Type.var "v")) ) } , size = Elm.value { importFrom = [ "Dict" ] , name = "size" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.int ) } , keys = Elm.value { importFrom = [ "Dict" ] , name = "keys" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "k")) ) } , values = Elm.value { importFrom = [ "Dict" ] , name = "values" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "v")) ) } , toList = Elm.value { importFrom = [ "Dict" ] , name = "toList" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.tuple (Type.var "k") (Type.var "v"))) ) } , fromList = Elm.value { importFrom = [ "Dict" ] , name = "fromList" , annotation = Just (Type.function [ Type.list (Type.tuple (Type.var "comparable") (Type.var "v")) ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , map = Elm.value { importFrom = [ "Dict" ] , name = "map" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "a" ] (Type.var "b") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "a" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "b" ] ) ) } , foldl = Elm.value { importFrom = [ "Dict" ] , name = "foldl" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } , foldr = Elm.value { importFrom = [ "Dict" ] , name = "foldr" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } , filter = Elm.value { importFrom = [ "Dict" ] , name = "filter" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , partition = Elm.value { importFrom = [ "Dict" ] , name = "partition" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.tuple (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) ) } , union = Elm.value { importFrom = [ "Dict" ] , name = "union" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , intersect = Elm.value { importFrom = [ "Dict" ] , name = "intersect" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , diff = Elm.value { importFrom = [ "Dict" ] , name = "diff" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] ) ) } , merge = Elm.value { importFrom = [ "Dict" ] , name = "merge" , annotation = Just (Type.function [ Type.function [ Type.var "comparable" , Type.var "a" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "a" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] , Type.var "result" ] (Type.var "result") ) } }
true
module Gen.Dict exposing (annotation_, call_, diff, empty, filter, foldl, foldr, fromList, get, insert, intersect, isEmpty, keys, map, member, merge, moduleName_, partition, remove, singleton, size, toList, union, update, values, values_) {-| @docs moduleName_, empty, singleton, insert, update, remove, isEmpty, member, get, size, keys, values, toList, fromList, map, foldl, foldr, filter, partition, union, intersect, diff, merge, annotation_, call_, values_ -} import Elm import Elm.Annotation as Type {-| The name of this module. -} moduleName_ : List String moduleName_ = [ "Dict" ] {-| Create an empty dictionary. empty: Dict.Dict k v -} empty : Elm.Expression empty = Elm.value { importFrom = [ "Dict" ] , name = "empty" , annotation = Just (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ) } {-| Create a dictionary with one key-value pair. singleton: comparable -> v -> Dict.Dict comparable v -} singleton : Elm.Expression -> Elm.Expression -> Elm.Expression singleton arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "singleton" , annotation = Just (Type.function [ Type.var "comparable", Type.var "v" ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Insert a key-value pair into a dictionary. Replaces value when there is a collision. insert: comparable -> v -> Dict.Dict comparable v -> Dict.Dict comparable v -} insert : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression insert arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "insert" , annotation = Just (Type.function [ Type.var "comparable" , Type.var "v" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0, arg1 ] {-| Update the value of a dictionary for a specific key with a given function. update: comparable -> (Maybe v -> Maybe v) -> Dict.Dict comparable v -> Dict.Dict comparable v -} update : Elm.Expression -> (Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression update arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "update" , annotation = Just (Type.function [ Type.var "comparable" , Type.function [ Type.maybe (Type.var "v") ] (Type.maybe (Type.var "v")) , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, Elm.functionReduced "unpack" arg0, arg1 ] {-| Remove a key-value pair from a dictionary. If the key is not found, no changes are made. remove: comparable -> Dict.Dict comparable v -> Dict.Dict comparable v -} remove : Elm.Expression -> Elm.Expression -> Elm.Expression remove arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "remove" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Determine if a dictionary is empty. isEmpty empty == True isEmpty: Dict.Dict k v -> Bool -} isEmpty : Elm.Expression -> Elm.Expression isEmpty arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "isEmpty" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.bool ) } ) [ arg ] {-| Determine if a key is in a dictionary. member: comparable -> Dict.Dict comparable v -> Bool -} member : Elm.Expression -> Elm.Expression -> Elm.Expression member arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "member" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] Type.bool ) } ) [ arg, arg0 ] {-| Get the value associated with a key. If the key is not found, return `Nothing`. This is useful when you are not sure if a key will be in the dictionary. animals = fromList [ ("Tom", Cat), ("PI:NAME:<NAME>END_PIerry", Mouse) ] get "Tom" animals == Just Cat get "Jerry" animals == Just Mouse get "Spike" animals == Nothing get: comparable -> Dict.Dict comparable v -> Maybe v -} get : Elm.Expression -> Elm.Expression -> Elm.Expression get arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "get" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.maybe (Type.var "v")) ) } ) [ arg, arg0 ] {-| Determine the number of key-value pairs in the dictionary. size: Dict.Dict k v -> Int -} size : Elm.Expression -> Elm.Expression size arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "size" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.int ) } ) [ arg ] {-| Get all of the keys in a dictionary, sorted from lowest to highest. keys (fromList [(0,"PI:NAME:<NAME>END_PI"),(1,"PI:NAME:<NAME>END_PI")]) == [0,1] keys: Dict.Dict k v -> List k -} keys : Elm.Expression -> Elm.Expression keys arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "keys" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "k")) ) } ) [ arg ] {-| Get all of the values in a dictionary, in the order of their keys. values (fromList [(0,"PI:NAME:<NAME>END_PI"),(1,"PI:NAME:<NAME>END_PI")]) == ["PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI"] values: Dict.Dict k v -> List v -} values : Elm.Expression -> Elm.Expression values arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "values" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "v")) ) } ) [ arg ] {-| Convert a dictionary into an association list of key-value pairs, sorted by keys. toList: Dict.Dict k v -> List ( k, v ) -} toList : Elm.Expression -> Elm.Expression toList arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "toList" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.tuple (Type.var "k") (Type.var "v"))) ) } ) [ arg ] {-| Convert an association list into a dictionary. fromList: List ( comparable, v ) -> Dict.Dict comparable v -} fromList : List Elm.Expression -> Elm.Expression fromList arg = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "fromList" , annotation = Just (Type.function [ Type.list (Type.tuple (Type.var "comparable") (Type.var "v")) ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ Elm.list arg ] {-| Apply a function to all values in a dictionary. map: (k -> a -> b) -> Dict.Dict k a -> Dict.Dict k b -} map : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression map arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "map" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "a" ] (Type.var "b") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "a" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "b" ] ) ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (arg unpack)) , arg0 ] {-| Fold over the key-value pairs in a dictionary from lowest key to highest key. import Dict exposing (Dict) getAges : Dict String User -> List String getAges users = Dict.foldl addAge [] users addAge : String -> User -> List String -> List String addAge _ user ages = user.age :: ages -- getAges users == [33,19,28] foldl: (k -> v -> b -> b) -> b -> Dict.Dict k v -> b -} foldl : (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression -> Elm.Expression foldl arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldl" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg unpack unpack0) ) ) , arg0 , arg1 ] {-| Fold over the key-value pairs in a dictionary from highest key to lowest key. import Dict exposing (Dict) getAges : Dict String User -> List String getAges users = Dict.foldr addAge [] users addAge : String -> User -> List String -> List String addAge _ user ages = user.age :: ages -- getAges users == [28,19,33] foldr: (k -> v -> b -> b) -> b -> Dict.Dict k v -> b -} foldr : (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression -> Elm.Expression foldr arg arg0 arg1 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldr" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg unpack unpack0) ) ) , arg0 , arg1 ] {-| Keep only the key-value pairs that pass the given test. filter: (comparable -> v -> Bool) -> Dict.Dict comparable v -> Dict.Dict comparable v -} filter : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression filter arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "filter" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (arg unpack)) , arg0 ] {-| Partition a dictionary according to some test. The first dictionary contains all key-value pairs which passed the test, and the second contains the pairs that did not. partition: (comparable -> v -> Bool) -> Dict.Dict comparable v -> ( Dict.Dict comparable v, Dict.Dict comparable v ) -} partition : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression partition arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "partition" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.tuple (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (arg unpack)) , arg0 ] {-| Combine two dictionaries. If there is a collision, preference is given to the first dictionary. union: Dict.Dict comparable v -> Dict.Dict comparable v -> Dict.Dict comparable v -} union : Elm.Expression -> Elm.Expression -> Elm.Expression union arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "union" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Keep a key-value pair when its key appears in the second dictionary. Preference is given to values in the first dictionary. intersect: Dict.Dict comparable v -> Dict.Dict comparable v -> Dict.Dict comparable v -} intersect : Elm.Expression -> Elm.Expression -> Elm.Expression intersect arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "intersect" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] {-| Keep a key-value pair when its key does not appear in the second dictionary. diff: Dict.Dict comparable a -> Dict.Dict comparable b -> Dict.Dict comparable a -} diff : Elm.Expression -> Elm.Expression -> Elm.Expression diff arg arg0 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "diff" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] ) ) } ) [ arg, arg0 ] {-| The most general way of combining two dictionaries. You provide three accumulators for when a given key appears: 1. Only in the left dictionary. 2. In both dictionaries. 3. Only in the right dictionary. You then traverse all the keys from lowest to highest, building up whatever you want. merge: (comparable -> a -> result -> result) -> (comparable -> a -> b -> result -> result) -> (comparable -> b -> result -> result) -> Dict.Dict comparable a -> Dict.Dict comparable b -> result -> result -} merge : (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> (Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression merge arg arg0 arg1 arg2 arg3 arg4 = Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "merge" , annotation = Just (Type.function [ Type.function [ Type.var "comparable" , Type.var "a" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "a" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] , Type.var "result" ] (Type.var "result") ) } ) [ Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg unpack unpack0) ) ) , Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (\unpack_4_3_4_3_0 -> Elm.functionReduced "unpack" (arg0 unpack unpack0 unpack_4_3_4_3_0) ) ) ) , Elm.functionReduced "unpack" (\unpack -> Elm.functionReduced "unpack" (\unpack0 -> Elm.functionReduced "unpack" (arg1 unpack unpack0) ) ) , arg2 , arg3 , arg4 ] annotation_ : { dict : Type.Annotation -> Type.Annotation -> Type.Annotation } annotation_ = { dict = \arg0 arg1 -> Type.namedWith moduleName_ "Dict" [ arg0, arg1 ] } call_ : { singleton : Elm.Expression -> Elm.Expression -> Elm.Expression , insert : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , update : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , remove : Elm.Expression -> Elm.Expression -> Elm.Expression , isEmpty : Elm.Expression -> Elm.Expression , member : Elm.Expression -> Elm.Expression -> Elm.Expression , get : Elm.Expression -> Elm.Expression -> Elm.Expression , size : Elm.Expression -> Elm.Expression , keys : Elm.Expression -> Elm.Expression , values : Elm.Expression -> Elm.Expression , toList : Elm.Expression -> Elm.Expression , fromList : Elm.Expression -> Elm.Expression , map : Elm.Expression -> Elm.Expression -> Elm.Expression , foldl : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , foldr : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression , filter : Elm.Expression -> Elm.Expression -> Elm.Expression , partition : Elm.Expression -> Elm.Expression -> Elm.Expression , union : Elm.Expression -> Elm.Expression -> Elm.Expression , intersect : Elm.Expression -> Elm.Expression -> Elm.Expression , diff : Elm.Expression -> Elm.Expression -> Elm.Expression , merge : Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression -> Elm.Expression } call_ = { singleton = \arg arg0 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "singleton" , annotation = Just (Type.function [ Type.var "comparable", Type.var "v" ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg0 ] , insert = \arg arg1 arg2 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "insert" , annotation = Just (Type.function [ Type.var "comparable" , Type.var "v" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg1, arg2 ] , update = \arg arg2 arg3 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "update" , annotation = Just (Type.function [ Type.var "comparable" , Type.function [ Type.maybe (Type.var "v") ] (Type.maybe (Type.var "v")) , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg2, arg3 ] , remove = \arg arg3 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "remove" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg3 ] , isEmpty = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "isEmpty" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.bool ) } ) [ arg ] , member = \arg arg5 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "member" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] Type.bool ) } ) [ arg, arg5 ] , get = \arg arg6 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "get" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.maybe (Type.var "v")) ) } ) [ arg, arg6 ] , size = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "size" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.int ) } ) [ arg ] , keys = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "keys" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "k")) ) } ) [ arg ] , values = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "values" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "v")) ) } ) [ arg ] , toList = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "toList" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.tuple (Type.var "k") (Type.var "v")) ) ) } ) [ arg ] , fromList = \arg -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "fromList" , annotation = Just (Type.function [ Type.list (Type.tuple (Type.var "comparable") (Type.var "v") ) ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg ] , map = \arg arg12 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "map" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "a" ] (Type.var "b") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "a" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "b" ] ) ) } ) [ arg, arg12 ] , foldl = \arg arg13 arg14 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldl" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ arg, arg13, arg14 ] , foldr = \arg arg14 arg15 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "foldr" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } ) [ arg, arg14, arg15 ] , filter = \arg arg15 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "filter" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg15 ] , partition = \arg arg16 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "partition" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.tuple (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) ) } ) [ arg, arg16 ] , union = \arg arg17 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "union" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg17 ] , intersect = \arg arg18 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "intersect" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } ) [ arg, arg18 ] , diff = \arg arg19 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "diff" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] ) ) } ) [ arg, arg19 ] , merge = \arg arg20 arg21 arg22 arg23 arg24 -> Elm.apply (Elm.value { importFrom = [ "Dict" ] , name = "merge" , annotation = Just (Type.function [ Type.function [ Type.var "comparable" , Type.var "a" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "a" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] , Type.var "result" ] (Type.var "result") ) } ) [ arg, arg20, arg21, arg22, arg23, arg24 ] } values_ : { empty : Elm.Expression , singleton : Elm.Expression , insert : Elm.Expression , update : Elm.Expression , remove : Elm.Expression , isEmpty : Elm.Expression , member : Elm.Expression , get : Elm.Expression , size : Elm.Expression , keys : Elm.Expression , values : Elm.Expression , toList : Elm.Expression , fromList : Elm.Expression , map : Elm.Expression , foldl : Elm.Expression , foldr : Elm.Expression , filter : Elm.Expression , partition : Elm.Expression , union : Elm.Expression , intersect : Elm.Expression , diff : Elm.Expression , merge : Elm.Expression } values_ = { empty = Elm.value { importFrom = [ "Dict" ] , name = "empty" , annotation = Just (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ) } , singleton = Elm.value { importFrom = [ "Dict" ] , name = "singleton" , annotation = Just (Type.function [ Type.var "comparable", Type.var "v" ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , insert = Elm.value { importFrom = [ "Dict" ] , name = "insert" , annotation = Just (Type.function [ Type.var "comparable" , Type.var "v" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , update = Elm.value { importFrom = [ "Dict" ] , name = "update" , annotation = Just (Type.function [ Type.var "comparable" , Type.function [ Type.maybe (Type.var "v") ] (Type.maybe (Type.var "v")) , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , remove = Elm.value { importFrom = [ "Dict" ] , name = "remove" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , isEmpty = Elm.value { importFrom = [ "Dict" ] , name = "isEmpty" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.bool ) } , member = Elm.value { importFrom = [ "Dict" ] , name = "member" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] Type.bool ) } , get = Elm.value { importFrom = [ "Dict" ] , name = "get" , annotation = Just (Type.function [ Type.var "comparable" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.maybe (Type.var "v")) ) } , size = Elm.value { importFrom = [ "Dict" ] , name = "size" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] Type.int ) } , keys = Elm.value { importFrom = [ "Dict" ] , name = "keys" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "k")) ) } , values = Elm.value { importFrom = [ "Dict" ] , name = "values" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.var "v")) ) } , toList = Elm.value { importFrom = [ "Dict" ] , name = "toList" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.list (Type.tuple (Type.var "k") (Type.var "v"))) ) } , fromList = Elm.value { importFrom = [ "Dict" ] , name = "fromList" , annotation = Just (Type.function [ Type.list (Type.tuple (Type.var "comparable") (Type.var "v")) ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , map = Elm.value { importFrom = [ "Dict" ] , name = "map" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "a" ] (Type.var "b") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "a" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "b" ] ) ) } , foldl = Elm.value { importFrom = [ "Dict" ] , name = "foldl" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } , foldr = Elm.value { importFrom = [ "Dict" ] , name = "foldr" , annotation = Just (Type.function [ Type.function [ Type.var "k", Type.var "v", Type.var "b" ] (Type.var "b") , Type.var "b" , Type.namedWith [ "Dict" ] "Dict" [ Type.var "k", Type.var "v" ] ] (Type.var "b") ) } , filter = Elm.value { importFrom = [ "Dict" ] , name = "filter" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , partition = Elm.value { importFrom = [ "Dict" ] , name = "partition" , annotation = Just (Type.function [ Type.function [ Type.var "comparable", Type.var "v" ] Type.bool , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.tuple (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) ) } , union = Elm.value { importFrom = [ "Dict" ] , name = "union" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , intersect = Elm.value { importFrom = [ "Dict" ] , name = "intersect" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "v" ] ) ) } , diff = Elm.value { importFrom = [ "Dict" ] , name = "diff" , annotation = Just (Type.function [ Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] ] (Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] ) ) } , merge = Elm.value { importFrom = [ "Dict" ] , name = "merge" , annotation = Just (Type.function [ Type.function [ Type.var "comparable" , Type.var "a" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "a" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.function [ Type.var "comparable" , Type.var "b" , Type.var "result" ] (Type.var "result") , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "a" ] , Type.namedWith [ "Dict" ] "Dict" [ Type.var "comparable", Type.var "b" ] , Type.var "result" ] (Type.var "result") ) } }
elm
[ { "context": " , type_ (ifThenElse property.password \"password\" \"text\")\n , value (Dict.fetch prop", "end": 9768, "score": 0.9989799857, "start": 9760, "tag": "PASSWORD", "value": "password" }, { "context": ", type_ (ifThenElse property.password \"password\" \"text\")\n , value (Dict.fetch property.ke", "end": 9775, "score": 0.9959783554, "start": 9771, "tag": "PASSWORD", "value": "text" }, { "context": "\"\n , url = \"https://github.com/hacdias/webdav\"\n }\n , t", "end": 12955, "score": 0.9990352392, "start": 12948, "tag": "USERNAME", "value": "hacdias" } ]
src/Applications/UI/Sources/Form.elm
icidasset/isotach
8
module UI.Sources.Form exposing (..) import Chunky exposing (..) import Common exposing (boolFromString, boolToString) import Conditional exposing (..) import Dict.Ext as Dict import Html exposing (Html, text) import Html.Attributes exposing (for, name, placeholder, required, selected, type_, value) import Html.Events exposing (onInput, onSubmit) import List.Extra as List import Material.Icons as Icons import Material.Icons.Types exposing (Coloring(..)) import Sources exposing (..) import Sources.Services as Services import UI.Kit exposing (ButtonType(..), select) import UI.Navigation exposing (..) import UI.Page as Page import UI.Sources.Page as Sources import UI.Sources.Types exposing (..) -- 🌳 initialModel : Form initialModel = { step = Where , context = defaultContext } defaultContext : Source defaultContext = { id = "CHANGE_ME_PLEASE" , data = Services.initialData defaultService , directoryPlaylists = True , enabled = True , service = defaultService } defaultService : Service defaultService = Dropbox -- NEW type alias Arguments = { onboarding : Bool } new : Arguments -> Form -> List (Html Msg) new args model = case model.step of Where -> newWhere args model How -> newHow model By -> newBy model newWhere : Arguments -> Form -> List (Html Msg) newWhere { onboarding } { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Back to list" Hidden -- , if onboarding then NavigateToPage Page.Index else NavigateToPage (Page.Sources Sources.Index) ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form TakeStep [ UI.Kit.canisterForm h ] ) [ UI.Kit.h2 "Where is your music stored?" -- Dropdown ----------- , let contextServiceKey = Services.typeToKey context.service in Services.labels |> List.map (\( k, l ) -> Html.option [ value k, selected (contextServiceKey == k) ] [ text l ] ) |> select SelectService -- Button --------- , chunk [ "mt-10" ] [ UI.Kit.button IconOnly Bypass (Icons.arrow_forward 17 Inherit) ] ] ] newHow : Form -> List (Html Msg) newHow { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Take a step back" Shown , PerformMsg TakeStepBackwards ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form TakeStep [ chunk [ "text-left", "w-full" ] [ UI.Kit.canister h ] ] ) [ UI.Kit.h3 "Where exactly?" -- Note ------- , note context.service -- Fields --------- , let properties = Services.properties context.service dividingPoint = toFloat (List.length properties) / 2 ( listA, listB ) = List.splitAt (ceiling dividingPoint) properties in chunk [ "flex", "pt-3" ] [ chunk [ "flex-grow", "pr-4" ] (List.map (renderProperty context) listA) , chunk [ "flex-grow", "pl-4" ] (List.map (renderProperty context) listB) ] -- Button --------- , chunk [ "mt-3", "text-center" ] [ UI.Kit.button IconOnly Bypass (Icons.arrow_forward 17 Inherit) ] ] ] howNote : List (Html Msg) -> Html Msg howNote = chunk [ "text-sm" , "italic" , "leading-normal" , "max-w-lg" , "mb-8" ] newBy : Form -> List (Html Msg) newBy { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Take a step back" Shown , PerformMsg TakeStepBackwards ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form AddSourceUsingForm [ UI.Kit.canisterForm h ] ) [ UI.Kit.h2 "One last thing" , UI.Kit.label [] "What are we going to call this source?" -- Input -------- , let nameValue = Dict.fetch "name" "" context.data in chunk [ "flex" , "max-w-md" , "mt-8" , "mx-auto" , "justify-center" , "w-full" ] [ UI.Kit.textField [ name "name" , onInput (SetFormData "name") , value nameValue ] ] -- Note ------- , chunk [ "mt-16" ] (case context.service of AmazonS3 -> corsWarning "CORS__S3" AzureBlob -> corsWarning "CORS__Azure" AzureFile -> corsWarning "CORS__Azure" Btfs -> corsWarning "CORS__BTFS" Dropbox -> [] Google -> [] Ipfs -> corsWarning "CORS__IPFS" WebDav -> corsWarning "CORS__WebDAV" ) -- Button --------- , UI.Kit.button Normal Bypass (text "Add source") ] ] corsWarning : String -> List (Html Msg) corsWarning id = [ chunk [ "text-sm", "flex", "items-center", "justify-center", "leading-snug", "opacity-50" ] [ UI.Kit.inlineIcon Icons.warning , inline [ "font-semibold" ] [ text "Make sure CORS is enabled" ] ] , chunk [ "text-sm", "leading-snug", "mb-8", "mt-1", "opacity-50" ] [ text "You can find the instructions over " , UI.Kit.link { label = "here", url = "about/cors/#" ++ id } ] ] -- EDIT edit : Form -> List (Html Msg) edit { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Go Back" Shown , PerformMsg ReturnToIndex ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form EditSourceUsingForm [ chunk [ "text-left", "w-full" ] [ UI.Kit.canister h ] ] ) [ UI.Kit.h3 "Edit source" -- Note ------- , note context.service -- Fields --------- , let properties = Services.properties context.service dividingPoint = toFloat (List.length properties) / 2 ( listA, listB ) = List.splitAt (ceiling dividingPoint) properties in chunk [ "flex", "pt-3" ] [ chunk [ "flex-grow", "pr-4" ] (List.map (renderProperty context) listA) , chunk [ "flex-grow", "pl-4" ] (List.map (renderProperty context) listB) ] -- Button --------- , chunk [ "mt-3", "text-center" ] [ UI.Kit.button Normal Bypass (text "Save") ] ] ] -- PROPERTIES renderProperty : Source -> Property -> Html Msg renderProperty context property = chunk [ "mb-8" ] [ UI.Kit.label [ for property.key ] property.label -- , if (property.placeholder == boolToString True) || (property.placeholder == boolToString False) then let bool = context.data |> Dict.fetch property.key property.placeholder |> boolFromString in chunk [ "mt-2", "pt-1" ] [ UI.Kit.checkbox { checked = bool , toggleMsg = bool |> not |> boolToString |> SetFormData property.key } ] else UI.Kit.textField [ name property.key , onInput (SetFormData property.key) , placeholder property.placeholder , required (property.label |> String.toLower |> String.contains "optional" |> not) , type_ (ifThenElse property.password "password" "text") , value (Dict.fetch property.key "" context.data) ] ] -- ⚗️ form : Msg -> List (Html Msg) -> Html Msg form msg html = slab Html.form [ onSubmit msg ] [ "flex" , "flex-grow" , "flex-shrink-0" , "text-center" ] [ UI.Kit.centeredContent html ] note : Service -> Html Msg note service = case service of AmazonS3 -> nothing AzureBlob -> nothing AzureFile -> nothing Btfs -> howNote [ inline [ "font-semibold" ] [ text "Diffuse will try to use the default local gateway" ] , text "." , lineBreak , text "If you would like to use another gateway, please provide it below." , lineBreak , text "This is basically the same as the IPFS implementation, just with a different prefix." ] Dropbox -> howNote [ inline [ "font-semibold" ] [ text "If you don't know what any of this is, " , text "continue to the next screen." ] , text " Changing the app key allows you to use your own Dropbox app." , text " Also, make sure you verified your email address on Dropbox," , text " or this might not work." ] Google -> howNote [ inline [ "font-semibold" ] [ text "If you don't know what any of this is, " , text "continue to the next screen." ] , text " Changing the client stuff allows you to use your own Google OAuth client." , text " Disclaimer: " , text "The Google Drive API is fairly slow and limited, " , text "consider using a different service." ] Ipfs -> howNote [ inline [ "font-semibold" ] [ text "Diffuse will try to use the default local gateway" ] , text "." , lineBreak , text "If you would like to use another gateway, please provide it below." ] WebDav -> howNote [ inline [ "font-semibold" ] [ UI.Kit.inlineIcon Icons.warning , text "This app requires a proper implementation of " , UI.Kit.link { label = "CORS" , url = "https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS" } , text " on the server side." ] , lineBreak , text " WebDAV servers usually don't implement" , text " CORS properly, if at all." , lineBreak , text " Some servers, like " , UI.Kit.link { label = "this one" , url = "https://github.com/hacdias/webdav" } , text ", do. You can find the configuration for that server " , UI.Kit.link { label = "here" , url = "about/cors/#CORS__WebDAV" } , text "." ] -- RENAME rename : Form -> List (Html Msg) rename { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Go Back" Shown , PerformMsg ReturnToIndex ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form RenameSourceUsingForm [ UI.Kit.canisterForm h ] ) [ UI.Kit.h2 "Name your source" -- Input -------- , [ name "name" , onInput (SetFormData "name") , value (Dict.fetch "name" "" context.data) ] |> UI.Kit.textField |> chunky [ "max-w-md", "mx-auto" ] -- Button --------- , chunk [ "mt-10" ] [ UI.Kit.button Normal Bypass (text "Save") ] ] ]
42340
module UI.Sources.Form exposing (..) import Chunky exposing (..) import Common exposing (boolFromString, boolToString) import Conditional exposing (..) import Dict.Ext as Dict import Html exposing (Html, text) import Html.Attributes exposing (for, name, placeholder, required, selected, type_, value) import Html.Events exposing (onInput, onSubmit) import List.Extra as List import Material.Icons as Icons import Material.Icons.Types exposing (Coloring(..)) import Sources exposing (..) import Sources.Services as Services import UI.Kit exposing (ButtonType(..), select) import UI.Navigation exposing (..) import UI.Page as Page import UI.Sources.Page as Sources import UI.Sources.Types exposing (..) -- 🌳 initialModel : Form initialModel = { step = Where , context = defaultContext } defaultContext : Source defaultContext = { id = "CHANGE_ME_PLEASE" , data = Services.initialData defaultService , directoryPlaylists = True , enabled = True , service = defaultService } defaultService : Service defaultService = Dropbox -- NEW type alias Arguments = { onboarding : Bool } new : Arguments -> Form -> List (Html Msg) new args model = case model.step of Where -> newWhere args model How -> newHow model By -> newBy model newWhere : Arguments -> Form -> List (Html Msg) newWhere { onboarding } { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Back to list" Hidden -- , if onboarding then NavigateToPage Page.Index else NavigateToPage (Page.Sources Sources.Index) ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form TakeStep [ UI.Kit.canisterForm h ] ) [ UI.Kit.h2 "Where is your music stored?" -- Dropdown ----------- , let contextServiceKey = Services.typeToKey context.service in Services.labels |> List.map (\( k, l ) -> Html.option [ value k, selected (contextServiceKey == k) ] [ text l ] ) |> select SelectService -- Button --------- , chunk [ "mt-10" ] [ UI.Kit.button IconOnly Bypass (Icons.arrow_forward 17 Inherit) ] ] ] newHow : Form -> List (Html Msg) newHow { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Take a step back" Shown , PerformMsg TakeStepBackwards ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form TakeStep [ chunk [ "text-left", "w-full" ] [ UI.Kit.canister h ] ] ) [ UI.Kit.h3 "Where exactly?" -- Note ------- , note context.service -- Fields --------- , let properties = Services.properties context.service dividingPoint = toFloat (List.length properties) / 2 ( listA, listB ) = List.splitAt (ceiling dividingPoint) properties in chunk [ "flex", "pt-3" ] [ chunk [ "flex-grow", "pr-4" ] (List.map (renderProperty context) listA) , chunk [ "flex-grow", "pl-4" ] (List.map (renderProperty context) listB) ] -- Button --------- , chunk [ "mt-3", "text-center" ] [ UI.Kit.button IconOnly Bypass (Icons.arrow_forward 17 Inherit) ] ] ] howNote : List (Html Msg) -> Html Msg howNote = chunk [ "text-sm" , "italic" , "leading-normal" , "max-w-lg" , "mb-8" ] newBy : Form -> List (Html Msg) newBy { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Take a step back" Shown , PerformMsg TakeStepBackwards ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form AddSourceUsingForm [ UI.Kit.canisterForm h ] ) [ UI.Kit.h2 "One last thing" , UI.Kit.label [] "What are we going to call this source?" -- Input -------- , let nameValue = Dict.fetch "name" "" context.data in chunk [ "flex" , "max-w-md" , "mt-8" , "mx-auto" , "justify-center" , "w-full" ] [ UI.Kit.textField [ name "name" , onInput (SetFormData "name") , value nameValue ] ] -- Note ------- , chunk [ "mt-16" ] (case context.service of AmazonS3 -> corsWarning "CORS__S3" AzureBlob -> corsWarning "CORS__Azure" AzureFile -> corsWarning "CORS__Azure" Btfs -> corsWarning "CORS__BTFS" Dropbox -> [] Google -> [] Ipfs -> corsWarning "CORS__IPFS" WebDav -> corsWarning "CORS__WebDAV" ) -- Button --------- , UI.Kit.button Normal Bypass (text "Add source") ] ] corsWarning : String -> List (Html Msg) corsWarning id = [ chunk [ "text-sm", "flex", "items-center", "justify-center", "leading-snug", "opacity-50" ] [ UI.Kit.inlineIcon Icons.warning , inline [ "font-semibold" ] [ text "Make sure CORS is enabled" ] ] , chunk [ "text-sm", "leading-snug", "mb-8", "mt-1", "opacity-50" ] [ text "You can find the instructions over " , UI.Kit.link { label = "here", url = "about/cors/#" ++ id } ] ] -- EDIT edit : Form -> List (Html Msg) edit { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Go Back" Shown , PerformMsg ReturnToIndex ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form EditSourceUsingForm [ chunk [ "text-left", "w-full" ] [ UI.Kit.canister h ] ] ) [ UI.Kit.h3 "Edit source" -- Note ------- , note context.service -- Fields --------- , let properties = Services.properties context.service dividingPoint = toFloat (List.length properties) / 2 ( listA, listB ) = List.splitAt (ceiling dividingPoint) properties in chunk [ "flex", "pt-3" ] [ chunk [ "flex-grow", "pr-4" ] (List.map (renderProperty context) listA) , chunk [ "flex-grow", "pl-4" ] (List.map (renderProperty context) listB) ] -- Button --------- , chunk [ "mt-3", "text-center" ] [ UI.Kit.button Normal Bypass (text "Save") ] ] ] -- PROPERTIES renderProperty : Source -> Property -> Html Msg renderProperty context property = chunk [ "mb-8" ] [ UI.Kit.label [ for property.key ] property.label -- , if (property.placeholder == boolToString True) || (property.placeholder == boolToString False) then let bool = context.data |> Dict.fetch property.key property.placeholder |> boolFromString in chunk [ "mt-2", "pt-1" ] [ UI.Kit.checkbox { checked = bool , toggleMsg = bool |> not |> boolToString |> SetFormData property.key } ] else UI.Kit.textField [ name property.key , onInput (SetFormData property.key) , placeholder property.placeholder , required (property.label |> String.toLower |> String.contains "optional" |> not) , type_ (ifThenElse property.password "<PASSWORD>" "<PASSWORD>") , value (Dict.fetch property.key "" context.data) ] ] -- ⚗️ form : Msg -> List (Html Msg) -> Html Msg form msg html = slab Html.form [ onSubmit msg ] [ "flex" , "flex-grow" , "flex-shrink-0" , "text-center" ] [ UI.Kit.centeredContent html ] note : Service -> Html Msg note service = case service of AmazonS3 -> nothing AzureBlob -> nothing AzureFile -> nothing Btfs -> howNote [ inline [ "font-semibold" ] [ text "Diffuse will try to use the default local gateway" ] , text "." , lineBreak , text "If you would like to use another gateway, please provide it below." , lineBreak , text "This is basically the same as the IPFS implementation, just with a different prefix." ] Dropbox -> howNote [ inline [ "font-semibold" ] [ text "If you don't know what any of this is, " , text "continue to the next screen." ] , text " Changing the app key allows you to use your own Dropbox app." , text " Also, make sure you verified your email address on Dropbox," , text " or this might not work." ] Google -> howNote [ inline [ "font-semibold" ] [ text "If you don't know what any of this is, " , text "continue to the next screen." ] , text " Changing the client stuff allows you to use your own Google OAuth client." , text " Disclaimer: " , text "The Google Drive API is fairly slow and limited, " , text "consider using a different service." ] Ipfs -> howNote [ inline [ "font-semibold" ] [ text "Diffuse will try to use the default local gateway" ] , text "." , lineBreak , text "If you would like to use another gateway, please provide it below." ] WebDav -> howNote [ inline [ "font-semibold" ] [ UI.Kit.inlineIcon Icons.warning , text "This app requires a proper implementation of " , UI.Kit.link { label = "CORS" , url = "https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS" } , text " on the server side." ] , lineBreak , text " WebDAV servers usually don't implement" , text " CORS properly, if at all." , lineBreak , text " Some servers, like " , UI.Kit.link { label = "this one" , url = "https://github.com/hacdias/webdav" } , text ", do. You can find the configuration for that server " , UI.Kit.link { label = "here" , url = "about/cors/#CORS__WebDAV" } , text "." ] -- RENAME rename : Form -> List (Html Msg) rename { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Go Back" Shown , PerformMsg ReturnToIndex ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form RenameSourceUsingForm [ UI.Kit.canisterForm h ] ) [ UI.Kit.h2 "Name your source" -- Input -------- , [ name "name" , onInput (SetFormData "name") , value (Dict.fetch "name" "" context.data) ] |> UI.Kit.textField |> chunky [ "max-w-md", "mx-auto" ] -- Button --------- , chunk [ "mt-10" ] [ UI.Kit.button Normal Bypass (text "Save") ] ] ]
true
module UI.Sources.Form exposing (..) import Chunky exposing (..) import Common exposing (boolFromString, boolToString) import Conditional exposing (..) import Dict.Ext as Dict import Html exposing (Html, text) import Html.Attributes exposing (for, name, placeholder, required, selected, type_, value) import Html.Events exposing (onInput, onSubmit) import List.Extra as List import Material.Icons as Icons import Material.Icons.Types exposing (Coloring(..)) import Sources exposing (..) import Sources.Services as Services import UI.Kit exposing (ButtonType(..), select) import UI.Navigation exposing (..) import UI.Page as Page import UI.Sources.Page as Sources import UI.Sources.Types exposing (..) -- 🌳 initialModel : Form initialModel = { step = Where , context = defaultContext } defaultContext : Source defaultContext = { id = "CHANGE_ME_PLEASE" , data = Services.initialData defaultService , directoryPlaylists = True , enabled = True , service = defaultService } defaultService : Service defaultService = Dropbox -- NEW type alias Arguments = { onboarding : Bool } new : Arguments -> Form -> List (Html Msg) new args model = case model.step of Where -> newWhere args model How -> newHow model By -> newBy model newWhere : Arguments -> Form -> List (Html Msg) newWhere { onboarding } { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Back to list" Hidden -- , if onboarding then NavigateToPage Page.Index else NavigateToPage (Page.Sources Sources.Index) ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form TakeStep [ UI.Kit.canisterForm h ] ) [ UI.Kit.h2 "Where is your music stored?" -- Dropdown ----------- , let contextServiceKey = Services.typeToKey context.service in Services.labels |> List.map (\( k, l ) -> Html.option [ value k, selected (contextServiceKey == k) ] [ text l ] ) |> select SelectService -- Button --------- , chunk [ "mt-10" ] [ UI.Kit.button IconOnly Bypass (Icons.arrow_forward 17 Inherit) ] ] ] newHow : Form -> List (Html Msg) newHow { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Take a step back" Shown , PerformMsg TakeStepBackwards ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form TakeStep [ chunk [ "text-left", "w-full" ] [ UI.Kit.canister h ] ] ) [ UI.Kit.h3 "Where exactly?" -- Note ------- , note context.service -- Fields --------- , let properties = Services.properties context.service dividingPoint = toFloat (List.length properties) / 2 ( listA, listB ) = List.splitAt (ceiling dividingPoint) properties in chunk [ "flex", "pt-3" ] [ chunk [ "flex-grow", "pr-4" ] (List.map (renderProperty context) listA) , chunk [ "flex-grow", "pl-4" ] (List.map (renderProperty context) listB) ] -- Button --------- , chunk [ "mt-3", "text-center" ] [ UI.Kit.button IconOnly Bypass (Icons.arrow_forward 17 Inherit) ] ] ] howNote : List (Html Msg) -> Html Msg howNote = chunk [ "text-sm" , "italic" , "leading-normal" , "max-w-lg" , "mb-8" ] newBy : Form -> List (Html Msg) newBy { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Take a step back" Shown , PerformMsg TakeStepBackwards ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form AddSourceUsingForm [ UI.Kit.canisterForm h ] ) [ UI.Kit.h2 "One last thing" , UI.Kit.label [] "What are we going to call this source?" -- Input -------- , let nameValue = Dict.fetch "name" "" context.data in chunk [ "flex" , "max-w-md" , "mt-8" , "mx-auto" , "justify-center" , "w-full" ] [ UI.Kit.textField [ name "name" , onInput (SetFormData "name") , value nameValue ] ] -- Note ------- , chunk [ "mt-16" ] (case context.service of AmazonS3 -> corsWarning "CORS__S3" AzureBlob -> corsWarning "CORS__Azure" AzureFile -> corsWarning "CORS__Azure" Btfs -> corsWarning "CORS__BTFS" Dropbox -> [] Google -> [] Ipfs -> corsWarning "CORS__IPFS" WebDav -> corsWarning "CORS__WebDAV" ) -- Button --------- , UI.Kit.button Normal Bypass (text "Add source") ] ] corsWarning : String -> List (Html Msg) corsWarning id = [ chunk [ "text-sm", "flex", "items-center", "justify-center", "leading-snug", "opacity-50" ] [ UI.Kit.inlineIcon Icons.warning , inline [ "font-semibold" ] [ text "Make sure CORS is enabled" ] ] , chunk [ "text-sm", "leading-snug", "mb-8", "mt-1", "opacity-50" ] [ text "You can find the instructions over " , UI.Kit.link { label = "here", url = "about/cors/#" ++ id } ] ] -- EDIT edit : Form -> List (Html Msg) edit { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Go Back" Shown , PerformMsg ReturnToIndex ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form EditSourceUsingForm [ chunk [ "text-left", "w-full" ] [ UI.Kit.canister h ] ] ) [ UI.Kit.h3 "Edit source" -- Note ------- , note context.service -- Fields --------- , let properties = Services.properties context.service dividingPoint = toFloat (List.length properties) / 2 ( listA, listB ) = List.splitAt (ceiling dividingPoint) properties in chunk [ "flex", "pt-3" ] [ chunk [ "flex-grow", "pr-4" ] (List.map (renderProperty context) listA) , chunk [ "flex-grow", "pl-4" ] (List.map (renderProperty context) listB) ] -- Button --------- , chunk [ "mt-3", "text-center" ] [ UI.Kit.button Normal Bypass (text "Save") ] ] ] -- PROPERTIES renderProperty : Source -> Property -> Html Msg renderProperty context property = chunk [ "mb-8" ] [ UI.Kit.label [ for property.key ] property.label -- , if (property.placeholder == boolToString True) || (property.placeholder == boolToString False) then let bool = context.data |> Dict.fetch property.key property.placeholder |> boolFromString in chunk [ "mt-2", "pt-1" ] [ UI.Kit.checkbox { checked = bool , toggleMsg = bool |> not |> boolToString |> SetFormData property.key } ] else UI.Kit.textField [ name property.key , onInput (SetFormData property.key) , placeholder property.placeholder , required (property.label |> String.toLower |> String.contains "optional" |> not) , type_ (ifThenElse property.password "PI:PASSWORD:<PASSWORD>END_PI" "PI:PASSWORD:<PASSWORD>END_PI") , value (Dict.fetch property.key "" context.data) ] ] -- ⚗️ form : Msg -> List (Html Msg) -> Html Msg form msg html = slab Html.form [ onSubmit msg ] [ "flex" , "flex-grow" , "flex-shrink-0" , "text-center" ] [ UI.Kit.centeredContent html ] note : Service -> Html Msg note service = case service of AmazonS3 -> nothing AzureBlob -> nothing AzureFile -> nothing Btfs -> howNote [ inline [ "font-semibold" ] [ text "Diffuse will try to use the default local gateway" ] , text "." , lineBreak , text "If you would like to use another gateway, please provide it below." , lineBreak , text "This is basically the same as the IPFS implementation, just with a different prefix." ] Dropbox -> howNote [ inline [ "font-semibold" ] [ text "If you don't know what any of this is, " , text "continue to the next screen." ] , text " Changing the app key allows you to use your own Dropbox app." , text " Also, make sure you verified your email address on Dropbox," , text " or this might not work." ] Google -> howNote [ inline [ "font-semibold" ] [ text "If you don't know what any of this is, " , text "continue to the next screen." ] , text " Changing the client stuff allows you to use your own Google OAuth client." , text " Disclaimer: " , text "The Google Drive API is fairly slow and limited, " , text "consider using a different service." ] Ipfs -> howNote [ inline [ "font-semibold" ] [ text "Diffuse will try to use the default local gateway" ] , text "." , lineBreak , text "If you would like to use another gateway, please provide it below." ] WebDav -> howNote [ inline [ "font-semibold" ] [ UI.Kit.inlineIcon Icons.warning , text "This app requires a proper implementation of " , UI.Kit.link { label = "CORS" , url = "https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS" } , text " on the server side." ] , lineBreak , text " WebDAV servers usually don't implement" , text " CORS properly, if at all." , lineBreak , text " Some servers, like " , UI.Kit.link { label = "this one" , url = "https://github.com/hacdias/webdav" } , text ", do. You can find the configuration for that server " , UI.Kit.link { label = "here" , url = "about/cors/#CORS__WebDAV" } , text "." ] -- RENAME rename : Form -> List (Html Msg) rename { context } = [ ----------------------------------------- -- Navigation ----------------------------------------- UI.Navigation.local [ ( Icon Icons.arrow_back , Label "Go Back" Shown , PerformMsg ReturnToIndex ) ] ----------------------------------------- -- Content ----------------------------------------- , (\h -> form RenameSourceUsingForm [ UI.Kit.canisterForm h ] ) [ UI.Kit.h2 "Name your source" -- Input -------- , [ name "name" , onInput (SetFormData "name") , value (Dict.fetch "name" "" context.data) ] |> UI.Kit.textField |> chunky [ "max-w-md", "mx-auto" ] -- Button --------- , chunk [ "mt-10" ] [ UI.Kit.button Normal Bypass (text "Save") ] ] ]
elm
[ { "context": " guardians =\n [ \"Star-lord\", \"Groot\", \"Gamora\", \"Drax\", \"Rocket\" ]\n in\n ", "end": 679, "score": 0.9879879355, "start": 674, "tag": "NAME", "value": "Groot" }, { "context": "ns =\n [ \"Star-lord\", \"Groot\", \"Gamora\", \"Drax\", \"Rocket\" ]\n in\n g", "end": 689, "score": 0.9940363765, "start": 683, "tag": "NAME", "value": "Gamora" }, { "context": " [ \"Star-lord\", \"Groot\", \"Gamora\", \"Drax\", \"Rocket\" ]\n in\n guardians", "end": 697, "score": 0.9452389479, "start": 693, "tag": "NAME", "value": "Drax" }, { "context": " \\_ ->\n List.isEmpty [ \"Jyn\", \"Cassian\", \"K-2SO\" ]\n |> Exp", "end": 1680, "score": 0.9991128445, "start": 1677, "tag": "NAME", "value": "Jyn" }, { "context": " \\_ ->\n List.isEmpty [ \"Jyn\", \"Cassian\", \"K-2SO\" ]\n |> Expect.false \"", "end": 1691, "score": 0.9985559583, "start": 1684, "tag": "NAME", "value": "Cassian" } ]
beginning-elm/tests/Example.elm
dycw/elm-learning
0
module Example exposing (additionTests, comparisonTests, guardianNames) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import Html exposing (s, text) import Test exposing (..) additionTests : Test additionTests = describe "Addition" [ test "two plus two equals four" <| \_ -> (2 + 2) |> Expect.equal 4 , test "three plus four equals seven" <| \_ -> (3 + 4) |> Expect.equal 7 ] guardianNames : Test guardianNames = test "only 2 guardians have names with less than 6 characters" <| \_ -> let guardians = [ "Star-lord", "Groot", "Gamora", "Drax", "Rocket" ] in guardians |> List.map String.length |> List.filter (\x -> x < 6) |> List.length |> Expect.equal 2 comparisonTests : Test comparisonTests = describe "Comparison" [ test "2 is not equal to 3" <| \_ -> 2 |> Expect.notEqual 3 , test "4 is less than 5" <| \_ -> 4 |> Expect.lessThan 5 , test "6 is less than or equal to 7" <| \_ -> 6 |> Expect.atMost 7 , test "9 is greater than 8" <| \_ -> 9 |> Expect.greaterThan 8 , test "11 is greater than or equal to 10" <| \_ -> 11 |> Expect.atLeast 10 , test "a list with zero elements is empty" <| \_ -> List.isEmpty [] |> Expect.true "expected the list to be empty" , test "a list with some elements is not empty" <| \_ -> List.isEmpty [ "Jyn", "Cassian", "K-2SO" ] |> Expect.false "expected the list not to be empty" ]
57878
module Example exposing (additionTests, comparisonTests, guardianNames) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import Html exposing (s, text) import Test exposing (..) additionTests : Test additionTests = describe "Addition" [ test "two plus two equals four" <| \_ -> (2 + 2) |> Expect.equal 4 , test "three plus four equals seven" <| \_ -> (3 + 4) |> Expect.equal 7 ] guardianNames : Test guardianNames = test "only 2 guardians have names with less than 6 characters" <| \_ -> let guardians = [ "Star-lord", "<NAME>", "<NAME>", "<NAME>", "Rocket" ] in guardians |> List.map String.length |> List.filter (\x -> x < 6) |> List.length |> Expect.equal 2 comparisonTests : Test comparisonTests = describe "Comparison" [ test "2 is not equal to 3" <| \_ -> 2 |> Expect.notEqual 3 , test "4 is less than 5" <| \_ -> 4 |> Expect.lessThan 5 , test "6 is less than or equal to 7" <| \_ -> 6 |> Expect.atMost 7 , test "9 is greater than 8" <| \_ -> 9 |> Expect.greaterThan 8 , test "11 is greater than or equal to 10" <| \_ -> 11 |> Expect.atLeast 10 , test "a list with zero elements is empty" <| \_ -> List.isEmpty [] |> Expect.true "expected the list to be empty" , test "a list with some elements is not empty" <| \_ -> List.isEmpty [ "<NAME>", "<NAME>", "K-2SO" ] |> Expect.false "expected the list not to be empty" ]
true
module Example exposing (additionTests, comparisonTests, guardianNames) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import Html exposing (s, text) import Test exposing (..) additionTests : Test additionTests = describe "Addition" [ test "two plus two equals four" <| \_ -> (2 + 2) |> Expect.equal 4 , test "three plus four equals seven" <| \_ -> (3 + 4) |> Expect.equal 7 ] guardianNames : Test guardianNames = test "only 2 guardians have names with less than 6 characters" <| \_ -> let guardians = [ "Star-lord", "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI", "Rocket" ] in guardians |> List.map String.length |> List.filter (\x -> x < 6) |> List.length |> Expect.equal 2 comparisonTests : Test comparisonTests = describe "Comparison" [ test "2 is not equal to 3" <| \_ -> 2 |> Expect.notEqual 3 , test "4 is less than 5" <| \_ -> 4 |> Expect.lessThan 5 , test "6 is less than or equal to 7" <| \_ -> 6 |> Expect.atMost 7 , test "9 is greater than 8" <| \_ -> 9 |> Expect.greaterThan 8 , test "11 is greater than or equal to 10" <| \_ -> 11 |> Expect.atLeast 10 , test "a list with zero elements is empty" <| \_ -> List.isEmpty [] |> Expect.true "expected the list to be empty" , test "a list with some elements is not empty" <| \_ -> List.isEmpty [ "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI", "K-2SO" ] |> Expect.false "expected the list not to be empty" ]
elm
[ { "context": "ame-field\" ]\n , Spec.Markup.Event.input \"Brian\"\n , Spec.Markup.target << by [ id \"last-", "end": 926, "score": 0.9995371103, "start": 921, "tag": "NAME", "value": "Brian" }, { "context": "ame-field\" ]\n , Spec.Markup.Event.input \"Watkins\"\n ]\n |> when \"the form is submitt", "end": 1034, "score": 0.9998107553, "start": 1027, "tag": "NAME", "value": "Watkins" } ]
src/Spec/Markup/Event.elm
RobToombs/elm-spec
0
module Spec.Markup.Event exposing ( click , doubleClick , mouseDown , mouseUp , mouseMoveIn , mouseMoveOut , input , selectOption , resizeWindow , hideWindow , showWindow , focus , blur , setBrowserViewport , setElementViewport , trigger ) {-| Use these steps to trigger events during a scenario. To trigger an event, you'll want to first use `Spec.Markup.target` to target a particular element (or the document as a whole) to which subsequent events should apply. For example, Spec.describe "a form" [ Spec.scenario "completing the form" ( Spec.given ( testSubject ) |> when "the form is revealed" [ Spec.Markup.target << by [ id "show-form" ] , Spec.Markup.Event.click ] |> when "the name is entered" [ Spec.Markup.target << by [ id "first-name-field" ] , Spec.Markup.Event.input "Brian" , Spec.Markup.target << by [ id "last-name-field" ] , Spec.Markup.Event.input "Watkins" ] |> when "the form is submitted" [ Spec.Markup.target << by [ id "submit" ] , Spec.Markup.Event.click ] |> it "does something cool" ( ... ) ) ] # Mouse Events @docs click, doubleClick, mouseDown, mouseUp, mouseMoveIn, mouseMoveOut # Form Events @docs input, selectOption # Window Events @docs resizeWindow, hideWindow, showWindow # Focus Events @docs focus, blur # Custom Events @docs trigger # Control the Viewport @docs setBrowserViewport, setElementViewport -} import Spec.Markup exposing (ViewportOffset) import Spec.Step as Step import Spec.Step.Command as Command import Spec.Step.Context as Context import Spec.Message as Message import Json.Encode as Encode import Json.Decode as Json {-| A step that simulates a click event on the targeted item, either the document as a whole (using the `Spec.Markup.Selector.document` selector or some particular HTML element). This will trigger `mousedown`, `mouseup`, and `click` DOM events on the targeted item. In several cases, you can use `click` to trigger other kinds of events. Use `click` to simulate checking or unchecking a checkbox. Use `click` to select a radio button. Use `click` to submit a form by clicking the associated button. You can also use `click` on an anchor tag, but here the behavior is a little more complicated. First of all, any click event handlers associated with the anchor tag will be triggered as expected. If the anchor tag has an `href` attribute, then elm-spec can *usually* intercept the navigation, which allows you to use `Spec.Navigation.observeLocation` to make a claim about the location to which you've navigated. Elm-spec will simulate going to another page by replacing the program's view with a page that states the program has navigated outside the Elm context. If the anchor tag has an `href` attribute *and* a `target` attribute or a `download` attribute then elm-spec will *not* intercept the navigation. This means that the navigation will proceed as if the program were actually running, and this will usually cause your specs to get into a bad state. So, rather than clicking such a link during a scenario, you should instead just observe that it has the `href` attribute you expect. -} click : Step.Context model -> Step.Command msg click = basicEventMessage "click" {-| A step that simulates a double click on the targeted HTML element. This will trigger two sets of `mouseup`, `mousedown`, and `click` DOM events and then a `dblclick` DOM event. -} doubleClick : Step.Context model -> Step.Command msg doubleClick = basicEventMessage "doubleClick" {-| A step that simulates pressing the mouse button on the targeted item, either the document as a whole (using the `Spec.Markup.Selector.document` selector or some particular HTML element). This will trigger a `mouseDown` DOM event on the targeted item. -} mouseDown : Step.Context model -> Step.Command msg mouseDown = trigger "mousedown" <| Encode.object [] {-| A step that simulates releasing the mouse button on the targeted item, either the document as a whole (using the `Spec.Markup.Selector.document` selector or some particular HTML element). This will trigger a `mouseup` DOM event on the targeted item. -} mouseUp : Step.Context model -> Step.Command msg mouseUp = trigger "mouseup" <| Encode.object [] {-| A step that simulates the targeted HTML element receiving focus. This will trigger a `focus` DOM event on the targeted element. -} focus : Step.Context model -> Step.Command msg focus = basicEventMessage "focus" {-| A step that simulates the targeted HTML element losing focus. This will trigger a `blur` DOM event on the targeted element. -} blur : Step.Context model -> Step.Command msg blur = basicEventMessage "blur" {-| A step that simulates the mouse moving into the targeted HTML element. This will trigger `mouseover` and `mouseenter` DOM events on the targeted element. -} mouseMoveIn : Step.Context model -> Step.Command msg mouseMoveIn = basicEventMessage "mouseMoveIn" {-| A step that simulates the mouse moving out of the targeted HTML element. This will trigger `mouseout` and `mouseleave` DOM events on the targeted element. -} mouseMoveOut : Step.Context model -> Step.Command msg mouseMoveOut = basicEventMessage "mouseMoveOut" basicEventMessage : String -> Step.Context model -> Step.Command msg basicEventMessage name context = Message.for "_html" name |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) ] ) |> Command.sendMessage {-| A step that simulates text input to the targeted HTML element. This will set the `value` attribute of the targeted element to the given string and trigger an `input` DOM event on that element. To trigger input events on a radio button just target the button and simulate a click on it. To trigger input events on a select, use `selectOption`. -} input : String -> Step.Context model -> Step.Command msg input text context = Message.for "_html" "input" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "text", Encode.string text ) ] ) |> Command.sendMessage {-| A step that simulates selecting an option from the menu generated by a `<select>` element. This will select the option whose text or label matches the given string, and then trigger `change` and `input` DOM events on the targeted HTML `<select>` element. -} selectOption : String -> Step.Context model -> Step.Command msg selectOption text context = Message.for "_html" "select" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "text", Encode.string text ) ] ) |> Command.sendMessage {-| A step that simulates resizing the browser window to the given (width, height). This will trigger a `resize` DOM event on the window object. -} resizeWindow : (Int, Int) -> Step.Context model -> Step.Command msg resizeWindow (width, height) _ = Message.for "_html" "resize" |> Message.withBody ( Encode.object [ ( "width", Encode.int width ) , ( "height", Encode.int height ) ] ) |> Command.sendMessage {-| A step that simulates hiding the window from view. This will trigger a `visibilitychange` DOM event on the document object. -} hideWindow : Step.Context model -> Step.Command msg hideWindow = setWindowVisible False {-| A step that simulates the window returning into view. This will trigger a `visibilitychange` DOM event on the document object. -} showWindow : Step.Context model -> Step.Command msg showWindow = setWindowVisible True setWindowVisible : Bool -> Step.Context model -> Step.Command msg setWindowVisible isVisible _ = Message.for "_html" "visibilityChange" |> Message.withBody ( Encode.object [ ( "isVisible", Encode.bool isVisible ) ] ) |> Command.sendMessage {-| A step that changes the offset of the browser viewport. Use this step to simulate a user scrolling the web page. Note that elm-spec fakes the browser viewport offset. So if you are viewing elm-spec specs in a real browser (via Karma), then you won't actually see the viewport offset change, but the Elm program will think it has. This allows you to get consistent results without making your specs dependent on properties of the browser that your specs are running in. -} setBrowserViewport : ViewportOffset -> Step.Context model -> Step.Command msg setBrowserViewport offset _ = Message.for "_html" "set-browser-viewport" |> Message.withBody (encodeViewportOffset offset) |> Command.sendMessage {-| A step that changes the offset of the targeted element's viewport. Use this step to simulate a user scrolling the content within an element. Note that elm-spec does not fake the element viewport offset. So, if you are running specs in a real browser (via Karma), then the element must be scrollable for this step to do anything (i.e., it probably needs a fixed height or width, and it's `overflow` CSS property must be set appropriately). -} setElementViewport : ViewportOffset -> Step.Context model -> Step.Command msg setElementViewport offset context = Message.for "_html" "set-element-viewport" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "viewport", encodeViewportOffset offset ) ] ) |> Command.sendMessage encodeViewportOffset : ViewportOffset -> Encode.Value encodeViewportOffset offset = Encode.object [ ("x", Encode.float offset.x) , ("y", Encode.float offset.y) ] {-| A step that triggers a custom DOM event on the targeted item. Provide the name of the DOM event and a JSON value that specifes any properties to add to the event object. For example, to simulate releasing the `A` key: Spec.when "The A key is released" [ Spec.Markup.target << by [ id "my-field" ] , Json.Encode.object [ ( "keyCode", Encode.int 65 ) ] |> Spec.Markup.event.trigger "keyup" ] You may trigger a custom DOM event on the document (by selecting it with `Spec.Markup.Selector.document`) or some particular HTML element. -} trigger : String -> Encode.Value -> Step.Context model -> Step.Command msg trigger name json context = Message.for "_html" "customEvent" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "name", Encode.string name ) , ( "event", json ) ] ) |> Command.sendMessage targetSelector : Step.Context model -> String targetSelector context = Context.effects context |> List.filter (Message.is "_html" "target") |> List.head |> Maybe.andThen (Result.toMaybe << Message.decode Json.string) |> Maybe.withDefault ""
44656
module Spec.Markup.Event exposing ( click , doubleClick , mouseDown , mouseUp , mouseMoveIn , mouseMoveOut , input , selectOption , resizeWindow , hideWindow , showWindow , focus , blur , setBrowserViewport , setElementViewport , trigger ) {-| Use these steps to trigger events during a scenario. To trigger an event, you'll want to first use `Spec.Markup.target` to target a particular element (or the document as a whole) to which subsequent events should apply. For example, Spec.describe "a form" [ Spec.scenario "completing the form" ( Spec.given ( testSubject ) |> when "the form is revealed" [ Spec.Markup.target << by [ id "show-form" ] , Spec.Markup.Event.click ] |> when "the name is entered" [ Spec.Markup.target << by [ id "first-name-field" ] , Spec.Markup.Event.input "<NAME>" , Spec.Markup.target << by [ id "last-name-field" ] , Spec.Markup.Event.input "<NAME>" ] |> when "the form is submitted" [ Spec.Markup.target << by [ id "submit" ] , Spec.Markup.Event.click ] |> it "does something cool" ( ... ) ) ] # Mouse Events @docs click, doubleClick, mouseDown, mouseUp, mouseMoveIn, mouseMoveOut # Form Events @docs input, selectOption # Window Events @docs resizeWindow, hideWindow, showWindow # Focus Events @docs focus, blur # Custom Events @docs trigger # Control the Viewport @docs setBrowserViewport, setElementViewport -} import Spec.Markup exposing (ViewportOffset) import Spec.Step as Step import Spec.Step.Command as Command import Spec.Step.Context as Context import Spec.Message as Message import Json.Encode as Encode import Json.Decode as Json {-| A step that simulates a click event on the targeted item, either the document as a whole (using the `Spec.Markup.Selector.document` selector or some particular HTML element). This will trigger `mousedown`, `mouseup`, and `click` DOM events on the targeted item. In several cases, you can use `click` to trigger other kinds of events. Use `click` to simulate checking or unchecking a checkbox. Use `click` to select a radio button. Use `click` to submit a form by clicking the associated button. You can also use `click` on an anchor tag, but here the behavior is a little more complicated. First of all, any click event handlers associated with the anchor tag will be triggered as expected. If the anchor tag has an `href` attribute, then elm-spec can *usually* intercept the navigation, which allows you to use `Spec.Navigation.observeLocation` to make a claim about the location to which you've navigated. Elm-spec will simulate going to another page by replacing the program's view with a page that states the program has navigated outside the Elm context. If the anchor tag has an `href` attribute *and* a `target` attribute or a `download` attribute then elm-spec will *not* intercept the navigation. This means that the navigation will proceed as if the program were actually running, and this will usually cause your specs to get into a bad state. So, rather than clicking such a link during a scenario, you should instead just observe that it has the `href` attribute you expect. -} click : Step.Context model -> Step.Command msg click = basicEventMessage "click" {-| A step that simulates a double click on the targeted HTML element. This will trigger two sets of `mouseup`, `mousedown`, and `click` DOM events and then a `dblclick` DOM event. -} doubleClick : Step.Context model -> Step.Command msg doubleClick = basicEventMessage "doubleClick" {-| A step that simulates pressing the mouse button on the targeted item, either the document as a whole (using the `Spec.Markup.Selector.document` selector or some particular HTML element). This will trigger a `mouseDown` DOM event on the targeted item. -} mouseDown : Step.Context model -> Step.Command msg mouseDown = trigger "mousedown" <| Encode.object [] {-| A step that simulates releasing the mouse button on the targeted item, either the document as a whole (using the `Spec.Markup.Selector.document` selector or some particular HTML element). This will trigger a `mouseup` DOM event on the targeted item. -} mouseUp : Step.Context model -> Step.Command msg mouseUp = trigger "mouseup" <| Encode.object [] {-| A step that simulates the targeted HTML element receiving focus. This will trigger a `focus` DOM event on the targeted element. -} focus : Step.Context model -> Step.Command msg focus = basicEventMessage "focus" {-| A step that simulates the targeted HTML element losing focus. This will trigger a `blur` DOM event on the targeted element. -} blur : Step.Context model -> Step.Command msg blur = basicEventMessage "blur" {-| A step that simulates the mouse moving into the targeted HTML element. This will trigger `mouseover` and `mouseenter` DOM events on the targeted element. -} mouseMoveIn : Step.Context model -> Step.Command msg mouseMoveIn = basicEventMessage "mouseMoveIn" {-| A step that simulates the mouse moving out of the targeted HTML element. This will trigger `mouseout` and `mouseleave` DOM events on the targeted element. -} mouseMoveOut : Step.Context model -> Step.Command msg mouseMoveOut = basicEventMessage "mouseMoveOut" basicEventMessage : String -> Step.Context model -> Step.Command msg basicEventMessage name context = Message.for "_html" name |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) ] ) |> Command.sendMessage {-| A step that simulates text input to the targeted HTML element. This will set the `value` attribute of the targeted element to the given string and trigger an `input` DOM event on that element. To trigger input events on a radio button just target the button and simulate a click on it. To trigger input events on a select, use `selectOption`. -} input : String -> Step.Context model -> Step.Command msg input text context = Message.for "_html" "input" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "text", Encode.string text ) ] ) |> Command.sendMessage {-| A step that simulates selecting an option from the menu generated by a `<select>` element. This will select the option whose text or label matches the given string, and then trigger `change` and `input` DOM events on the targeted HTML `<select>` element. -} selectOption : String -> Step.Context model -> Step.Command msg selectOption text context = Message.for "_html" "select" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "text", Encode.string text ) ] ) |> Command.sendMessage {-| A step that simulates resizing the browser window to the given (width, height). This will trigger a `resize` DOM event on the window object. -} resizeWindow : (Int, Int) -> Step.Context model -> Step.Command msg resizeWindow (width, height) _ = Message.for "_html" "resize" |> Message.withBody ( Encode.object [ ( "width", Encode.int width ) , ( "height", Encode.int height ) ] ) |> Command.sendMessage {-| A step that simulates hiding the window from view. This will trigger a `visibilitychange` DOM event on the document object. -} hideWindow : Step.Context model -> Step.Command msg hideWindow = setWindowVisible False {-| A step that simulates the window returning into view. This will trigger a `visibilitychange` DOM event on the document object. -} showWindow : Step.Context model -> Step.Command msg showWindow = setWindowVisible True setWindowVisible : Bool -> Step.Context model -> Step.Command msg setWindowVisible isVisible _ = Message.for "_html" "visibilityChange" |> Message.withBody ( Encode.object [ ( "isVisible", Encode.bool isVisible ) ] ) |> Command.sendMessage {-| A step that changes the offset of the browser viewport. Use this step to simulate a user scrolling the web page. Note that elm-spec fakes the browser viewport offset. So if you are viewing elm-spec specs in a real browser (via Karma), then you won't actually see the viewport offset change, but the Elm program will think it has. This allows you to get consistent results without making your specs dependent on properties of the browser that your specs are running in. -} setBrowserViewport : ViewportOffset -> Step.Context model -> Step.Command msg setBrowserViewport offset _ = Message.for "_html" "set-browser-viewport" |> Message.withBody (encodeViewportOffset offset) |> Command.sendMessage {-| A step that changes the offset of the targeted element's viewport. Use this step to simulate a user scrolling the content within an element. Note that elm-spec does not fake the element viewport offset. So, if you are running specs in a real browser (via Karma), then the element must be scrollable for this step to do anything (i.e., it probably needs a fixed height or width, and it's `overflow` CSS property must be set appropriately). -} setElementViewport : ViewportOffset -> Step.Context model -> Step.Command msg setElementViewport offset context = Message.for "_html" "set-element-viewport" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "viewport", encodeViewportOffset offset ) ] ) |> Command.sendMessage encodeViewportOffset : ViewportOffset -> Encode.Value encodeViewportOffset offset = Encode.object [ ("x", Encode.float offset.x) , ("y", Encode.float offset.y) ] {-| A step that triggers a custom DOM event on the targeted item. Provide the name of the DOM event and a JSON value that specifes any properties to add to the event object. For example, to simulate releasing the `A` key: Spec.when "The A key is released" [ Spec.Markup.target << by [ id "my-field" ] , Json.Encode.object [ ( "keyCode", Encode.int 65 ) ] |> Spec.Markup.event.trigger "keyup" ] You may trigger a custom DOM event on the document (by selecting it with `Spec.Markup.Selector.document`) or some particular HTML element. -} trigger : String -> Encode.Value -> Step.Context model -> Step.Command msg trigger name json context = Message.for "_html" "customEvent" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "name", Encode.string name ) , ( "event", json ) ] ) |> Command.sendMessage targetSelector : Step.Context model -> String targetSelector context = Context.effects context |> List.filter (Message.is "_html" "target") |> List.head |> Maybe.andThen (Result.toMaybe << Message.decode Json.string) |> Maybe.withDefault ""
true
module Spec.Markup.Event exposing ( click , doubleClick , mouseDown , mouseUp , mouseMoveIn , mouseMoveOut , input , selectOption , resizeWindow , hideWindow , showWindow , focus , blur , setBrowserViewport , setElementViewport , trigger ) {-| Use these steps to trigger events during a scenario. To trigger an event, you'll want to first use `Spec.Markup.target` to target a particular element (or the document as a whole) to which subsequent events should apply. For example, Spec.describe "a form" [ Spec.scenario "completing the form" ( Spec.given ( testSubject ) |> when "the form is revealed" [ Spec.Markup.target << by [ id "show-form" ] , Spec.Markup.Event.click ] |> when "the name is entered" [ Spec.Markup.target << by [ id "first-name-field" ] , Spec.Markup.Event.input "PI:NAME:<NAME>END_PI" , Spec.Markup.target << by [ id "last-name-field" ] , Spec.Markup.Event.input "PI:NAME:<NAME>END_PI" ] |> when "the form is submitted" [ Spec.Markup.target << by [ id "submit" ] , Spec.Markup.Event.click ] |> it "does something cool" ( ... ) ) ] # Mouse Events @docs click, doubleClick, mouseDown, mouseUp, mouseMoveIn, mouseMoveOut # Form Events @docs input, selectOption # Window Events @docs resizeWindow, hideWindow, showWindow # Focus Events @docs focus, blur # Custom Events @docs trigger # Control the Viewport @docs setBrowserViewport, setElementViewport -} import Spec.Markup exposing (ViewportOffset) import Spec.Step as Step import Spec.Step.Command as Command import Spec.Step.Context as Context import Spec.Message as Message import Json.Encode as Encode import Json.Decode as Json {-| A step that simulates a click event on the targeted item, either the document as a whole (using the `Spec.Markup.Selector.document` selector or some particular HTML element). This will trigger `mousedown`, `mouseup`, and `click` DOM events on the targeted item. In several cases, you can use `click` to trigger other kinds of events. Use `click` to simulate checking or unchecking a checkbox. Use `click` to select a radio button. Use `click` to submit a form by clicking the associated button. You can also use `click` on an anchor tag, but here the behavior is a little more complicated. First of all, any click event handlers associated with the anchor tag will be triggered as expected. If the anchor tag has an `href` attribute, then elm-spec can *usually* intercept the navigation, which allows you to use `Spec.Navigation.observeLocation` to make a claim about the location to which you've navigated. Elm-spec will simulate going to another page by replacing the program's view with a page that states the program has navigated outside the Elm context. If the anchor tag has an `href` attribute *and* a `target` attribute or a `download` attribute then elm-spec will *not* intercept the navigation. This means that the navigation will proceed as if the program were actually running, and this will usually cause your specs to get into a bad state. So, rather than clicking such a link during a scenario, you should instead just observe that it has the `href` attribute you expect. -} click : Step.Context model -> Step.Command msg click = basicEventMessage "click" {-| A step that simulates a double click on the targeted HTML element. This will trigger two sets of `mouseup`, `mousedown`, and `click` DOM events and then a `dblclick` DOM event. -} doubleClick : Step.Context model -> Step.Command msg doubleClick = basicEventMessage "doubleClick" {-| A step that simulates pressing the mouse button on the targeted item, either the document as a whole (using the `Spec.Markup.Selector.document` selector or some particular HTML element). This will trigger a `mouseDown` DOM event on the targeted item. -} mouseDown : Step.Context model -> Step.Command msg mouseDown = trigger "mousedown" <| Encode.object [] {-| A step that simulates releasing the mouse button on the targeted item, either the document as a whole (using the `Spec.Markup.Selector.document` selector or some particular HTML element). This will trigger a `mouseup` DOM event on the targeted item. -} mouseUp : Step.Context model -> Step.Command msg mouseUp = trigger "mouseup" <| Encode.object [] {-| A step that simulates the targeted HTML element receiving focus. This will trigger a `focus` DOM event on the targeted element. -} focus : Step.Context model -> Step.Command msg focus = basicEventMessage "focus" {-| A step that simulates the targeted HTML element losing focus. This will trigger a `blur` DOM event on the targeted element. -} blur : Step.Context model -> Step.Command msg blur = basicEventMessage "blur" {-| A step that simulates the mouse moving into the targeted HTML element. This will trigger `mouseover` and `mouseenter` DOM events on the targeted element. -} mouseMoveIn : Step.Context model -> Step.Command msg mouseMoveIn = basicEventMessage "mouseMoveIn" {-| A step that simulates the mouse moving out of the targeted HTML element. This will trigger `mouseout` and `mouseleave` DOM events on the targeted element. -} mouseMoveOut : Step.Context model -> Step.Command msg mouseMoveOut = basicEventMessage "mouseMoveOut" basicEventMessage : String -> Step.Context model -> Step.Command msg basicEventMessage name context = Message.for "_html" name |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) ] ) |> Command.sendMessage {-| A step that simulates text input to the targeted HTML element. This will set the `value` attribute of the targeted element to the given string and trigger an `input` DOM event on that element. To trigger input events on a radio button just target the button and simulate a click on it. To trigger input events on a select, use `selectOption`. -} input : String -> Step.Context model -> Step.Command msg input text context = Message.for "_html" "input" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "text", Encode.string text ) ] ) |> Command.sendMessage {-| A step that simulates selecting an option from the menu generated by a `<select>` element. This will select the option whose text or label matches the given string, and then trigger `change` and `input` DOM events on the targeted HTML `<select>` element. -} selectOption : String -> Step.Context model -> Step.Command msg selectOption text context = Message.for "_html" "select" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "text", Encode.string text ) ] ) |> Command.sendMessage {-| A step that simulates resizing the browser window to the given (width, height). This will trigger a `resize` DOM event on the window object. -} resizeWindow : (Int, Int) -> Step.Context model -> Step.Command msg resizeWindow (width, height) _ = Message.for "_html" "resize" |> Message.withBody ( Encode.object [ ( "width", Encode.int width ) , ( "height", Encode.int height ) ] ) |> Command.sendMessage {-| A step that simulates hiding the window from view. This will trigger a `visibilitychange` DOM event on the document object. -} hideWindow : Step.Context model -> Step.Command msg hideWindow = setWindowVisible False {-| A step that simulates the window returning into view. This will trigger a `visibilitychange` DOM event on the document object. -} showWindow : Step.Context model -> Step.Command msg showWindow = setWindowVisible True setWindowVisible : Bool -> Step.Context model -> Step.Command msg setWindowVisible isVisible _ = Message.for "_html" "visibilityChange" |> Message.withBody ( Encode.object [ ( "isVisible", Encode.bool isVisible ) ] ) |> Command.sendMessage {-| A step that changes the offset of the browser viewport. Use this step to simulate a user scrolling the web page. Note that elm-spec fakes the browser viewport offset. So if you are viewing elm-spec specs in a real browser (via Karma), then you won't actually see the viewport offset change, but the Elm program will think it has. This allows you to get consistent results without making your specs dependent on properties of the browser that your specs are running in. -} setBrowserViewport : ViewportOffset -> Step.Context model -> Step.Command msg setBrowserViewport offset _ = Message.for "_html" "set-browser-viewport" |> Message.withBody (encodeViewportOffset offset) |> Command.sendMessage {-| A step that changes the offset of the targeted element's viewport. Use this step to simulate a user scrolling the content within an element. Note that elm-spec does not fake the element viewport offset. So, if you are running specs in a real browser (via Karma), then the element must be scrollable for this step to do anything (i.e., it probably needs a fixed height or width, and it's `overflow` CSS property must be set appropriately). -} setElementViewport : ViewportOffset -> Step.Context model -> Step.Command msg setElementViewport offset context = Message.for "_html" "set-element-viewport" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "viewport", encodeViewportOffset offset ) ] ) |> Command.sendMessage encodeViewportOffset : ViewportOffset -> Encode.Value encodeViewportOffset offset = Encode.object [ ("x", Encode.float offset.x) , ("y", Encode.float offset.y) ] {-| A step that triggers a custom DOM event on the targeted item. Provide the name of the DOM event and a JSON value that specifes any properties to add to the event object. For example, to simulate releasing the `A` key: Spec.when "The A key is released" [ Spec.Markup.target << by [ id "my-field" ] , Json.Encode.object [ ( "keyCode", Encode.int 65 ) ] |> Spec.Markup.event.trigger "keyup" ] You may trigger a custom DOM event on the document (by selecting it with `Spec.Markup.Selector.document`) or some particular HTML element. -} trigger : String -> Encode.Value -> Step.Context model -> Step.Command msg trigger name json context = Message.for "_html" "customEvent" |> Message.withBody ( Encode.object [ ( "selector", Encode.string <| targetSelector context ) , ( "name", Encode.string name ) , ( "event", json ) ] ) |> Command.sendMessage targetSelector : Step.Context model -> String targetSelector context = Context.effects context |> List.filter (Message.is "_html" "target") |> List.head |> Maybe.andThen (Result.toMaybe << Message.decode Json.string) |> Maybe.withDefault ""
elm
[ { "context": "\n , mains =\n [ \"Average Joe\"\n , \"Sir Wellington\"\n , \"Sam Harberspoon\"\n , \"Jimbo\"\n ", "end": 9638, "score": 0.9997674227, "start": 9624, "tag": "NAME", "value": "Sir Wellington" }, { "context": "verage Joe\"\n , \"Sir Wellington\"\n , \"Sam Harberspoon\"\n , \"Jimbo\"\n , \"Ivan\"\n , \"Sa", "end": 9666, "score": 0.9998611212, "start": 9651, "tag": "NAME", "value": "Sam Harberspoon" }, { "context": "ellington\"\n , \"Sam Harberspoon\"\n , \"Jimbo\"\n , \"Ivan\"\n , \"Sallyworth\"\n ", "end": 9684, "score": 0.999765873, "start": 9679, "tag": "NAME", "value": "Jimbo" }, { "context": " , \"Sam Harberspoon\"\n , \"Jimbo\"\n , \"Ivan\"\n , \"Sallyworth\"\n , \"Kennith\"\n ", "end": 9701, "score": 0.999750495, "start": 9697, "tag": "NAME", "value": "Ivan" }, { "context": "on\"\n , \"Jimbo\"\n , \"Ivan\"\n , \"Sallyworth\"\n , \"Kennith\"\n , \"Malinda\"\n ", "end": 9724, "score": 0.999807179, "start": 9714, "tag": "NAME", "value": "Sallyworth" }, { "context": " , \"Ivan\"\n , \"Sallyworth\"\n , \"Kennith\"\n , \"Malinda\"\n , \"Anastasia\"\n ", "end": 9744, "score": 0.9997580647, "start": 9737, "tag": "NAME", "value": "Kennith" }, { "context": " , \"Sallyworth\"\n , \"Kennith\"\n , \"Malinda\"\n , \"Anastasia\"\n , \"Billingford\"\n ", "end": 9764, "score": 0.9997797012, "start": 9757, "tag": "NAME", "value": "Malinda" }, { "context": " , \"Kennith\"\n , \"Malinda\"\n , \"Anastasia\"\n , \"Billingford\"\n , \"Daniel\"\n ", "end": 9786, "score": 0.9998425245, "start": 9777, "tag": "NAME", "value": "Anastasia" }, { "context": " , \"Malinda\"\n , \"Anastasia\"\n , \"Billingford\"\n , \"Daniel\"\n , \"Lady Ferrington\"\n ", "end": 9810, "score": 0.999768436, "start": 9799, "tag": "NAME", "value": "Billingford" }, { "context": " , \"Anastasia\"\n , \"Billingford\"\n , \"Daniel\"\n , \"Lady Ferrington\"\n , \"\\\"Max the", "end": 9829, "score": 0.9997960329, "start": 9823, "tag": "NAME", "value": "Daniel" }, { "context": " , \"Billingford\"\n , \"Daniel\"\n , \"Lady Ferrington\"\n , \"\\\"Max the Axe\\\"\"\n , \"Eliza\"\n ", "end": 9857, "score": 0.9997315407, "start": 9842, "tag": "NAME", "value": "Lady Ferrington" }, { "context": "\"Daniel\"\n , \"Lady Ferrington\"\n , \"\\\"Max the Axe\\\"\"\n , \"Eliza\"\n , \"Boddingto", "end": 9875, "score": 0.9896574616, "start": 9872, "tag": "NAME", "value": "Max" }, { "context": "errington\"\n , \"\\\"Max the Axe\\\"\"\n , \"Eliza\"\n , \"Boddington\"\n , \"Cudworth\"\n ", "end": 9903, "score": 0.9998210073, "start": 9898, "tag": "NAME", "value": "Eliza" }, { "context": " , \"\\\"Max the Axe\\\"\"\n , \"Eliza\"\n , \"Boddington\"\n , \"Cudworth\"\n , \"Manfred McMurphy", "end": 9926, "score": 0.9998148084, "start": 9916, "tag": "NAME", "value": "Boddington" }, { "context": " , \"Eliza\"\n , \"Boddington\"\n , \"Cudworth\"\n , \"Manfred McMurphy\"\n , \"Hector\"\n", "end": 9947, "score": 0.9997871518, "start": 9939, "tag": "NAME", "value": "Cudworth" }, { "context": " , \"Boddington\"\n , \"Cudworth\"\n , \"Manfred McMurphy\"\n , \"Hector\"\n , \"\\\"Alice the Ace\\\"\"", "end": 9976, "score": 0.999804616, "start": 9960, "tag": "NAME", "value": "Manfred McMurphy" }, { "context": "Cudworth\"\n , \"Manfred McMurphy\"\n , \"Hector\"\n , \"\\\"Alice the Ace\\\"\"\n , \"Jessica", "end": 9995, "score": 0.9998415709, "start": 9989, "tag": "NAME", "value": "Hector" }, { "context": "Manfred McMurphy\"\n , \"Hector\"\n , \"\\\"Alice the Ace\\\"\"\n , \"Jessica\"\n ]\n , su", "end": 10015, "score": 0.9996045232, "start": 10010, "tag": "NAME", "value": "Alice" }, { "context": "\"Hector\"\n , \"\\\"Alice the Ace\\\"\"\n , \"Jessica\"\n ]\n , suffix1s =\n [ \" the Disgr", "end": 10045, "score": 0.9997172356, "start": 10038, "tag": "NAME", "value": "Jessica" } ]
src/Main.elm
jschomay/deduction-quest
0
port module Main exposing (main) import Browser import Dict exposing (Dict) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onMouseEnter, onMouseLeave) import Markdown import NarrativeEngine.Core.Rules as Rules import NarrativeEngine.Core.WorldModel as WorldModel exposing (addTag, applyChanges, emptyLinks, emptyStats, emptyTags, getStat, setStat) import NarrativeEngine.Debug import NarrativeEngine.Syntax.EntityParser as EntityParser import NarrativeEngine.Syntax.Helpers as SyntaxHelpers import NarrativeEngine.Syntax.NarrativeParser as NarrativeParser import NarrativeEngine.Syntax.RuleParser as RuleParser import Process import Random import Random.Extra as Random import Random.List as Random import Set exposing (Set) import Task type alias EntityFields = NamedComponent {} type alias NamedComponent a = { a | name : String , description : String } type alias MyEntity = WorldModel.NarrativeComponent EntityFields type alias MyWorldModel = Dict WorldModel.ID MyEntity type alias RuleFields = NarrativeComponent {} type alias NarrativeComponent a = { a | narrative : String } type alias MyRule = Rules.Rule RuleFields type alias MyRules = Dict String MyRule type alias RulesSpec = Dict Rules.RuleID ( String, {} ) type alias Model = { parseErrors : Maybe SyntaxHelpers.ParseErrors , worldModel : MyWorldModel , rules : MyRules , ruleCounts : Dict String Int , debug : NarrativeEngine.Debug.State , generatedHeroes : List Character , generatedMonsters : List Character , levelsForRound : Levels , chooseHero : Bool , chooseBonus : Bool , lineUpCount : Int , story : String , continueButton : Maybe ( String, Msg ) , score : Int , battleHistory : Dict WorldModel.ID { beat : Set WorldModel.ID, lost : Set WorldModel.ID } , spells : List String , bonuses : Set String , bonusOptions : List String , round : Int } maxCharacters : Int maxCharacters = -- enough images/names to go 4 rounds -- 18 3 + 4 + 5 + 6 initialModel : ( Model, Cmd Msg ) initialModel = ( { parseErrors = Nothing , worldModel = Dict.empty , rules = Dict.empty , ruleCounts = Dict.empty , debug = NarrativeEngine.Debug.init , generatedHeroes = [] , generatedMonsters = [] , levelsForRound = { heroes = [], monsters = [] } , chooseHero = False , chooseBonus = False , lineUpCount = 3 , story = "" , continueButton = Nothing , score = 10 , battleHistory = Dict.empty , spells = [] , bonuses = Set.empty , bonusOptions = [] , round = 1 } , Random.generate LineupGenerated (makeLineUp maxCharacters) ) bonuses = Dict.empty |> bonus "Lucky day" "+10 HP" (\k m -> { m | score = m.score + 10 }) |> bonus "Charm of persistent insight" "Reveal a monster's level when it is defeated" addBonus |> bonus "Scroll of self awareness" "Always reveal hero levels" addBonus |> bonus "Relic of photographic memory" "See outcomes of previous battles" addBonus |> spell "Appeal for bravery" "Automatically select a hero who can beat the current monster, and reveal that hero's level (one-time spell)" addSpell (\m -> let monsterId = query "*.monster.fighting" m.worldModel |> List.head |> Maybe.map Tuple.first |> Maybe.withDefault "?" in case query ("*.hero.!defeated.!victorious.!fighting.level>(stat " ++ monsterId ++ ".level)") m.worldModel |> List.head |> Maybe.map Tuple.first of Nothing -> { m | story = "You shout for a brave hero to step forward... but none do. The heroes that can beat this monster must have already perished. What a shame." } Just id -> { m | story = "You shout for a brave hero to step forward. " ++ getName id m.worldModel ++ " answers the call." , continueButton = Just ( "Continue", AppealForBraveryContinue ) , chooseHero = False , worldModel = updateWorldModel [ id ++ ".revealed.fighting" ] m.worldModel } ) |> spell "Summoning of identification" "Reveal level of current monster (one-time spell)" addSpell (\m -> case query "*.monster.fighting.revealed" m.worldModel of [] -> { m | worldModel = updateWorldModel [ "(*.monster.fighting).revealed" ] m.worldModel , story = "You mutter the forbidden words, the monster fidgets, then bashfully admits its level." } _ -> { m | story = "You mutter the forbidden words, the monster fidgets, then laughs at you, as it reveals the information you already knew. Rookie mistake." } ) |> spell "Incantation of fortification" "Increase level of all currently defeated heroes (one-time spell)" addSpell (\m -> case query "*.hero.defeated" m.worldModel of [] -> { m | story = "You cast this potent spell to strengthen the fallen... but no one is able to benefit. That was foolish." } _ -> { m | worldModel = updateWorldModel [ "(*.hero.defeated).level+10" ] m.worldModel , story = "You look around and see your fallen heroes. This day things look bleak. But tomorrow already feels more promising." } ) |> spell "Show of fierceness" "All defeated monsters will run away (one-time spell)" addSpell (\m -> case query "*.monster.defeated" m.worldModel of [] -> { m | story = "You muster your strength and give a mighty howl. But none of the monsters have taken any blows yet, so they just look at you with a mix of bewilderment and disapproval." } _ -> { m | worldModel = updateWorldModel [ "(*.monster.defeated).-monster.-defeated" ] m.worldModel , story = "You muster your strength and give a mighty howl. The defeated monsters eye you cautiously. You take the opportunity and jab at them. They turn their tails and run off. Good show." } ) bonus name desc selectFn = Dict.insert name { name = name, description = desc, selectFn = selectFn name, useFn = identity } spell name desc selectFn useFn = Dict.insert name { name = name, description = desc, selectFn = selectFn name, useFn = useFn } addBonus k m = { m | bonuses = Set.insert k m.bonuses } addSpell k m = { m | spells = k :: m.spells } hasBonus k m = Set.member k m.bonuses type alias NameOptions = { prefixs : List String , mains : List String , suffix1s : List String , suffix2s : List String } monsterNameOptions : NameOptions monsterNameOptions = { prefixs = [ "Disproportionate " , "Resurrected " , "Deranged " , "Flying " , "Scaly " , "Sleepy " , "Poisonous " , "Cursed " , "Partly invisible " , "Giant " , "Uncommon " , "Misunderstood " , "Dyslexic " , "Seemingly innocent " , "Mutant " , "Undead " , "Mildly annoying " , "Screaming " , "Unstable " , "100 year-old " , "Supernatural " , "Evil " ] , mains = [ "Imp" , "Snail" , "Spider" , "Rodent" , "Sock puppet" , "Bob the Blob" , "Clown" , "Newt" , "Politician" , "Teddy-bear" , "Witch" , "Zombie" , "Hooligan" , "Telemarketer" , "Presence" , "Wraith" , "Ghoul" , "Undertaker" , "Poltergeist" , "Halfling" ] , suffix1s = [ " of doom" , " of disreputable company" , " from Hell" , " infected with scurvy" , " of limited intellect" , " from the house next door" , " from your nightmares" ] , suffix2s = [ " with 1000 eyes" , " with no face" , " with secret powers" , " with nefarious intent" , ", armed to the teeth" , ", without grace" , ", blinded with rage" , ", with glowing tentacles" , ", with a personal vendetta" , ", who hasn't eaten for over a week" , ", who just wants attention" , ", a wanted criminal" ] } heroNameOptions : NameOptions heroNameOptions = { prefixs = [ "Ill-equipped " , "Constable " , "Young " , "Above-average " , "Untrained " , "Angry " , "Crazy " , "Unlucky " , "Undercover " , "Super " , "Trigger-happy " , "Fearless " ] , mains = [ "Average Joe" , "Sir Wellington" , "Sam Harberspoon" , "Jimbo" , "Ivan" , "Sallyworth" , "Kennith" , "Malinda" , "Anastasia" , "Billingford" , "Daniel" , "Lady Ferrington" , "\"Max the Axe\"" , "Eliza" , "Boddington" , "Cudworth" , "Manfred McMurphy" , "Hector" , "\"Alice the Ace\"" , "Jessica" ] , suffix1s = [ " the Disgraced" , " the Undisputed" , " the Bashful" , " the Terrible" , " the Forgetful" , " the Unknown" , " the Dim-witted" , " the Third" , " the Unknown" , " the Outcast" , " the Wonderful" , " Senior" , " Junior" ] , suffix2s = [ ", from far, far away" , " and a team of trained ferrets" , ", of royal descent" , ", of recent notoriety" , ", of unparalleled beauty" , ", of questionable antics" , ", trained by monks" , ", who took one semester of \"Monster Hunting 101\"" , ", wielding \"Fighting Monsters for Dummies\"" , ", who just wants everyone to get along" ] } makeLineUp : Int -> Random.Generator LineUp makeLineUp n = let heroImageCount = 22 monsterImageCount = 22 heroImages = List.range 1 heroImageCount |> Random.shuffle monsteroImages = List.range 1 monsterImageCount |> Random.shuffle randomNames nameOptions = let sometimesTakeName p l = Random.weighted ( 1 - p, ( "", l ) ) [ ( p, ( List.head l |> Maybe.withDefault "", List.drop 1 l ) ) ] recur n_ g = if n_ == 0 then g else Random.andThen (\( results, { prefixs, mains, suffix1s, suffix2s } ) -> recur (n_ - 1) <| Random.map4 (\( p, ps ) ( m, ms ) ( s1, s1s ) ( s2, s2s ) -> ( String.join "" [ p, m, s1, s2 ] :: results , NameOptions ps ms s1s s2s ) ) (sometimesTakeName 0.4 prefixs) (sometimesTakeName 1 mains) (sometimesTakeName 0.2 suffix1s) (sometimesTakeName 0.2 suffix2s) ) g in Random.pair (Random.constant []) (Random.map4 NameOptions (Random.shuffle nameOptions.prefixs) (Random.shuffle nameOptions.mains) (Random.shuffle nameOptions.suffix1s) (Random.shuffle nameOptions.suffix2s) ) |> recur n |> Random.map Tuple.first monsters = Random.map2 (List.map2 Character) (randomNames monsterNameOptions) monsteroImages heroes = Random.map2 (List.map2 Character) (randomNames heroNameOptions) heroImages in Random.map2 LineUp heroes monsters getDescription : NarrativeParser.Config MyEntity -> WorldModel.ID -> MyWorldModel -> String getDescription config entityID worldModel_ = Dict.get entityID worldModel_ |> Maybe.map .description |> Maybe.withDefault ("ERROR can't find entity " ++ entityID) |> NarrativeParser.parse config |> List.head |> Maybe.withDefault ("ERROR parsing narrative content for " ++ entityID) getName : WorldModel.ID -> MyWorldModel -> String getName entityID worldModel_ = Dict.get entityID worldModel_ |> Maybe.map .name |> Maybe.withDefault ("ERROR can't find entity " ++ entityID) makeConfig : WorldModel.ID -> Rules.RuleID -> Dict String Int -> MyWorldModel -> NarrativeParser.Config MyEntity makeConfig trigger matchedRule ruleCounts worldModel = { cycleIndex = Dict.get matchedRule ruleCounts |> Maybe.withDefault 0 , propKeywords = Dict.singleton "name" (\id -> Ok <| getName id worldModel) , worldModel = worldModel , trigger = trigger } type alias ParsedEntity = Result SyntaxHelpers.ParseErrors ( WorldModel.ID, MyEntity ) type alias Character = { name : String, image : Int } type alias LineUp = { heroes : List Character , monsters : List Character } type alias Levels = { heroes : List Int , monsters : List Int } type Msg = InteractWith WorldModel.ID | UpdateDebugSearchText String | AddEntities (EntityParser.ParsedWorldModel EntityFields) | AddRules (RuleParser.ParsedRules RuleFields) | LineupGenerated LineUp | GenerateLevelsForRound | BonusesGenerated (List String) | BonusSelected (Model -> Model) | UseSpell String (Model -> Model) | StartRound Levels | Tick | HeroSelected WorldModel.ID | AppealForBraveryContinue | HeroPreview (Maybe WorldModel.ID) | ResetRound | ResetGame | ClearBattlefield | PlaySound String type alias EntitySpec = { description : String, entity : String, name : String } type alias RuleSpec = { rule : String, rule_id : String, narrative : String } port playSound : String -> Cmd msg subscriptions : Model -> Sub Msg subscriptions _ = Sub.batch [] parseEntities : List EntitySpec -> EntityParser.ParsedWorldModel EntityFields parseEntities entities = let addExtraEntityFields { description, name } { tags, stats, links } = { tags = tags , stats = stats , links = links , name = name , description = description } parsedEntities = entities |> List.map (\{ entity, description, name } -> ( entity, { description = description, name = name } )) |> EntityParser.parseMany addExtraEntityFields parsedDescriptions = entities |> List.map (\{ entity, description } -> ( entity, description )) |> Dict.fromList |> NarrativeParser.parseMany in parsedDescriptions |> Result.andThen (always parsedEntities) parseRules : List RuleSpec -> RuleParser.ParsedRules RuleFields parseRules rules = let addExtraEntityFields { narrative } { changes, conditions, trigger } = { trigger = trigger , conditions = conditions , changes = changes , narrative = narrative } parsedRules = rules |> List.map (\{ rule_id, rule, narrative } -> ( rule_id, ( rule, { narrative = narrative } ) )) |> Dict.fromList |> RuleParser.parseRules addExtraEntityFields parsedNarratives = rules |> List.map (\{ rule_id, narrative } -> ( rule_id, narrative )) |> Dict.fromList |> NarrativeParser.parseMany in parsedNarratives |> Result.andThen (always parsedRules) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of InteractWith trigger -> -- we need to check if any rule matched case Rules.findMatchingRule trigger model.rules model.worldModel of Just ( matchedRuleID, { changes, narrative } ) -> ( { model | worldModel = WorldModel.applyChanges changes trigger model.worldModel , story = narrative |> NarrativeParser.parse (makeConfig trigger matchedRuleID model.ruleCounts model.worldModel) |> String.join "\n\n" , ruleCounts = Dict.update matchedRuleID (Maybe.map ((+) 1) >> Maybe.withDefault 1 >> Just) model.ruleCounts , debug = model.debug |> NarrativeEngine.Debug.setLastMatchedRuleId matchedRuleID |> NarrativeEngine.Debug.setLastInteractionId trigger } , Cmd.none ) Nothing -> ( { model | story = getDescription (makeConfig trigger trigger model.ruleCounts model.worldModel) trigger model.worldModel , ruleCounts = Dict.update trigger (Maybe.map ((+) 1) >> Maybe.withDefault 1 >> Just) model.ruleCounts , debug = model.debug |> NarrativeEngine.Debug.setLastMatchedRuleId trigger |> NarrativeEngine.Debug.setLastInteractionId trigger } , Cmd.none ) UpdateDebugSearchText searchText -> ( { model | debug = NarrativeEngine.Debug.updateSearch searchText model.debug }, Cmd.none ) AddEntities parsedEntities -> case parsedEntities of Err errors -> ( { model | parseErrors = Just errors }, Cmd.none ) Ok newEntities -> ( { model | parseErrors = Nothing, worldModel = Dict.union newEntities model.worldModel }, Cmd.none ) AddRules parsedRules -> case parsedRules of Err errors -> ( { model | parseErrors = Just errors }, Cmd.none ) Ok newRules -> ( { model | parseErrors = Nothing, rules = Dict.union newRules model.rules }, Cmd.none ) LineupGenerated lineUp -> ( { model | generatedHeroes = lineUp.heroes, generatedMonsters = lineUp.monsters } , Random.generate BonusesGenerated (Dict.keys bonuses |> Random.shuffle) ) BonusesGenerated bonusOptions -> update GenerateLevelsForRound { model | bonusOptions = bonusOptions } BonusSelected selectFn -> update GenerateLevelsForRound (selectFn { model | bonusOptions = List.drop 2 model.bonusOptions }) UseSpell usedName useFn -> ( useFn { model | spells = List.filter (\name -> name /= usedName) model.spells }, Cmd.none ) GenerateLevelsForRound -> let levelRange = List.range 1 model.lineUpCount monsterLevels = levelRange |> List.map ((*) 10) |> Random.shuffle heroLevels = levelRange |> List.map ((*) 10 >> (+) 5) |> Random.shuffle levelsForRound h m = { heroes = h, monsters = m } in ( { model | chooseBonus = False }, Random.generate StartRound (Random.map2 levelsForRound heroLevels monsterLevels) ) StartRound levels -> let toId tag name = tag ++ "-" ++ name |> String.replace " " "_" |> String.replace "," "" |> String.replace "'" "_" |> String.replace "-" "_" |> String.replace "\"" "" makeCharacter tag = List.map2 (\{ name, image } level -> ( toId tag name , { tags = emptyTags , stats = emptyStats , links = emptyLinks , name = name , description = "" } |> addTag tag |> setStat "level" level |> setStat "image" image ) ) entities = [] ++ (makeCharacter "hero" (List.take model.lineUpCount model.generatedHeroes) levels.heroes |> List.map (if hasBonus "Scroll of self awareness" model then Tuple.mapSecond (addTag "revealed") else identity ) ) ++ makeCharacter "monster" (List.take model.lineUpCount model.generatedMonsters) levels.monsters |> Dict.fromList in ( { model | worldModel = entities , generatedHeroes = List.drop model.lineUpCount model.generatedHeroes , generatedMonsters = List.drop model.lineUpCount model.generatedMonsters , story = "Your village is under attack from invading monsters! You must send out your heroes to fight them off.\n\n Just one problem - you don't know anyone's strengths, so you'll have to figure it out as you go." , continueButton = Just ( "Ready!", Tick ) } , Cmd.none ) ResetRound -> let worldModel = updateWorldModel [ "(*.hero).-fighting.-defeated.-victorious" , "(*.monster).-fighting.-defeated" ] model.worldModel in ( { model | worldModel = worldModel , story = "The clock rolls back..." , score = model.score - model.round , round = model.round + 1 , continueButton = Nothing } , Cmd.batch [ after 1000 Tick ] ) ResetGame -> initialModel Tick -> case [ query "*.monster.fighting.!defeated" model.worldModel , query "*.hero.fighting.!defeated.!victorious" model.worldModel , query "*.monster.!fighting.!defeated" model.worldModel , query "*.hero.!fighting.!defeated.!victorious" model.worldModel ] of -- no monster fighting, no monsters left, round won, level up, queue start round -- Important - this must come before the round lost check! [ [], _, [], _ ] -> let gameOver = model.lineUpCount == 6 story = if gameOver then "You fought off all the monsters and they've given up! You did it, your village is safe, you win." else "You fought off all the monsters! +" ++ String.fromInt model.lineUpCount ++ " HP, and you get to choose a bonus above.\n\nBut don't celebrate just yet... looks like trouble brewing on the horizon." continue = if gameOver then Just ( "Play again", ResetGame ) else Nothing in ( { model | lineUpCount = model.lineUpCount + 1 , story = story , chooseBonus = not gameOver , score = model.score + model.lineUpCount , worldModel = updateWorldModel [ "(*).-defeated.-victorious.revealed" ] model.worldModel , round = 1 , continueButton = continue } , playSound "sfx/win" ) -- no hero fighting, no heroes left, round lost, restart lineup [ _, [], _, [] ] -> if model.score >= model.lineUpCount then ( { model | story = "You are out of heroes, but monsters still remain. You have lost the battle.\n\nHowever, you have more insight now. For " ++ String.fromInt model.round ++ " HP you can try again." , continueButton = Just ( "Try again", ResetRound ) } , Cmd.none ) else ( { model | story = "You are out of heroes, but monsters still remain. You have lost the battle. You also don't have enough HP left to try again. You have failed, the monsters win." , worldModel = updateWorldModel [ "(*).-defeated.-victorious.revealed" ] model.worldModel , continueButton = Just ( "Restart", ResetGame ) } , Cmd.none ) -- no monster fighting, monsters available, heros available monster attacks [ [], _, ( monster_up_next, _ ) :: _, _ :: _ ] -> let worldModel = updateWorldModel [ monster_up_next ++ ".fighting" ] model.worldModel in ( { model | worldModel = worldModel , story = getName monster_up_next model.worldModel ++ " attacks! Choose a hero to join the fight." , continueButton = Nothing , chooseHero = True } , playSound "sfx/draw" ) -- monster still fighting, no (undefeated) hero fighting, heroes left, choose hero [ ( monster_fighting, _ ) :: _, [], _, _ :: _ ] -> ( { model | story = getName monster_fighting model.worldModel ++ " is still standing. Try another hero." , continueButton = Nothing , chooseHero = True } , Cmd.none ) -- monster & hero fighting, determine outcome [ ( monster_fighting, _ ) :: _, ( hero_fighting, _ ) :: _, _, _ ] -> let recordVictory = Dict.update hero_fighting (Maybe.map (\h -> Just { h | beat = Set.insert monster_fighting h.beat }) >> Maybe.withDefault (Just { beat = Set.singleton monster_fighting, lost = Set.empty }) ) recordLoss = Dict.update hero_fighting (Maybe.map (\h -> Just { h | lost = Set.insert monster_fighting h.lost }) >> Maybe.withDefault (Just { lost = Set.singleton monster_fighting, beat = Set.empty }) ) in Maybe.map2 (\m_level h_level -> if m_level > h_level then ( { model | story = getName hero_fighting model.worldModel ++ " is defeated! -1 HP" , worldModel = updateWorldModel [ hero_fighting ++ ".defeated" ] model.worldModel , score = model.score - 1 , battleHistory = recordLoss model.battleHistory , continueButton = Nothing } , Cmd.batch [ after 1000 ClearBattlefield ] ) else ( { model | story = getName hero_fighting model.worldModel ++ " is victorious! +1 HP" , worldModel = updateWorldModel [ hero_fighting ++ ".victorious" , monster_fighting ++ (if hasBonus "Charm of persistent insight" model then ".defeated.revealed" else ".defeated" ) ] model.worldModel , score = model.score + 1 , battleHistory = recordVictory model.battleHistory , continueButton = Nothing } , Cmd.batch [ after 1000 ClearBattlefield ] ) ) (getStat monster_fighting "level" model.worldModel) (getStat hero_fighting "level" model.worldModel) |> Maybe.withDefault ( { model | story = "error determining winner" }, Cmd.none ) -- shouldn't ever trigger other -> -- let -- x = -- Debug.log "unexpected match" other -- in ( { model | story = "Error in game loop!" }, Cmd.none ) ClearBattlefield -> ( { model | worldModel = model.worldModel |> updateWorldModel [ "(*.fighting.victorious).-fighting" ] |> updateWorldModel [ "(*.fighting.defeated).-fighting" ] } , after 1500 Tick ) AppealForBraveryContinue -> ( { model | continueButton = Nothing } , Cmd.batch [ after 1500 Tick, after 800 <| PlaySound "sfx/fight" ] ) HeroSelected heroId -> let worldModel = updateWorldModel [ heroId ++ ".fighting.-preview" ] model.worldModel in ( { model | worldModel = worldModel , chooseHero = False , story = getName heroId model.worldModel ++ " joins the fight." , continueButton = Nothing } , Cmd.batch [ after 1500 Tick, after 800 <| PlaySound "sfx/fight", playSound "sfx/select" ] ) HeroPreview Nothing -> let worldModel = updateWorldModel [ "(*.preview).-preview" ] model.worldModel in ( { model | worldModel = worldModel }, Cmd.none ) HeroPreview (Just id) -> let worldModel = updateWorldModel [ id ++ ".preview" ] model.worldModel in ( { model | worldModel = worldModel }, Cmd.none ) PlaySound key -> ( model, playSound key ) after : Float -> Msg -> Cmd Msg after ms msg = Task.perform (always msg) <| Process.sleep ms updateWorldModel : List String -> MyWorldModel -> MyWorldModel updateWorldModel queries worldModel = let parsedChanges = List.foldr (\q acc -> RuleParser.parseChanges q |> Result.map (\c -> c :: acc) |> Result.withDefault acc ) [] queries in applyChanges parsedChanges "no trigger" worldModel query : String -> MyWorldModel -> List ( WorldModel.ID, MyEntity ) query q worldModel = RuleParser.parseMatcher q |> Result.map (\parsedMatcher -> WorldModel.query parsedMatcher worldModel) |> Result.withDefault [] assert : String -> MyWorldModel -> Bool assert q worldModel = not <| List.isEmpty <| query q worldModel view : Model -> Html Msg view model = let heroes = query "*.hero.!fighting.!defeated.!victorious" model.worldModel monsters = query "*.monster.!fighting.!defeated" model.worldModel fightingHero = query "*.hero.fighting" model.worldModel previewHero = if model.chooseHero then query "*.hero.preview" model.worldModel else [] fightingMonster = query "*.monster.fighting" model.worldModel defeated = query "*.!fighting.defeated" model.worldModel victorious = query "*.!fighting.victorious" model.worldModel kindPlural id = if assert (id ++ ".hero") model.worldModel then "heroes" else "monsters" kind id = if assert (id ++ ".hero") model.worldModel then "hero" else "monster" level id = if assert (id ++ ".revealed") model.worldModel then getStat id "level" model.worldModel |> Maybe.map String.fromInt |> Maybe.withDefault "error" else "?" imageNum id = getStat id "image" model.worldModel |> Maybe.withDefault 1 |> String.fromInt characterList attrs = List.map (characterCard attrs) characterCard attrs ( id, { name } ) = div (attrs id ++ [ classList [ ( "character", True ) , ( "character-" ++ kind id, True ) , ( "character-preview", kind id == "hero" && not (List.isEmpty previewHero) ) , ( "defeated", assert (id ++ ".defeated") model.worldModel ) , ( "victorious", assert (id ++ ".victorious") model.worldModel ) ] ] ) [ div [ class "img" , style "background-image" ("url(images/" ++ kindPlural id ++ "/" ++ imageNum id ++ ".png)") ] [] , div [ class "title" ] [ text name ] , div [ class "level" ] [ text <| level id ] ] chooseBonus = model.bonusOptions |> List.take 2 |> List.map (\n -> Dict.get n bonuses |> Maybe.withDefault { name = "error", description = "finding bonus", selectFn = identity, useFn = identity } ) |> List.map (\{ name, description, selectFn } -> button [ class "pure-button button-primary", onClick (BonusSelected selectFn) ] [ h3 [] [ text name ] , p [] [ text description ] ] ) |> div [ class "pure-u-1 select-bonus" ] spells = model.spells |> List.map (\n -> Dict.get n bonuses |> Maybe.withDefault { name = "error", description = "finding bonus", selectFn = identity, useFn = identity } ) |> List.map (\{ name, useFn } -> button [ class "pure-button button-primary", onClick (UseSpell name useFn) ] [ text name ] ) |> div [ class "spells" ] firstOf = List.head >> Maybe.map (characterCard noHandlers) >> Maybe.withDefault (div [ class "hero-placeholder" ] []) isStartFight = -- works for both HeroSelected and AppealForBraveryContinue assert "*.hero.fighting" model.worldModel && model.continueButton == Nothing getHistory fn = previewHero |> List.head |> Maybe.andThen (\h -> Dict.get (Tuple.first h) model.battleHistory) |> Maybe.map (fn >> Set.toList >> List.map (\id -> query id model.worldModel) >> List.concat) |> Maybe.withDefault [] noHandlers = always [] heroHandlers id = [ onMouseEnter <| HeroPreview <| Just id , onMouseLeave <| HeroPreview Nothing ] ++ (if model.chooseHero then [ onClick <| HeroSelected id ] else [] ) conditionalView conds v = if List.all identity conds then v else text "" showEmpty l = if List.isEmpty l then [ text "--" ] else l in div [ class "game" ] -- [ NarrativeEngine.Debug.debugBar UpdateDebugSearchText model.worldModel model.debug [ div [ class "title-main-wrapper" ] [ h3 [ class "title-main" ] [ text "Deduction Quest" ] ] , div [ class "pure-g top" ] [ div [ class "pure-u-1-4 characters characters-heroes" , classList [ ( "select", model.chooseHero ) ] ] (characterList heroHandlers heroes) , div [ class "pure-u-1-2 " ] [ div [ class "pure-g battlefield", classList [ ( "start-fight", isStartFight ) ] ] [ conditionalView [ model.chooseBonus ] chooseBonus , conditionalView [ not model.chooseBonus ] <| div [ class "pure-u-1-2 fighting-zone" ] [ firstOf (previewHero ++ fightingHero) ] , conditionalView [ not model.chooseBonus ] <| div [ class "pure-u-1-2 fighting-zone" ] [ firstOf fightingMonster ] , conditionalView [ model.chooseHero , hasBonus "Relic of photographic memory" model , not <| List.isEmpty previewHero , not <| List.isEmpty <| getHistory .beat ++ getHistory .lost ] <| div [ class "pure-u battle-history" ] [ h3 [] [ text "Defeated:" ] , div [ class "history-characters" ] <| showEmpty <| characterList noHandlers (getHistory .beat) , h3 [] [ text "Lost to:" ] , div [ class "history-characters" ] <| showEmpty <| characterList noHandlers (getHistory .lost) ] ] , div [ class "story", classList [ ( "hide", String.isEmpty model.story ) ] ] [ Markdown.toHtml [] model.story , Maybe.map (\( prompt, msg ) -> button [ class "pure-button button-primary", onClick msg ] [ text prompt ]) model.continueButton |> Maybe.withDefault (text "") ] ] , div [ class "pure-u-1-4 characters characters-monsters" ] (characterList noHandlers monsters) ] , div [ class "bottom" ] [ div [ class "previous-battles" ] (characterList noHandlers (defeated ++ victorious)) , conditionalView [ model.chooseHero ] spells , div [ class "hp" ] [ text <| "HP " ++ String.fromInt model.score ] ] ] main : Program () Model Msg main = Browser.document { init = \f -> initialModel , view = \model -> case model.parseErrors of Just errors -> { title = "Parse Errors" , body = [ SyntaxHelpers.parseErrorsView errors ] } Nothing -> { title = "Deduction Quest" , body = [ view model ] } , update = update , subscriptions = subscriptions }
3389
port module Main exposing (main) import Browser import Dict exposing (Dict) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onMouseEnter, onMouseLeave) import Markdown import NarrativeEngine.Core.Rules as Rules import NarrativeEngine.Core.WorldModel as WorldModel exposing (addTag, applyChanges, emptyLinks, emptyStats, emptyTags, getStat, setStat) import NarrativeEngine.Debug import NarrativeEngine.Syntax.EntityParser as EntityParser import NarrativeEngine.Syntax.Helpers as SyntaxHelpers import NarrativeEngine.Syntax.NarrativeParser as NarrativeParser import NarrativeEngine.Syntax.RuleParser as RuleParser import Process import Random import Random.Extra as Random import Random.List as Random import Set exposing (Set) import Task type alias EntityFields = NamedComponent {} type alias NamedComponent a = { a | name : String , description : String } type alias MyEntity = WorldModel.NarrativeComponent EntityFields type alias MyWorldModel = Dict WorldModel.ID MyEntity type alias RuleFields = NarrativeComponent {} type alias NarrativeComponent a = { a | narrative : String } type alias MyRule = Rules.Rule RuleFields type alias MyRules = Dict String MyRule type alias RulesSpec = Dict Rules.RuleID ( String, {} ) type alias Model = { parseErrors : Maybe SyntaxHelpers.ParseErrors , worldModel : MyWorldModel , rules : MyRules , ruleCounts : Dict String Int , debug : NarrativeEngine.Debug.State , generatedHeroes : List Character , generatedMonsters : List Character , levelsForRound : Levels , chooseHero : Bool , chooseBonus : Bool , lineUpCount : Int , story : String , continueButton : Maybe ( String, Msg ) , score : Int , battleHistory : Dict WorldModel.ID { beat : Set WorldModel.ID, lost : Set WorldModel.ID } , spells : List String , bonuses : Set String , bonusOptions : List String , round : Int } maxCharacters : Int maxCharacters = -- enough images/names to go 4 rounds -- 18 3 + 4 + 5 + 6 initialModel : ( Model, Cmd Msg ) initialModel = ( { parseErrors = Nothing , worldModel = Dict.empty , rules = Dict.empty , ruleCounts = Dict.empty , debug = NarrativeEngine.Debug.init , generatedHeroes = [] , generatedMonsters = [] , levelsForRound = { heroes = [], monsters = [] } , chooseHero = False , chooseBonus = False , lineUpCount = 3 , story = "" , continueButton = Nothing , score = 10 , battleHistory = Dict.empty , spells = [] , bonuses = Set.empty , bonusOptions = [] , round = 1 } , Random.generate LineupGenerated (makeLineUp maxCharacters) ) bonuses = Dict.empty |> bonus "Lucky day" "+10 HP" (\k m -> { m | score = m.score + 10 }) |> bonus "Charm of persistent insight" "Reveal a monster's level when it is defeated" addBonus |> bonus "Scroll of self awareness" "Always reveal hero levels" addBonus |> bonus "Relic of photographic memory" "See outcomes of previous battles" addBonus |> spell "Appeal for bravery" "Automatically select a hero who can beat the current monster, and reveal that hero's level (one-time spell)" addSpell (\m -> let monsterId = query "*.monster.fighting" m.worldModel |> List.head |> Maybe.map Tuple.first |> Maybe.withDefault "?" in case query ("*.hero.!defeated.!victorious.!fighting.level>(stat " ++ monsterId ++ ".level)") m.worldModel |> List.head |> Maybe.map Tuple.first of Nothing -> { m | story = "You shout for a brave hero to step forward... but none do. The heroes that can beat this monster must have already perished. What a shame." } Just id -> { m | story = "You shout for a brave hero to step forward. " ++ getName id m.worldModel ++ " answers the call." , continueButton = Just ( "Continue", AppealForBraveryContinue ) , chooseHero = False , worldModel = updateWorldModel [ id ++ ".revealed.fighting" ] m.worldModel } ) |> spell "Summoning of identification" "Reveal level of current monster (one-time spell)" addSpell (\m -> case query "*.monster.fighting.revealed" m.worldModel of [] -> { m | worldModel = updateWorldModel [ "(*.monster.fighting).revealed" ] m.worldModel , story = "You mutter the forbidden words, the monster fidgets, then bashfully admits its level." } _ -> { m | story = "You mutter the forbidden words, the monster fidgets, then laughs at you, as it reveals the information you already knew. Rookie mistake." } ) |> spell "Incantation of fortification" "Increase level of all currently defeated heroes (one-time spell)" addSpell (\m -> case query "*.hero.defeated" m.worldModel of [] -> { m | story = "You cast this potent spell to strengthen the fallen... but no one is able to benefit. That was foolish." } _ -> { m | worldModel = updateWorldModel [ "(*.hero.defeated).level+10" ] m.worldModel , story = "You look around and see your fallen heroes. This day things look bleak. But tomorrow already feels more promising." } ) |> spell "Show of fierceness" "All defeated monsters will run away (one-time spell)" addSpell (\m -> case query "*.monster.defeated" m.worldModel of [] -> { m | story = "You muster your strength and give a mighty howl. But none of the monsters have taken any blows yet, so they just look at you with a mix of bewilderment and disapproval." } _ -> { m | worldModel = updateWorldModel [ "(*.monster.defeated).-monster.-defeated" ] m.worldModel , story = "You muster your strength and give a mighty howl. The defeated monsters eye you cautiously. You take the opportunity and jab at them. They turn their tails and run off. Good show." } ) bonus name desc selectFn = Dict.insert name { name = name, description = desc, selectFn = selectFn name, useFn = identity } spell name desc selectFn useFn = Dict.insert name { name = name, description = desc, selectFn = selectFn name, useFn = useFn } addBonus k m = { m | bonuses = Set.insert k m.bonuses } addSpell k m = { m | spells = k :: m.spells } hasBonus k m = Set.member k m.bonuses type alias NameOptions = { prefixs : List String , mains : List String , suffix1s : List String , suffix2s : List String } monsterNameOptions : NameOptions monsterNameOptions = { prefixs = [ "Disproportionate " , "Resurrected " , "Deranged " , "Flying " , "Scaly " , "Sleepy " , "Poisonous " , "Cursed " , "Partly invisible " , "Giant " , "Uncommon " , "Misunderstood " , "Dyslexic " , "Seemingly innocent " , "Mutant " , "Undead " , "Mildly annoying " , "Screaming " , "Unstable " , "100 year-old " , "Supernatural " , "Evil " ] , mains = [ "Imp" , "Snail" , "Spider" , "Rodent" , "Sock puppet" , "Bob the Blob" , "Clown" , "Newt" , "Politician" , "Teddy-bear" , "Witch" , "Zombie" , "Hooligan" , "Telemarketer" , "Presence" , "Wraith" , "Ghoul" , "Undertaker" , "Poltergeist" , "Halfling" ] , suffix1s = [ " of doom" , " of disreputable company" , " from Hell" , " infected with scurvy" , " of limited intellect" , " from the house next door" , " from your nightmares" ] , suffix2s = [ " with 1000 eyes" , " with no face" , " with secret powers" , " with nefarious intent" , ", armed to the teeth" , ", without grace" , ", blinded with rage" , ", with glowing tentacles" , ", with a personal vendetta" , ", who hasn't eaten for over a week" , ", who just wants attention" , ", a wanted criminal" ] } heroNameOptions : NameOptions heroNameOptions = { prefixs = [ "Ill-equipped " , "Constable " , "Young " , "Above-average " , "Untrained " , "Angry " , "Crazy " , "Unlucky " , "Undercover " , "Super " , "Trigger-happy " , "Fearless " ] , mains = [ "Average Joe" , "<NAME>" , "<NAME>" , "<NAME>" , "<NAME>" , "<NAME>" , "<NAME>" , "<NAME>" , "<NAME>" , "<NAME>" , "<NAME>" , "<NAME>" , "\"<NAME> the Axe\"" , "<NAME>" , "<NAME>" , "<NAME>" , "<NAME>" , "<NAME>" , "\"<NAME> the Ace\"" , "<NAME>" ] , suffix1s = [ " the Disgraced" , " the Undisputed" , " the Bashful" , " the Terrible" , " the Forgetful" , " the Unknown" , " the Dim-witted" , " the Third" , " the Unknown" , " the Outcast" , " the Wonderful" , " Senior" , " Junior" ] , suffix2s = [ ", from far, far away" , " and a team of trained ferrets" , ", of royal descent" , ", of recent notoriety" , ", of unparalleled beauty" , ", of questionable antics" , ", trained by monks" , ", who took one semester of \"Monster Hunting 101\"" , ", wielding \"Fighting Monsters for Dummies\"" , ", who just wants everyone to get along" ] } makeLineUp : Int -> Random.Generator LineUp makeLineUp n = let heroImageCount = 22 monsterImageCount = 22 heroImages = List.range 1 heroImageCount |> Random.shuffle monsteroImages = List.range 1 monsterImageCount |> Random.shuffle randomNames nameOptions = let sometimesTakeName p l = Random.weighted ( 1 - p, ( "", l ) ) [ ( p, ( List.head l |> Maybe.withDefault "", List.drop 1 l ) ) ] recur n_ g = if n_ == 0 then g else Random.andThen (\( results, { prefixs, mains, suffix1s, suffix2s } ) -> recur (n_ - 1) <| Random.map4 (\( p, ps ) ( m, ms ) ( s1, s1s ) ( s2, s2s ) -> ( String.join "" [ p, m, s1, s2 ] :: results , NameOptions ps ms s1s s2s ) ) (sometimesTakeName 0.4 prefixs) (sometimesTakeName 1 mains) (sometimesTakeName 0.2 suffix1s) (sometimesTakeName 0.2 suffix2s) ) g in Random.pair (Random.constant []) (Random.map4 NameOptions (Random.shuffle nameOptions.prefixs) (Random.shuffle nameOptions.mains) (Random.shuffle nameOptions.suffix1s) (Random.shuffle nameOptions.suffix2s) ) |> recur n |> Random.map Tuple.first monsters = Random.map2 (List.map2 Character) (randomNames monsterNameOptions) monsteroImages heroes = Random.map2 (List.map2 Character) (randomNames heroNameOptions) heroImages in Random.map2 LineUp heroes monsters getDescription : NarrativeParser.Config MyEntity -> WorldModel.ID -> MyWorldModel -> String getDescription config entityID worldModel_ = Dict.get entityID worldModel_ |> Maybe.map .description |> Maybe.withDefault ("ERROR can't find entity " ++ entityID) |> NarrativeParser.parse config |> List.head |> Maybe.withDefault ("ERROR parsing narrative content for " ++ entityID) getName : WorldModel.ID -> MyWorldModel -> String getName entityID worldModel_ = Dict.get entityID worldModel_ |> Maybe.map .name |> Maybe.withDefault ("ERROR can't find entity " ++ entityID) makeConfig : WorldModel.ID -> Rules.RuleID -> Dict String Int -> MyWorldModel -> NarrativeParser.Config MyEntity makeConfig trigger matchedRule ruleCounts worldModel = { cycleIndex = Dict.get matchedRule ruleCounts |> Maybe.withDefault 0 , propKeywords = Dict.singleton "name" (\id -> Ok <| getName id worldModel) , worldModel = worldModel , trigger = trigger } type alias ParsedEntity = Result SyntaxHelpers.ParseErrors ( WorldModel.ID, MyEntity ) type alias Character = { name : String, image : Int } type alias LineUp = { heroes : List Character , monsters : List Character } type alias Levels = { heroes : List Int , monsters : List Int } type Msg = InteractWith WorldModel.ID | UpdateDebugSearchText String | AddEntities (EntityParser.ParsedWorldModel EntityFields) | AddRules (RuleParser.ParsedRules RuleFields) | LineupGenerated LineUp | GenerateLevelsForRound | BonusesGenerated (List String) | BonusSelected (Model -> Model) | UseSpell String (Model -> Model) | StartRound Levels | Tick | HeroSelected WorldModel.ID | AppealForBraveryContinue | HeroPreview (Maybe WorldModel.ID) | ResetRound | ResetGame | ClearBattlefield | PlaySound String type alias EntitySpec = { description : String, entity : String, name : String } type alias RuleSpec = { rule : String, rule_id : String, narrative : String } port playSound : String -> Cmd msg subscriptions : Model -> Sub Msg subscriptions _ = Sub.batch [] parseEntities : List EntitySpec -> EntityParser.ParsedWorldModel EntityFields parseEntities entities = let addExtraEntityFields { description, name } { tags, stats, links } = { tags = tags , stats = stats , links = links , name = name , description = description } parsedEntities = entities |> List.map (\{ entity, description, name } -> ( entity, { description = description, name = name } )) |> EntityParser.parseMany addExtraEntityFields parsedDescriptions = entities |> List.map (\{ entity, description } -> ( entity, description )) |> Dict.fromList |> NarrativeParser.parseMany in parsedDescriptions |> Result.andThen (always parsedEntities) parseRules : List RuleSpec -> RuleParser.ParsedRules RuleFields parseRules rules = let addExtraEntityFields { narrative } { changes, conditions, trigger } = { trigger = trigger , conditions = conditions , changes = changes , narrative = narrative } parsedRules = rules |> List.map (\{ rule_id, rule, narrative } -> ( rule_id, ( rule, { narrative = narrative } ) )) |> Dict.fromList |> RuleParser.parseRules addExtraEntityFields parsedNarratives = rules |> List.map (\{ rule_id, narrative } -> ( rule_id, narrative )) |> Dict.fromList |> NarrativeParser.parseMany in parsedNarratives |> Result.andThen (always parsedRules) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of InteractWith trigger -> -- we need to check if any rule matched case Rules.findMatchingRule trigger model.rules model.worldModel of Just ( matchedRuleID, { changes, narrative } ) -> ( { model | worldModel = WorldModel.applyChanges changes trigger model.worldModel , story = narrative |> NarrativeParser.parse (makeConfig trigger matchedRuleID model.ruleCounts model.worldModel) |> String.join "\n\n" , ruleCounts = Dict.update matchedRuleID (Maybe.map ((+) 1) >> Maybe.withDefault 1 >> Just) model.ruleCounts , debug = model.debug |> NarrativeEngine.Debug.setLastMatchedRuleId matchedRuleID |> NarrativeEngine.Debug.setLastInteractionId trigger } , Cmd.none ) Nothing -> ( { model | story = getDescription (makeConfig trigger trigger model.ruleCounts model.worldModel) trigger model.worldModel , ruleCounts = Dict.update trigger (Maybe.map ((+) 1) >> Maybe.withDefault 1 >> Just) model.ruleCounts , debug = model.debug |> NarrativeEngine.Debug.setLastMatchedRuleId trigger |> NarrativeEngine.Debug.setLastInteractionId trigger } , Cmd.none ) UpdateDebugSearchText searchText -> ( { model | debug = NarrativeEngine.Debug.updateSearch searchText model.debug }, Cmd.none ) AddEntities parsedEntities -> case parsedEntities of Err errors -> ( { model | parseErrors = Just errors }, Cmd.none ) Ok newEntities -> ( { model | parseErrors = Nothing, worldModel = Dict.union newEntities model.worldModel }, Cmd.none ) AddRules parsedRules -> case parsedRules of Err errors -> ( { model | parseErrors = Just errors }, Cmd.none ) Ok newRules -> ( { model | parseErrors = Nothing, rules = Dict.union newRules model.rules }, Cmd.none ) LineupGenerated lineUp -> ( { model | generatedHeroes = lineUp.heroes, generatedMonsters = lineUp.monsters } , Random.generate BonusesGenerated (Dict.keys bonuses |> Random.shuffle) ) BonusesGenerated bonusOptions -> update GenerateLevelsForRound { model | bonusOptions = bonusOptions } BonusSelected selectFn -> update GenerateLevelsForRound (selectFn { model | bonusOptions = List.drop 2 model.bonusOptions }) UseSpell usedName useFn -> ( useFn { model | spells = List.filter (\name -> name /= usedName) model.spells }, Cmd.none ) GenerateLevelsForRound -> let levelRange = List.range 1 model.lineUpCount monsterLevels = levelRange |> List.map ((*) 10) |> Random.shuffle heroLevels = levelRange |> List.map ((*) 10 >> (+) 5) |> Random.shuffle levelsForRound h m = { heroes = h, monsters = m } in ( { model | chooseBonus = False }, Random.generate StartRound (Random.map2 levelsForRound heroLevels monsterLevels) ) StartRound levels -> let toId tag name = tag ++ "-" ++ name |> String.replace " " "_" |> String.replace "," "" |> String.replace "'" "_" |> String.replace "-" "_" |> String.replace "\"" "" makeCharacter tag = List.map2 (\{ name, image } level -> ( toId tag name , { tags = emptyTags , stats = emptyStats , links = emptyLinks , name = name , description = "" } |> addTag tag |> setStat "level" level |> setStat "image" image ) ) entities = [] ++ (makeCharacter "hero" (List.take model.lineUpCount model.generatedHeroes) levels.heroes |> List.map (if hasBonus "Scroll of self awareness" model then Tuple.mapSecond (addTag "revealed") else identity ) ) ++ makeCharacter "monster" (List.take model.lineUpCount model.generatedMonsters) levels.monsters |> Dict.fromList in ( { model | worldModel = entities , generatedHeroes = List.drop model.lineUpCount model.generatedHeroes , generatedMonsters = List.drop model.lineUpCount model.generatedMonsters , story = "Your village is under attack from invading monsters! You must send out your heroes to fight them off.\n\n Just one problem - you don't know anyone's strengths, so you'll have to figure it out as you go." , continueButton = Just ( "Ready!", Tick ) } , Cmd.none ) ResetRound -> let worldModel = updateWorldModel [ "(*.hero).-fighting.-defeated.-victorious" , "(*.monster).-fighting.-defeated" ] model.worldModel in ( { model | worldModel = worldModel , story = "The clock rolls back..." , score = model.score - model.round , round = model.round + 1 , continueButton = Nothing } , Cmd.batch [ after 1000 Tick ] ) ResetGame -> initialModel Tick -> case [ query "*.monster.fighting.!defeated" model.worldModel , query "*.hero.fighting.!defeated.!victorious" model.worldModel , query "*.monster.!fighting.!defeated" model.worldModel , query "*.hero.!fighting.!defeated.!victorious" model.worldModel ] of -- no monster fighting, no monsters left, round won, level up, queue start round -- Important - this must come before the round lost check! [ [], _, [], _ ] -> let gameOver = model.lineUpCount == 6 story = if gameOver then "You fought off all the monsters and they've given up! You did it, your village is safe, you win." else "You fought off all the monsters! +" ++ String.fromInt model.lineUpCount ++ " HP, and you get to choose a bonus above.\n\nBut don't celebrate just yet... looks like trouble brewing on the horizon." continue = if gameOver then Just ( "Play again", ResetGame ) else Nothing in ( { model | lineUpCount = model.lineUpCount + 1 , story = story , chooseBonus = not gameOver , score = model.score + model.lineUpCount , worldModel = updateWorldModel [ "(*).-defeated.-victorious.revealed" ] model.worldModel , round = 1 , continueButton = continue } , playSound "sfx/win" ) -- no hero fighting, no heroes left, round lost, restart lineup [ _, [], _, [] ] -> if model.score >= model.lineUpCount then ( { model | story = "You are out of heroes, but monsters still remain. You have lost the battle.\n\nHowever, you have more insight now. For " ++ String.fromInt model.round ++ " HP you can try again." , continueButton = Just ( "Try again", ResetRound ) } , Cmd.none ) else ( { model | story = "You are out of heroes, but monsters still remain. You have lost the battle. You also don't have enough HP left to try again. You have failed, the monsters win." , worldModel = updateWorldModel [ "(*).-defeated.-victorious.revealed" ] model.worldModel , continueButton = Just ( "Restart", ResetGame ) } , Cmd.none ) -- no monster fighting, monsters available, heros available monster attacks [ [], _, ( monster_up_next, _ ) :: _, _ :: _ ] -> let worldModel = updateWorldModel [ monster_up_next ++ ".fighting" ] model.worldModel in ( { model | worldModel = worldModel , story = getName monster_up_next model.worldModel ++ " attacks! Choose a hero to join the fight." , continueButton = Nothing , chooseHero = True } , playSound "sfx/draw" ) -- monster still fighting, no (undefeated) hero fighting, heroes left, choose hero [ ( monster_fighting, _ ) :: _, [], _, _ :: _ ] -> ( { model | story = getName monster_fighting model.worldModel ++ " is still standing. Try another hero." , continueButton = Nothing , chooseHero = True } , Cmd.none ) -- monster & hero fighting, determine outcome [ ( monster_fighting, _ ) :: _, ( hero_fighting, _ ) :: _, _, _ ] -> let recordVictory = Dict.update hero_fighting (Maybe.map (\h -> Just { h | beat = Set.insert monster_fighting h.beat }) >> Maybe.withDefault (Just { beat = Set.singleton monster_fighting, lost = Set.empty }) ) recordLoss = Dict.update hero_fighting (Maybe.map (\h -> Just { h | lost = Set.insert monster_fighting h.lost }) >> Maybe.withDefault (Just { lost = Set.singleton monster_fighting, beat = Set.empty }) ) in Maybe.map2 (\m_level h_level -> if m_level > h_level then ( { model | story = getName hero_fighting model.worldModel ++ " is defeated! -1 HP" , worldModel = updateWorldModel [ hero_fighting ++ ".defeated" ] model.worldModel , score = model.score - 1 , battleHistory = recordLoss model.battleHistory , continueButton = Nothing } , Cmd.batch [ after 1000 ClearBattlefield ] ) else ( { model | story = getName hero_fighting model.worldModel ++ " is victorious! +1 HP" , worldModel = updateWorldModel [ hero_fighting ++ ".victorious" , monster_fighting ++ (if hasBonus "Charm of persistent insight" model then ".defeated.revealed" else ".defeated" ) ] model.worldModel , score = model.score + 1 , battleHistory = recordVictory model.battleHistory , continueButton = Nothing } , Cmd.batch [ after 1000 ClearBattlefield ] ) ) (getStat monster_fighting "level" model.worldModel) (getStat hero_fighting "level" model.worldModel) |> Maybe.withDefault ( { model | story = "error determining winner" }, Cmd.none ) -- shouldn't ever trigger other -> -- let -- x = -- Debug.log "unexpected match" other -- in ( { model | story = "Error in game loop!" }, Cmd.none ) ClearBattlefield -> ( { model | worldModel = model.worldModel |> updateWorldModel [ "(*.fighting.victorious).-fighting" ] |> updateWorldModel [ "(*.fighting.defeated).-fighting" ] } , after 1500 Tick ) AppealForBraveryContinue -> ( { model | continueButton = Nothing } , Cmd.batch [ after 1500 Tick, after 800 <| PlaySound "sfx/fight" ] ) HeroSelected heroId -> let worldModel = updateWorldModel [ heroId ++ ".fighting.-preview" ] model.worldModel in ( { model | worldModel = worldModel , chooseHero = False , story = getName heroId model.worldModel ++ " joins the fight." , continueButton = Nothing } , Cmd.batch [ after 1500 Tick, after 800 <| PlaySound "sfx/fight", playSound "sfx/select" ] ) HeroPreview Nothing -> let worldModel = updateWorldModel [ "(*.preview).-preview" ] model.worldModel in ( { model | worldModel = worldModel }, Cmd.none ) HeroPreview (Just id) -> let worldModel = updateWorldModel [ id ++ ".preview" ] model.worldModel in ( { model | worldModel = worldModel }, Cmd.none ) PlaySound key -> ( model, playSound key ) after : Float -> Msg -> Cmd Msg after ms msg = Task.perform (always msg) <| Process.sleep ms updateWorldModel : List String -> MyWorldModel -> MyWorldModel updateWorldModel queries worldModel = let parsedChanges = List.foldr (\q acc -> RuleParser.parseChanges q |> Result.map (\c -> c :: acc) |> Result.withDefault acc ) [] queries in applyChanges parsedChanges "no trigger" worldModel query : String -> MyWorldModel -> List ( WorldModel.ID, MyEntity ) query q worldModel = RuleParser.parseMatcher q |> Result.map (\parsedMatcher -> WorldModel.query parsedMatcher worldModel) |> Result.withDefault [] assert : String -> MyWorldModel -> Bool assert q worldModel = not <| List.isEmpty <| query q worldModel view : Model -> Html Msg view model = let heroes = query "*.hero.!fighting.!defeated.!victorious" model.worldModel monsters = query "*.monster.!fighting.!defeated" model.worldModel fightingHero = query "*.hero.fighting" model.worldModel previewHero = if model.chooseHero then query "*.hero.preview" model.worldModel else [] fightingMonster = query "*.monster.fighting" model.worldModel defeated = query "*.!fighting.defeated" model.worldModel victorious = query "*.!fighting.victorious" model.worldModel kindPlural id = if assert (id ++ ".hero") model.worldModel then "heroes" else "monsters" kind id = if assert (id ++ ".hero") model.worldModel then "hero" else "monster" level id = if assert (id ++ ".revealed") model.worldModel then getStat id "level" model.worldModel |> Maybe.map String.fromInt |> Maybe.withDefault "error" else "?" imageNum id = getStat id "image" model.worldModel |> Maybe.withDefault 1 |> String.fromInt characterList attrs = List.map (characterCard attrs) characterCard attrs ( id, { name } ) = div (attrs id ++ [ classList [ ( "character", True ) , ( "character-" ++ kind id, True ) , ( "character-preview", kind id == "hero" && not (List.isEmpty previewHero) ) , ( "defeated", assert (id ++ ".defeated") model.worldModel ) , ( "victorious", assert (id ++ ".victorious") model.worldModel ) ] ] ) [ div [ class "img" , style "background-image" ("url(images/" ++ kindPlural id ++ "/" ++ imageNum id ++ ".png)") ] [] , div [ class "title" ] [ text name ] , div [ class "level" ] [ text <| level id ] ] chooseBonus = model.bonusOptions |> List.take 2 |> List.map (\n -> Dict.get n bonuses |> Maybe.withDefault { name = "error", description = "finding bonus", selectFn = identity, useFn = identity } ) |> List.map (\{ name, description, selectFn } -> button [ class "pure-button button-primary", onClick (BonusSelected selectFn) ] [ h3 [] [ text name ] , p [] [ text description ] ] ) |> div [ class "pure-u-1 select-bonus" ] spells = model.spells |> List.map (\n -> Dict.get n bonuses |> Maybe.withDefault { name = "error", description = "finding bonus", selectFn = identity, useFn = identity } ) |> List.map (\{ name, useFn } -> button [ class "pure-button button-primary", onClick (UseSpell name useFn) ] [ text name ] ) |> div [ class "spells" ] firstOf = List.head >> Maybe.map (characterCard noHandlers) >> Maybe.withDefault (div [ class "hero-placeholder" ] []) isStartFight = -- works for both HeroSelected and AppealForBraveryContinue assert "*.hero.fighting" model.worldModel && model.continueButton == Nothing getHistory fn = previewHero |> List.head |> Maybe.andThen (\h -> Dict.get (Tuple.first h) model.battleHistory) |> Maybe.map (fn >> Set.toList >> List.map (\id -> query id model.worldModel) >> List.concat) |> Maybe.withDefault [] noHandlers = always [] heroHandlers id = [ onMouseEnter <| HeroPreview <| Just id , onMouseLeave <| HeroPreview Nothing ] ++ (if model.chooseHero then [ onClick <| HeroSelected id ] else [] ) conditionalView conds v = if List.all identity conds then v else text "" showEmpty l = if List.isEmpty l then [ text "--" ] else l in div [ class "game" ] -- [ NarrativeEngine.Debug.debugBar UpdateDebugSearchText model.worldModel model.debug [ div [ class "title-main-wrapper" ] [ h3 [ class "title-main" ] [ text "Deduction Quest" ] ] , div [ class "pure-g top" ] [ div [ class "pure-u-1-4 characters characters-heroes" , classList [ ( "select", model.chooseHero ) ] ] (characterList heroHandlers heroes) , div [ class "pure-u-1-2 " ] [ div [ class "pure-g battlefield", classList [ ( "start-fight", isStartFight ) ] ] [ conditionalView [ model.chooseBonus ] chooseBonus , conditionalView [ not model.chooseBonus ] <| div [ class "pure-u-1-2 fighting-zone" ] [ firstOf (previewHero ++ fightingHero) ] , conditionalView [ not model.chooseBonus ] <| div [ class "pure-u-1-2 fighting-zone" ] [ firstOf fightingMonster ] , conditionalView [ model.chooseHero , hasBonus "Relic of photographic memory" model , not <| List.isEmpty previewHero , not <| List.isEmpty <| getHistory .beat ++ getHistory .lost ] <| div [ class "pure-u battle-history" ] [ h3 [] [ text "Defeated:" ] , div [ class "history-characters" ] <| showEmpty <| characterList noHandlers (getHistory .beat) , h3 [] [ text "Lost to:" ] , div [ class "history-characters" ] <| showEmpty <| characterList noHandlers (getHistory .lost) ] ] , div [ class "story", classList [ ( "hide", String.isEmpty model.story ) ] ] [ Markdown.toHtml [] model.story , Maybe.map (\( prompt, msg ) -> button [ class "pure-button button-primary", onClick msg ] [ text prompt ]) model.continueButton |> Maybe.withDefault (text "") ] ] , div [ class "pure-u-1-4 characters characters-monsters" ] (characterList noHandlers monsters) ] , div [ class "bottom" ] [ div [ class "previous-battles" ] (characterList noHandlers (defeated ++ victorious)) , conditionalView [ model.chooseHero ] spells , div [ class "hp" ] [ text <| "HP " ++ String.fromInt model.score ] ] ] main : Program () Model Msg main = Browser.document { init = \f -> initialModel , view = \model -> case model.parseErrors of Just errors -> { title = "Parse Errors" , body = [ SyntaxHelpers.parseErrorsView errors ] } Nothing -> { title = "Deduction Quest" , body = [ view model ] } , update = update , subscriptions = subscriptions }
true
port module Main exposing (main) import Browser import Dict exposing (Dict) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onMouseEnter, onMouseLeave) import Markdown import NarrativeEngine.Core.Rules as Rules import NarrativeEngine.Core.WorldModel as WorldModel exposing (addTag, applyChanges, emptyLinks, emptyStats, emptyTags, getStat, setStat) import NarrativeEngine.Debug import NarrativeEngine.Syntax.EntityParser as EntityParser import NarrativeEngine.Syntax.Helpers as SyntaxHelpers import NarrativeEngine.Syntax.NarrativeParser as NarrativeParser import NarrativeEngine.Syntax.RuleParser as RuleParser import Process import Random import Random.Extra as Random import Random.List as Random import Set exposing (Set) import Task type alias EntityFields = NamedComponent {} type alias NamedComponent a = { a | name : String , description : String } type alias MyEntity = WorldModel.NarrativeComponent EntityFields type alias MyWorldModel = Dict WorldModel.ID MyEntity type alias RuleFields = NarrativeComponent {} type alias NarrativeComponent a = { a | narrative : String } type alias MyRule = Rules.Rule RuleFields type alias MyRules = Dict String MyRule type alias RulesSpec = Dict Rules.RuleID ( String, {} ) type alias Model = { parseErrors : Maybe SyntaxHelpers.ParseErrors , worldModel : MyWorldModel , rules : MyRules , ruleCounts : Dict String Int , debug : NarrativeEngine.Debug.State , generatedHeroes : List Character , generatedMonsters : List Character , levelsForRound : Levels , chooseHero : Bool , chooseBonus : Bool , lineUpCount : Int , story : String , continueButton : Maybe ( String, Msg ) , score : Int , battleHistory : Dict WorldModel.ID { beat : Set WorldModel.ID, lost : Set WorldModel.ID } , spells : List String , bonuses : Set String , bonusOptions : List String , round : Int } maxCharacters : Int maxCharacters = -- enough images/names to go 4 rounds -- 18 3 + 4 + 5 + 6 initialModel : ( Model, Cmd Msg ) initialModel = ( { parseErrors = Nothing , worldModel = Dict.empty , rules = Dict.empty , ruleCounts = Dict.empty , debug = NarrativeEngine.Debug.init , generatedHeroes = [] , generatedMonsters = [] , levelsForRound = { heroes = [], monsters = [] } , chooseHero = False , chooseBonus = False , lineUpCount = 3 , story = "" , continueButton = Nothing , score = 10 , battleHistory = Dict.empty , spells = [] , bonuses = Set.empty , bonusOptions = [] , round = 1 } , Random.generate LineupGenerated (makeLineUp maxCharacters) ) bonuses = Dict.empty |> bonus "Lucky day" "+10 HP" (\k m -> { m | score = m.score + 10 }) |> bonus "Charm of persistent insight" "Reveal a monster's level when it is defeated" addBonus |> bonus "Scroll of self awareness" "Always reveal hero levels" addBonus |> bonus "Relic of photographic memory" "See outcomes of previous battles" addBonus |> spell "Appeal for bravery" "Automatically select a hero who can beat the current monster, and reveal that hero's level (one-time spell)" addSpell (\m -> let monsterId = query "*.monster.fighting" m.worldModel |> List.head |> Maybe.map Tuple.first |> Maybe.withDefault "?" in case query ("*.hero.!defeated.!victorious.!fighting.level>(stat " ++ monsterId ++ ".level)") m.worldModel |> List.head |> Maybe.map Tuple.first of Nothing -> { m | story = "You shout for a brave hero to step forward... but none do. The heroes that can beat this monster must have already perished. What a shame." } Just id -> { m | story = "You shout for a brave hero to step forward. " ++ getName id m.worldModel ++ " answers the call." , continueButton = Just ( "Continue", AppealForBraveryContinue ) , chooseHero = False , worldModel = updateWorldModel [ id ++ ".revealed.fighting" ] m.worldModel } ) |> spell "Summoning of identification" "Reveal level of current monster (one-time spell)" addSpell (\m -> case query "*.monster.fighting.revealed" m.worldModel of [] -> { m | worldModel = updateWorldModel [ "(*.monster.fighting).revealed" ] m.worldModel , story = "You mutter the forbidden words, the monster fidgets, then bashfully admits its level." } _ -> { m | story = "You mutter the forbidden words, the monster fidgets, then laughs at you, as it reveals the information you already knew. Rookie mistake." } ) |> spell "Incantation of fortification" "Increase level of all currently defeated heroes (one-time spell)" addSpell (\m -> case query "*.hero.defeated" m.worldModel of [] -> { m | story = "You cast this potent spell to strengthen the fallen... but no one is able to benefit. That was foolish." } _ -> { m | worldModel = updateWorldModel [ "(*.hero.defeated).level+10" ] m.worldModel , story = "You look around and see your fallen heroes. This day things look bleak. But tomorrow already feels more promising." } ) |> spell "Show of fierceness" "All defeated monsters will run away (one-time spell)" addSpell (\m -> case query "*.monster.defeated" m.worldModel of [] -> { m | story = "You muster your strength and give a mighty howl. But none of the monsters have taken any blows yet, so they just look at you with a mix of bewilderment and disapproval." } _ -> { m | worldModel = updateWorldModel [ "(*.monster.defeated).-monster.-defeated" ] m.worldModel , story = "You muster your strength and give a mighty howl. The defeated monsters eye you cautiously. You take the opportunity and jab at them. They turn their tails and run off. Good show." } ) bonus name desc selectFn = Dict.insert name { name = name, description = desc, selectFn = selectFn name, useFn = identity } spell name desc selectFn useFn = Dict.insert name { name = name, description = desc, selectFn = selectFn name, useFn = useFn } addBonus k m = { m | bonuses = Set.insert k m.bonuses } addSpell k m = { m | spells = k :: m.spells } hasBonus k m = Set.member k m.bonuses type alias NameOptions = { prefixs : List String , mains : List String , suffix1s : List String , suffix2s : List String } monsterNameOptions : NameOptions monsterNameOptions = { prefixs = [ "Disproportionate " , "Resurrected " , "Deranged " , "Flying " , "Scaly " , "Sleepy " , "Poisonous " , "Cursed " , "Partly invisible " , "Giant " , "Uncommon " , "Misunderstood " , "Dyslexic " , "Seemingly innocent " , "Mutant " , "Undead " , "Mildly annoying " , "Screaming " , "Unstable " , "100 year-old " , "Supernatural " , "Evil " ] , mains = [ "Imp" , "Snail" , "Spider" , "Rodent" , "Sock puppet" , "Bob the Blob" , "Clown" , "Newt" , "Politician" , "Teddy-bear" , "Witch" , "Zombie" , "Hooligan" , "Telemarketer" , "Presence" , "Wraith" , "Ghoul" , "Undertaker" , "Poltergeist" , "Halfling" ] , suffix1s = [ " of doom" , " of disreputable company" , " from Hell" , " infected with scurvy" , " of limited intellect" , " from the house next door" , " from your nightmares" ] , suffix2s = [ " with 1000 eyes" , " with no face" , " with secret powers" , " with nefarious intent" , ", armed to the teeth" , ", without grace" , ", blinded with rage" , ", with glowing tentacles" , ", with a personal vendetta" , ", who hasn't eaten for over a week" , ", who just wants attention" , ", a wanted criminal" ] } heroNameOptions : NameOptions heroNameOptions = { prefixs = [ "Ill-equipped " , "Constable " , "Young " , "Above-average " , "Untrained " , "Angry " , "Crazy " , "Unlucky " , "Undercover " , "Super " , "Trigger-happy " , "Fearless " ] , mains = [ "Average Joe" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "\"PI:NAME:<NAME>END_PI the Axe\"" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "PI:NAME:<NAME>END_PI" , "\"PI:NAME:<NAME>END_PI the Ace\"" , "PI:NAME:<NAME>END_PI" ] , suffix1s = [ " the Disgraced" , " the Undisputed" , " the Bashful" , " the Terrible" , " the Forgetful" , " the Unknown" , " the Dim-witted" , " the Third" , " the Unknown" , " the Outcast" , " the Wonderful" , " Senior" , " Junior" ] , suffix2s = [ ", from far, far away" , " and a team of trained ferrets" , ", of royal descent" , ", of recent notoriety" , ", of unparalleled beauty" , ", of questionable antics" , ", trained by monks" , ", who took one semester of \"Monster Hunting 101\"" , ", wielding \"Fighting Monsters for Dummies\"" , ", who just wants everyone to get along" ] } makeLineUp : Int -> Random.Generator LineUp makeLineUp n = let heroImageCount = 22 monsterImageCount = 22 heroImages = List.range 1 heroImageCount |> Random.shuffle monsteroImages = List.range 1 monsterImageCount |> Random.shuffle randomNames nameOptions = let sometimesTakeName p l = Random.weighted ( 1 - p, ( "", l ) ) [ ( p, ( List.head l |> Maybe.withDefault "", List.drop 1 l ) ) ] recur n_ g = if n_ == 0 then g else Random.andThen (\( results, { prefixs, mains, suffix1s, suffix2s } ) -> recur (n_ - 1) <| Random.map4 (\( p, ps ) ( m, ms ) ( s1, s1s ) ( s2, s2s ) -> ( String.join "" [ p, m, s1, s2 ] :: results , NameOptions ps ms s1s s2s ) ) (sometimesTakeName 0.4 prefixs) (sometimesTakeName 1 mains) (sometimesTakeName 0.2 suffix1s) (sometimesTakeName 0.2 suffix2s) ) g in Random.pair (Random.constant []) (Random.map4 NameOptions (Random.shuffle nameOptions.prefixs) (Random.shuffle nameOptions.mains) (Random.shuffle nameOptions.suffix1s) (Random.shuffle nameOptions.suffix2s) ) |> recur n |> Random.map Tuple.first monsters = Random.map2 (List.map2 Character) (randomNames monsterNameOptions) monsteroImages heroes = Random.map2 (List.map2 Character) (randomNames heroNameOptions) heroImages in Random.map2 LineUp heroes monsters getDescription : NarrativeParser.Config MyEntity -> WorldModel.ID -> MyWorldModel -> String getDescription config entityID worldModel_ = Dict.get entityID worldModel_ |> Maybe.map .description |> Maybe.withDefault ("ERROR can't find entity " ++ entityID) |> NarrativeParser.parse config |> List.head |> Maybe.withDefault ("ERROR parsing narrative content for " ++ entityID) getName : WorldModel.ID -> MyWorldModel -> String getName entityID worldModel_ = Dict.get entityID worldModel_ |> Maybe.map .name |> Maybe.withDefault ("ERROR can't find entity " ++ entityID) makeConfig : WorldModel.ID -> Rules.RuleID -> Dict String Int -> MyWorldModel -> NarrativeParser.Config MyEntity makeConfig trigger matchedRule ruleCounts worldModel = { cycleIndex = Dict.get matchedRule ruleCounts |> Maybe.withDefault 0 , propKeywords = Dict.singleton "name" (\id -> Ok <| getName id worldModel) , worldModel = worldModel , trigger = trigger } type alias ParsedEntity = Result SyntaxHelpers.ParseErrors ( WorldModel.ID, MyEntity ) type alias Character = { name : String, image : Int } type alias LineUp = { heroes : List Character , monsters : List Character } type alias Levels = { heroes : List Int , monsters : List Int } type Msg = InteractWith WorldModel.ID | UpdateDebugSearchText String | AddEntities (EntityParser.ParsedWorldModel EntityFields) | AddRules (RuleParser.ParsedRules RuleFields) | LineupGenerated LineUp | GenerateLevelsForRound | BonusesGenerated (List String) | BonusSelected (Model -> Model) | UseSpell String (Model -> Model) | StartRound Levels | Tick | HeroSelected WorldModel.ID | AppealForBraveryContinue | HeroPreview (Maybe WorldModel.ID) | ResetRound | ResetGame | ClearBattlefield | PlaySound String type alias EntitySpec = { description : String, entity : String, name : String } type alias RuleSpec = { rule : String, rule_id : String, narrative : String } port playSound : String -> Cmd msg subscriptions : Model -> Sub Msg subscriptions _ = Sub.batch [] parseEntities : List EntitySpec -> EntityParser.ParsedWorldModel EntityFields parseEntities entities = let addExtraEntityFields { description, name } { tags, stats, links } = { tags = tags , stats = stats , links = links , name = name , description = description } parsedEntities = entities |> List.map (\{ entity, description, name } -> ( entity, { description = description, name = name } )) |> EntityParser.parseMany addExtraEntityFields parsedDescriptions = entities |> List.map (\{ entity, description } -> ( entity, description )) |> Dict.fromList |> NarrativeParser.parseMany in parsedDescriptions |> Result.andThen (always parsedEntities) parseRules : List RuleSpec -> RuleParser.ParsedRules RuleFields parseRules rules = let addExtraEntityFields { narrative } { changes, conditions, trigger } = { trigger = trigger , conditions = conditions , changes = changes , narrative = narrative } parsedRules = rules |> List.map (\{ rule_id, rule, narrative } -> ( rule_id, ( rule, { narrative = narrative } ) )) |> Dict.fromList |> RuleParser.parseRules addExtraEntityFields parsedNarratives = rules |> List.map (\{ rule_id, narrative } -> ( rule_id, narrative )) |> Dict.fromList |> NarrativeParser.parseMany in parsedNarratives |> Result.andThen (always parsedRules) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of InteractWith trigger -> -- we need to check if any rule matched case Rules.findMatchingRule trigger model.rules model.worldModel of Just ( matchedRuleID, { changes, narrative } ) -> ( { model | worldModel = WorldModel.applyChanges changes trigger model.worldModel , story = narrative |> NarrativeParser.parse (makeConfig trigger matchedRuleID model.ruleCounts model.worldModel) |> String.join "\n\n" , ruleCounts = Dict.update matchedRuleID (Maybe.map ((+) 1) >> Maybe.withDefault 1 >> Just) model.ruleCounts , debug = model.debug |> NarrativeEngine.Debug.setLastMatchedRuleId matchedRuleID |> NarrativeEngine.Debug.setLastInteractionId trigger } , Cmd.none ) Nothing -> ( { model | story = getDescription (makeConfig trigger trigger model.ruleCounts model.worldModel) trigger model.worldModel , ruleCounts = Dict.update trigger (Maybe.map ((+) 1) >> Maybe.withDefault 1 >> Just) model.ruleCounts , debug = model.debug |> NarrativeEngine.Debug.setLastMatchedRuleId trigger |> NarrativeEngine.Debug.setLastInteractionId trigger } , Cmd.none ) UpdateDebugSearchText searchText -> ( { model | debug = NarrativeEngine.Debug.updateSearch searchText model.debug }, Cmd.none ) AddEntities parsedEntities -> case parsedEntities of Err errors -> ( { model | parseErrors = Just errors }, Cmd.none ) Ok newEntities -> ( { model | parseErrors = Nothing, worldModel = Dict.union newEntities model.worldModel }, Cmd.none ) AddRules parsedRules -> case parsedRules of Err errors -> ( { model | parseErrors = Just errors }, Cmd.none ) Ok newRules -> ( { model | parseErrors = Nothing, rules = Dict.union newRules model.rules }, Cmd.none ) LineupGenerated lineUp -> ( { model | generatedHeroes = lineUp.heroes, generatedMonsters = lineUp.monsters } , Random.generate BonusesGenerated (Dict.keys bonuses |> Random.shuffle) ) BonusesGenerated bonusOptions -> update GenerateLevelsForRound { model | bonusOptions = bonusOptions } BonusSelected selectFn -> update GenerateLevelsForRound (selectFn { model | bonusOptions = List.drop 2 model.bonusOptions }) UseSpell usedName useFn -> ( useFn { model | spells = List.filter (\name -> name /= usedName) model.spells }, Cmd.none ) GenerateLevelsForRound -> let levelRange = List.range 1 model.lineUpCount monsterLevels = levelRange |> List.map ((*) 10) |> Random.shuffle heroLevels = levelRange |> List.map ((*) 10 >> (+) 5) |> Random.shuffle levelsForRound h m = { heroes = h, monsters = m } in ( { model | chooseBonus = False }, Random.generate StartRound (Random.map2 levelsForRound heroLevels monsterLevels) ) StartRound levels -> let toId tag name = tag ++ "-" ++ name |> String.replace " " "_" |> String.replace "," "" |> String.replace "'" "_" |> String.replace "-" "_" |> String.replace "\"" "" makeCharacter tag = List.map2 (\{ name, image } level -> ( toId tag name , { tags = emptyTags , stats = emptyStats , links = emptyLinks , name = name , description = "" } |> addTag tag |> setStat "level" level |> setStat "image" image ) ) entities = [] ++ (makeCharacter "hero" (List.take model.lineUpCount model.generatedHeroes) levels.heroes |> List.map (if hasBonus "Scroll of self awareness" model then Tuple.mapSecond (addTag "revealed") else identity ) ) ++ makeCharacter "monster" (List.take model.lineUpCount model.generatedMonsters) levels.monsters |> Dict.fromList in ( { model | worldModel = entities , generatedHeroes = List.drop model.lineUpCount model.generatedHeroes , generatedMonsters = List.drop model.lineUpCount model.generatedMonsters , story = "Your village is under attack from invading monsters! You must send out your heroes to fight them off.\n\n Just one problem - you don't know anyone's strengths, so you'll have to figure it out as you go." , continueButton = Just ( "Ready!", Tick ) } , Cmd.none ) ResetRound -> let worldModel = updateWorldModel [ "(*.hero).-fighting.-defeated.-victorious" , "(*.monster).-fighting.-defeated" ] model.worldModel in ( { model | worldModel = worldModel , story = "The clock rolls back..." , score = model.score - model.round , round = model.round + 1 , continueButton = Nothing } , Cmd.batch [ after 1000 Tick ] ) ResetGame -> initialModel Tick -> case [ query "*.monster.fighting.!defeated" model.worldModel , query "*.hero.fighting.!defeated.!victorious" model.worldModel , query "*.monster.!fighting.!defeated" model.worldModel , query "*.hero.!fighting.!defeated.!victorious" model.worldModel ] of -- no monster fighting, no monsters left, round won, level up, queue start round -- Important - this must come before the round lost check! [ [], _, [], _ ] -> let gameOver = model.lineUpCount == 6 story = if gameOver then "You fought off all the monsters and they've given up! You did it, your village is safe, you win." else "You fought off all the monsters! +" ++ String.fromInt model.lineUpCount ++ " HP, and you get to choose a bonus above.\n\nBut don't celebrate just yet... looks like trouble brewing on the horizon." continue = if gameOver then Just ( "Play again", ResetGame ) else Nothing in ( { model | lineUpCount = model.lineUpCount + 1 , story = story , chooseBonus = not gameOver , score = model.score + model.lineUpCount , worldModel = updateWorldModel [ "(*).-defeated.-victorious.revealed" ] model.worldModel , round = 1 , continueButton = continue } , playSound "sfx/win" ) -- no hero fighting, no heroes left, round lost, restart lineup [ _, [], _, [] ] -> if model.score >= model.lineUpCount then ( { model | story = "You are out of heroes, but monsters still remain. You have lost the battle.\n\nHowever, you have more insight now. For " ++ String.fromInt model.round ++ " HP you can try again." , continueButton = Just ( "Try again", ResetRound ) } , Cmd.none ) else ( { model | story = "You are out of heroes, but monsters still remain. You have lost the battle. You also don't have enough HP left to try again. You have failed, the monsters win." , worldModel = updateWorldModel [ "(*).-defeated.-victorious.revealed" ] model.worldModel , continueButton = Just ( "Restart", ResetGame ) } , Cmd.none ) -- no monster fighting, monsters available, heros available monster attacks [ [], _, ( monster_up_next, _ ) :: _, _ :: _ ] -> let worldModel = updateWorldModel [ monster_up_next ++ ".fighting" ] model.worldModel in ( { model | worldModel = worldModel , story = getName monster_up_next model.worldModel ++ " attacks! Choose a hero to join the fight." , continueButton = Nothing , chooseHero = True } , playSound "sfx/draw" ) -- monster still fighting, no (undefeated) hero fighting, heroes left, choose hero [ ( monster_fighting, _ ) :: _, [], _, _ :: _ ] -> ( { model | story = getName monster_fighting model.worldModel ++ " is still standing. Try another hero." , continueButton = Nothing , chooseHero = True } , Cmd.none ) -- monster & hero fighting, determine outcome [ ( monster_fighting, _ ) :: _, ( hero_fighting, _ ) :: _, _, _ ] -> let recordVictory = Dict.update hero_fighting (Maybe.map (\h -> Just { h | beat = Set.insert monster_fighting h.beat }) >> Maybe.withDefault (Just { beat = Set.singleton monster_fighting, lost = Set.empty }) ) recordLoss = Dict.update hero_fighting (Maybe.map (\h -> Just { h | lost = Set.insert monster_fighting h.lost }) >> Maybe.withDefault (Just { lost = Set.singleton monster_fighting, beat = Set.empty }) ) in Maybe.map2 (\m_level h_level -> if m_level > h_level then ( { model | story = getName hero_fighting model.worldModel ++ " is defeated! -1 HP" , worldModel = updateWorldModel [ hero_fighting ++ ".defeated" ] model.worldModel , score = model.score - 1 , battleHistory = recordLoss model.battleHistory , continueButton = Nothing } , Cmd.batch [ after 1000 ClearBattlefield ] ) else ( { model | story = getName hero_fighting model.worldModel ++ " is victorious! +1 HP" , worldModel = updateWorldModel [ hero_fighting ++ ".victorious" , monster_fighting ++ (if hasBonus "Charm of persistent insight" model then ".defeated.revealed" else ".defeated" ) ] model.worldModel , score = model.score + 1 , battleHistory = recordVictory model.battleHistory , continueButton = Nothing } , Cmd.batch [ after 1000 ClearBattlefield ] ) ) (getStat monster_fighting "level" model.worldModel) (getStat hero_fighting "level" model.worldModel) |> Maybe.withDefault ( { model | story = "error determining winner" }, Cmd.none ) -- shouldn't ever trigger other -> -- let -- x = -- Debug.log "unexpected match" other -- in ( { model | story = "Error in game loop!" }, Cmd.none ) ClearBattlefield -> ( { model | worldModel = model.worldModel |> updateWorldModel [ "(*.fighting.victorious).-fighting" ] |> updateWorldModel [ "(*.fighting.defeated).-fighting" ] } , after 1500 Tick ) AppealForBraveryContinue -> ( { model | continueButton = Nothing } , Cmd.batch [ after 1500 Tick, after 800 <| PlaySound "sfx/fight" ] ) HeroSelected heroId -> let worldModel = updateWorldModel [ heroId ++ ".fighting.-preview" ] model.worldModel in ( { model | worldModel = worldModel , chooseHero = False , story = getName heroId model.worldModel ++ " joins the fight." , continueButton = Nothing } , Cmd.batch [ after 1500 Tick, after 800 <| PlaySound "sfx/fight", playSound "sfx/select" ] ) HeroPreview Nothing -> let worldModel = updateWorldModel [ "(*.preview).-preview" ] model.worldModel in ( { model | worldModel = worldModel }, Cmd.none ) HeroPreview (Just id) -> let worldModel = updateWorldModel [ id ++ ".preview" ] model.worldModel in ( { model | worldModel = worldModel }, Cmd.none ) PlaySound key -> ( model, playSound key ) after : Float -> Msg -> Cmd Msg after ms msg = Task.perform (always msg) <| Process.sleep ms updateWorldModel : List String -> MyWorldModel -> MyWorldModel updateWorldModel queries worldModel = let parsedChanges = List.foldr (\q acc -> RuleParser.parseChanges q |> Result.map (\c -> c :: acc) |> Result.withDefault acc ) [] queries in applyChanges parsedChanges "no trigger" worldModel query : String -> MyWorldModel -> List ( WorldModel.ID, MyEntity ) query q worldModel = RuleParser.parseMatcher q |> Result.map (\parsedMatcher -> WorldModel.query parsedMatcher worldModel) |> Result.withDefault [] assert : String -> MyWorldModel -> Bool assert q worldModel = not <| List.isEmpty <| query q worldModel view : Model -> Html Msg view model = let heroes = query "*.hero.!fighting.!defeated.!victorious" model.worldModel monsters = query "*.monster.!fighting.!defeated" model.worldModel fightingHero = query "*.hero.fighting" model.worldModel previewHero = if model.chooseHero then query "*.hero.preview" model.worldModel else [] fightingMonster = query "*.monster.fighting" model.worldModel defeated = query "*.!fighting.defeated" model.worldModel victorious = query "*.!fighting.victorious" model.worldModel kindPlural id = if assert (id ++ ".hero") model.worldModel then "heroes" else "monsters" kind id = if assert (id ++ ".hero") model.worldModel then "hero" else "monster" level id = if assert (id ++ ".revealed") model.worldModel then getStat id "level" model.worldModel |> Maybe.map String.fromInt |> Maybe.withDefault "error" else "?" imageNum id = getStat id "image" model.worldModel |> Maybe.withDefault 1 |> String.fromInt characterList attrs = List.map (characterCard attrs) characterCard attrs ( id, { name } ) = div (attrs id ++ [ classList [ ( "character", True ) , ( "character-" ++ kind id, True ) , ( "character-preview", kind id == "hero" && not (List.isEmpty previewHero) ) , ( "defeated", assert (id ++ ".defeated") model.worldModel ) , ( "victorious", assert (id ++ ".victorious") model.worldModel ) ] ] ) [ div [ class "img" , style "background-image" ("url(images/" ++ kindPlural id ++ "/" ++ imageNum id ++ ".png)") ] [] , div [ class "title" ] [ text name ] , div [ class "level" ] [ text <| level id ] ] chooseBonus = model.bonusOptions |> List.take 2 |> List.map (\n -> Dict.get n bonuses |> Maybe.withDefault { name = "error", description = "finding bonus", selectFn = identity, useFn = identity } ) |> List.map (\{ name, description, selectFn } -> button [ class "pure-button button-primary", onClick (BonusSelected selectFn) ] [ h3 [] [ text name ] , p [] [ text description ] ] ) |> div [ class "pure-u-1 select-bonus" ] spells = model.spells |> List.map (\n -> Dict.get n bonuses |> Maybe.withDefault { name = "error", description = "finding bonus", selectFn = identity, useFn = identity } ) |> List.map (\{ name, useFn } -> button [ class "pure-button button-primary", onClick (UseSpell name useFn) ] [ text name ] ) |> div [ class "spells" ] firstOf = List.head >> Maybe.map (characterCard noHandlers) >> Maybe.withDefault (div [ class "hero-placeholder" ] []) isStartFight = -- works for both HeroSelected and AppealForBraveryContinue assert "*.hero.fighting" model.worldModel && model.continueButton == Nothing getHistory fn = previewHero |> List.head |> Maybe.andThen (\h -> Dict.get (Tuple.first h) model.battleHistory) |> Maybe.map (fn >> Set.toList >> List.map (\id -> query id model.worldModel) >> List.concat) |> Maybe.withDefault [] noHandlers = always [] heroHandlers id = [ onMouseEnter <| HeroPreview <| Just id , onMouseLeave <| HeroPreview Nothing ] ++ (if model.chooseHero then [ onClick <| HeroSelected id ] else [] ) conditionalView conds v = if List.all identity conds then v else text "" showEmpty l = if List.isEmpty l then [ text "--" ] else l in div [ class "game" ] -- [ NarrativeEngine.Debug.debugBar UpdateDebugSearchText model.worldModel model.debug [ div [ class "title-main-wrapper" ] [ h3 [ class "title-main" ] [ text "Deduction Quest" ] ] , div [ class "pure-g top" ] [ div [ class "pure-u-1-4 characters characters-heroes" , classList [ ( "select", model.chooseHero ) ] ] (characterList heroHandlers heroes) , div [ class "pure-u-1-2 " ] [ div [ class "pure-g battlefield", classList [ ( "start-fight", isStartFight ) ] ] [ conditionalView [ model.chooseBonus ] chooseBonus , conditionalView [ not model.chooseBonus ] <| div [ class "pure-u-1-2 fighting-zone" ] [ firstOf (previewHero ++ fightingHero) ] , conditionalView [ not model.chooseBonus ] <| div [ class "pure-u-1-2 fighting-zone" ] [ firstOf fightingMonster ] , conditionalView [ model.chooseHero , hasBonus "Relic of photographic memory" model , not <| List.isEmpty previewHero , not <| List.isEmpty <| getHistory .beat ++ getHistory .lost ] <| div [ class "pure-u battle-history" ] [ h3 [] [ text "Defeated:" ] , div [ class "history-characters" ] <| showEmpty <| characterList noHandlers (getHistory .beat) , h3 [] [ text "Lost to:" ] , div [ class "history-characters" ] <| showEmpty <| characterList noHandlers (getHistory .lost) ] ] , div [ class "story", classList [ ( "hide", String.isEmpty model.story ) ] ] [ Markdown.toHtml [] model.story , Maybe.map (\( prompt, msg ) -> button [ class "pure-button button-primary", onClick msg ] [ text prompt ]) model.continueButton |> Maybe.withDefault (text "") ] ] , div [ class "pure-u-1-4 characters characters-monsters" ] (characterList noHandlers monsters) ] , div [ class "bottom" ] [ div [ class "previous-battles" ] (characterList noHandlers (defeated ++ victorious)) , conditionalView [ model.chooseHero ] spells , div [ class "hp" ] [ text <| "HP " ++ String.fromInt model.score ] ] ] main : Program () Model Msg main = Browser.document { init = \f -> initialModel , view = \model -> case model.parseErrors of Just errors -> { title = "Parse Errors" , body = [ SyntaxHelpers.parseErrorsView errors ] } Nothing -> { title = "Deduction Quest" , body = [ view model ] } , update = update , subscriptions = subscriptions }
elm
[ { "context": "le validation test suite here](https://github.com/etaque/elm-form/tree/master/tests).\n\n@docs describeValid", "end": 171, "score": 0.9996916056, "start": 165, "tag": "USERNAME", "value": "etaque" }, { "context": "on \"email\"\n Form.Validate.email\n [ ( \"valid@email.com\", Valid )\n , ( \"This is definitely not an e", "end": 787, "score": 0.9999181628, "start": 772, "tag": "EMAIL", "value": "valid@email.com" }, { "context": "lidate\n\n testValidation Form.Validate.email ( \"valid@email.com\", Valid )\n\n-}\ntestValidation : Validate.Validatio", "end": 1495, "score": 0.9999184608, "start": 1480, "tag": "EMAIL", "value": "valid@email.com" } ]
src/Form/Test.elm
teatimes/elm-form
131
module Form.Test exposing (describeValidation, testValidation) {-| Helpers to test your validations. See [an example validation test suite here](https://github.com/etaque/elm-form/tree/master/tests). @docs describeValidation, testValidation -} import Form.Test.Helpers as TestHelpers import Form.Test.ValidationExpectation exposing (ValidationExpectation(..)) import Form.Validate as Validate exposing (Validation) import Test exposing (..) {-| Test your `Validation`s with a List of test input String, ValidationExpectation pairs. import Form.Error import Form.Test exposing (..) import Form.Test.ValidationExpectation exposing (ValidationExpectation(..)) import Form.Validate describeValidation "email" Form.Validate.email [ ( "valid@email.com", Valid ) , ( "This is definitely not an email address" , Invalid Form.Error.InvalidEmail ) ] -} describeValidation : String -> Validate.Validation e a -> List ( String, ValidationExpectation e a ) -> Test describeValidation description validation cases = let testCases = List.map (testValidation validation) cases in describe (description ++ " validations") testCases {-| Create a single test case for a `Validation`. import Form.Error import Form.Test exposing (..) import Form.Test.ValidationExpectation exposing (ValidationExpectation(..)) import Form.Validate testValidation Form.Validate.email ( "valid@email.com", Valid ) -} testValidation : Validate.Validation e a -> ( String, ValidationExpectation e a ) -> Test testValidation validation (( stringToValidate, validationExpectation ) as validationCase) = let shallowExpectationString = case validationExpectation of Valid -> "Valid" ValidDecodesTo a -> "ValidDecodesTo" Invalid _ -> "Invalid " InvalidCustomError _ -> "InvalidCustomError" in Test.test ("expect " ++ shallowExpectationString ++ "with input '" ++ stringToValidate ++ "'") <| \() -> TestHelpers.getValidationExpectation validation validationCase
41844
module Form.Test exposing (describeValidation, testValidation) {-| Helpers to test your validations. See [an example validation test suite here](https://github.com/etaque/elm-form/tree/master/tests). @docs describeValidation, testValidation -} import Form.Test.Helpers as TestHelpers import Form.Test.ValidationExpectation exposing (ValidationExpectation(..)) import Form.Validate as Validate exposing (Validation) import Test exposing (..) {-| Test your `Validation`s with a List of test input String, ValidationExpectation pairs. import Form.Error import Form.Test exposing (..) import Form.Test.ValidationExpectation exposing (ValidationExpectation(..)) import Form.Validate describeValidation "email" Form.Validate.email [ ( "<EMAIL>", Valid ) , ( "This is definitely not an email address" , Invalid Form.Error.InvalidEmail ) ] -} describeValidation : String -> Validate.Validation e a -> List ( String, ValidationExpectation e a ) -> Test describeValidation description validation cases = let testCases = List.map (testValidation validation) cases in describe (description ++ " validations") testCases {-| Create a single test case for a `Validation`. import Form.Error import Form.Test exposing (..) import Form.Test.ValidationExpectation exposing (ValidationExpectation(..)) import Form.Validate testValidation Form.Validate.email ( "<EMAIL>", Valid ) -} testValidation : Validate.Validation e a -> ( String, ValidationExpectation e a ) -> Test testValidation validation (( stringToValidate, validationExpectation ) as validationCase) = let shallowExpectationString = case validationExpectation of Valid -> "Valid" ValidDecodesTo a -> "ValidDecodesTo" Invalid _ -> "Invalid " InvalidCustomError _ -> "InvalidCustomError" in Test.test ("expect " ++ shallowExpectationString ++ "with input '" ++ stringToValidate ++ "'") <| \() -> TestHelpers.getValidationExpectation validation validationCase
true
module Form.Test exposing (describeValidation, testValidation) {-| Helpers to test your validations. See [an example validation test suite here](https://github.com/etaque/elm-form/tree/master/tests). @docs describeValidation, testValidation -} import Form.Test.Helpers as TestHelpers import Form.Test.ValidationExpectation exposing (ValidationExpectation(..)) import Form.Validate as Validate exposing (Validation) import Test exposing (..) {-| Test your `Validation`s with a List of test input String, ValidationExpectation pairs. import Form.Error import Form.Test exposing (..) import Form.Test.ValidationExpectation exposing (ValidationExpectation(..)) import Form.Validate describeValidation "email" Form.Validate.email [ ( "PI:EMAIL:<EMAIL>END_PI", Valid ) , ( "This is definitely not an email address" , Invalid Form.Error.InvalidEmail ) ] -} describeValidation : String -> Validate.Validation e a -> List ( String, ValidationExpectation e a ) -> Test describeValidation description validation cases = let testCases = List.map (testValidation validation) cases in describe (description ++ " validations") testCases {-| Create a single test case for a `Validation`. import Form.Error import Form.Test exposing (..) import Form.Test.ValidationExpectation exposing (ValidationExpectation(..)) import Form.Validate testValidation Form.Validate.email ( "PI:EMAIL:<EMAIL>END_PI", Valid ) -} testValidation : Validate.Validation e a -> ( String, ValidationExpectation e a ) -> Test testValidation validation (( stringToValidate, validationExpectation ) as validationCase) = let shallowExpectationString = case validationExpectation of Valid -> "Valid" ValidDecodesTo a -> "ValidDecodesTo" Invalid _ -> "Invalid " InvalidCustomError _ -> "InvalidCustomError" in Test.test ("expect " ++ shallowExpectationString ++ "with input '" ++ stringToValidate ++ "'") <| \() -> TestHelpers.getValidationExpectation validation validationCase
elm
[ { "context": "{-\nCopyright 2020 Morgan Stanley\n\nLicensed under the Apache License, Version 2.0 (", "end": 32, "score": 0.9998158216, "start": 18, "tag": "NAME", "value": "Morgan Stanley" } ]
src/Morphir/Sample/LCR/Inflows.elm
maoo/morphir-examples
0
{- Copyright 2020 Morgan Stanley Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -} module Morphir.Sample.LCR.Inflows exposing (..) import Morphir.SDK.Basics exposing (Decimal) import Date exposing (Date, Interval(..), Unit(..)) import Morphir.Sample.LCR.Basics exposing (..) import Morphir.Sample.LCR.Flows exposing (..) import Morphir.Sample.LCR.Counterparty exposing (..) import Morphir.Sample.LCR.Rules exposing (..) import Morphir.Sample.LCR.MaturityBucket exposing (..) {-| The list of all rules pertaining to inflows. -} inflowRules : (Flow -> Counterparty) -> Date -> List (Rule Flow) inflowRules toCounterparty t = [ Rule "20(a)(1)" 1.0 (isRule20a1 t) , Rule "20(a)(3)-(6)" 1.0 isRule20a3dash6 , Rule "22(b)(3)L1" -1.0 isRule22b3L2a , Rule "22(b)(3)L2a" -0.85 isRule22b3L2a , Rule "22(b)(3)L2b" -0.5 isRule22b3L2b , Rule "20(b)" 0.85 isRule20b , Rule "20(c)" 0.5 isRule20c , Rule "33(b)" 1.0 isRule33b , Rule "33(c)" 0.5 (isRule33c toCounterparty t) , Rule "33(d)(1)" 1.0 (isRule33d1 toCounterparty) , Rule "33(d)(2)" 1.0 (isRule33d2 toCounterparty) , Rule "33(e)" 1.0 isRule33e , Rule "33(g)" 1.0 isRule33g , Rule "33(h)" 0.0 isRule33h ] -- Rule logic is below for (eventual) unit testability isRule20a1 : Date -> Flow -> Bool isRule20a1 t flow = List.member flow.fed5GCode ["I.A.3.1", "I.A.3.2", "I.A.3.3", "I.A.3.4", "I.A.3.5", "I.A.3.6", "I.A.3.7", "I.A.3.8"] && daysToMaturity t flow.maturityDate == 0 isRule20a3dash6 : Flow -> Bool isRule20a3dash6 flow = ( List.member flow.fed5GCode ["I.A.1", "I.A.2"] && flow.collateralClass == Level1Assets && flow.isTreasuryControl ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4"] && flow.collateralClass == Level1Assets && flow.isTreasuryControl && flow.isUnencumbered ) isRule22b3L2a flow = flow.fed5GCode == "S.I.19" && flow.collateralClass == Level2aAssets isRule22b3L2b flow = flow.fed5GCode == "S.I.19" && flow.collateralClass == Level2bAssets isRule20b flow = ( List.member flow.fed5GCode ["I.A.1", "I.A.2"] && flow.collateralClass == Level2aAssets && flow.isTreasuryControl ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4"] && flow.collateralClass == Level2aAssets && flow.isTreasuryControl && flow.isUnencumbered ) isRule20c flow = ( List.member flow.fed5GCode ["I.A.1", "I.A.2"] && flow.collateralClass == Level2bAssets && flow.isTreasuryControl ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4"] && flow.collateralClass == Level2bAssets && flow.isTreasuryControl && flow.isUnencumbered ) isRule33b cashflow = cashflow.fed5GCode == "1.O.7" isRule33c toCounterparty t flow = let cpty = toCounterparty flow days = daysToMaturity t flow.maturityDate in ( List.member flow.fed5GCode ["I.U.5", "I.U.6"] && List.member cpty.counterpartyType [ Retail, SmallBusiness ] && (0 < days && days <= 30) ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4", "I.S.5", "I.S.6", "I.S.7"] && cpty.counterpartyType == Retail && (0 < days && days <= 30) ) isRule33d1 toCounterparty flow = let cpty = toCounterparty flow in List.member flow.fed5GCode ["I.U.1", "I.U.2", "I.U.4"] || ( List.member flow.fed5GCode ["I.U.5", "I.U.6"] && List.member cpty.counterpartyType [ CentralBank , Bank , SupervisedNonBankFinancialEntity , DebtIssuingSpecialPurposeEntity , OtherFinancialEntity ] ) isRule33d2 toCounterparty flow = let cpty = toCounterparty flow in List.member flow.fed5GCode ["I.U.5", "I.U.6"] && List.member cpty.counterpartyType [ NonFinancialCorporate , Sovereign , GovernmentSponsoredEntity , PublicSectorEntity , MultilateralDevelopmentBank , OtherSupranational , Other ] isRule33e cashflow = cashflow.fed5GCode == "I.O.6" || cashflow.fed5GCode == "I.O.8" isRule33f flow = Debug.todo "Rule 33(f) is actually a bunch of rules. Too many to do for now..." isRule33g cashflow = cashflow.fed5GCode == "I.O.5" && cashflow.isTreasuryControl isRule33h cashflow = cashflow.fed5GCode == "I.O.9" && cashflow.isTreasuryControl
3612
{- Copyright 2020 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -} module Morphir.Sample.LCR.Inflows exposing (..) import Morphir.SDK.Basics exposing (Decimal) import Date exposing (Date, Interval(..), Unit(..)) import Morphir.Sample.LCR.Basics exposing (..) import Morphir.Sample.LCR.Flows exposing (..) import Morphir.Sample.LCR.Counterparty exposing (..) import Morphir.Sample.LCR.Rules exposing (..) import Morphir.Sample.LCR.MaturityBucket exposing (..) {-| The list of all rules pertaining to inflows. -} inflowRules : (Flow -> Counterparty) -> Date -> List (Rule Flow) inflowRules toCounterparty t = [ Rule "20(a)(1)" 1.0 (isRule20a1 t) , Rule "20(a)(3)-(6)" 1.0 isRule20a3dash6 , Rule "22(b)(3)L1" -1.0 isRule22b3L2a , Rule "22(b)(3)L2a" -0.85 isRule22b3L2a , Rule "22(b)(3)L2b" -0.5 isRule22b3L2b , Rule "20(b)" 0.85 isRule20b , Rule "20(c)" 0.5 isRule20c , Rule "33(b)" 1.0 isRule33b , Rule "33(c)" 0.5 (isRule33c toCounterparty t) , Rule "33(d)(1)" 1.0 (isRule33d1 toCounterparty) , Rule "33(d)(2)" 1.0 (isRule33d2 toCounterparty) , Rule "33(e)" 1.0 isRule33e , Rule "33(g)" 1.0 isRule33g , Rule "33(h)" 0.0 isRule33h ] -- Rule logic is below for (eventual) unit testability isRule20a1 : Date -> Flow -> Bool isRule20a1 t flow = List.member flow.fed5GCode ["I.A.3.1", "I.A.3.2", "I.A.3.3", "I.A.3.4", "I.A.3.5", "I.A.3.6", "I.A.3.7", "I.A.3.8"] && daysToMaturity t flow.maturityDate == 0 isRule20a3dash6 : Flow -> Bool isRule20a3dash6 flow = ( List.member flow.fed5GCode ["I.A.1", "I.A.2"] && flow.collateralClass == Level1Assets && flow.isTreasuryControl ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4"] && flow.collateralClass == Level1Assets && flow.isTreasuryControl && flow.isUnencumbered ) isRule22b3L2a flow = flow.fed5GCode == "S.I.19" && flow.collateralClass == Level2aAssets isRule22b3L2b flow = flow.fed5GCode == "S.I.19" && flow.collateralClass == Level2bAssets isRule20b flow = ( List.member flow.fed5GCode ["I.A.1", "I.A.2"] && flow.collateralClass == Level2aAssets && flow.isTreasuryControl ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4"] && flow.collateralClass == Level2aAssets && flow.isTreasuryControl && flow.isUnencumbered ) isRule20c flow = ( List.member flow.fed5GCode ["I.A.1", "I.A.2"] && flow.collateralClass == Level2bAssets && flow.isTreasuryControl ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4"] && flow.collateralClass == Level2bAssets && flow.isTreasuryControl && flow.isUnencumbered ) isRule33b cashflow = cashflow.fed5GCode == "1.O.7" isRule33c toCounterparty t flow = let cpty = toCounterparty flow days = daysToMaturity t flow.maturityDate in ( List.member flow.fed5GCode ["I.U.5", "I.U.6"] && List.member cpty.counterpartyType [ Retail, SmallBusiness ] && (0 < days && days <= 30) ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4", "I.S.5", "I.S.6", "I.S.7"] && cpty.counterpartyType == Retail && (0 < days && days <= 30) ) isRule33d1 toCounterparty flow = let cpty = toCounterparty flow in List.member flow.fed5GCode ["I.U.1", "I.U.2", "I.U.4"] || ( List.member flow.fed5GCode ["I.U.5", "I.U.6"] && List.member cpty.counterpartyType [ CentralBank , Bank , SupervisedNonBankFinancialEntity , DebtIssuingSpecialPurposeEntity , OtherFinancialEntity ] ) isRule33d2 toCounterparty flow = let cpty = toCounterparty flow in List.member flow.fed5GCode ["I.U.5", "I.U.6"] && List.member cpty.counterpartyType [ NonFinancialCorporate , Sovereign , GovernmentSponsoredEntity , PublicSectorEntity , MultilateralDevelopmentBank , OtherSupranational , Other ] isRule33e cashflow = cashflow.fed5GCode == "I.O.6" || cashflow.fed5GCode == "I.O.8" isRule33f flow = Debug.todo "Rule 33(f) is actually a bunch of rules. Too many to do for now..." isRule33g cashflow = cashflow.fed5GCode == "I.O.5" && cashflow.isTreasuryControl isRule33h cashflow = cashflow.fed5GCode == "I.O.9" && cashflow.isTreasuryControl
true
{- Copyright 2020 PI:NAME:<NAME>END_PI Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -} module Morphir.Sample.LCR.Inflows exposing (..) import Morphir.SDK.Basics exposing (Decimal) import Date exposing (Date, Interval(..), Unit(..)) import Morphir.Sample.LCR.Basics exposing (..) import Morphir.Sample.LCR.Flows exposing (..) import Morphir.Sample.LCR.Counterparty exposing (..) import Morphir.Sample.LCR.Rules exposing (..) import Morphir.Sample.LCR.MaturityBucket exposing (..) {-| The list of all rules pertaining to inflows. -} inflowRules : (Flow -> Counterparty) -> Date -> List (Rule Flow) inflowRules toCounterparty t = [ Rule "20(a)(1)" 1.0 (isRule20a1 t) , Rule "20(a)(3)-(6)" 1.0 isRule20a3dash6 , Rule "22(b)(3)L1" -1.0 isRule22b3L2a , Rule "22(b)(3)L2a" -0.85 isRule22b3L2a , Rule "22(b)(3)L2b" -0.5 isRule22b3L2b , Rule "20(b)" 0.85 isRule20b , Rule "20(c)" 0.5 isRule20c , Rule "33(b)" 1.0 isRule33b , Rule "33(c)" 0.5 (isRule33c toCounterparty t) , Rule "33(d)(1)" 1.0 (isRule33d1 toCounterparty) , Rule "33(d)(2)" 1.0 (isRule33d2 toCounterparty) , Rule "33(e)" 1.0 isRule33e , Rule "33(g)" 1.0 isRule33g , Rule "33(h)" 0.0 isRule33h ] -- Rule logic is below for (eventual) unit testability isRule20a1 : Date -> Flow -> Bool isRule20a1 t flow = List.member flow.fed5GCode ["I.A.3.1", "I.A.3.2", "I.A.3.3", "I.A.3.4", "I.A.3.5", "I.A.3.6", "I.A.3.7", "I.A.3.8"] && daysToMaturity t flow.maturityDate == 0 isRule20a3dash6 : Flow -> Bool isRule20a3dash6 flow = ( List.member flow.fed5GCode ["I.A.1", "I.A.2"] && flow.collateralClass == Level1Assets && flow.isTreasuryControl ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4"] && flow.collateralClass == Level1Assets && flow.isTreasuryControl && flow.isUnencumbered ) isRule22b3L2a flow = flow.fed5GCode == "S.I.19" && flow.collateralClass == Level2aAssets isRule22b3L2b flow = flow.fed5GCode == "S.I.19" && flow.collateralClass == Level2bAssets isRule20b flow = ( List.member flow.fed5GCode ["I.A.1", "I.A.2"] && flow.collateralClass == Level2aAssets && flow.isTreasuryControl ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4"] && flow.collateralClass == Level2aAssets && flow.isTreasuryControl && flow.isUnencumbered ) isRule20c flow = ( List.member flow.fed5GCode ["I.A.1", "I.A.2"] && flow.collateralClass == Level2bAssets && flow.isTreasuryControl ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4"] && flow.collateralClass == Level2bAssets && flow.isTreasuryControl && flow.isUnencumbered ) isRule33b cashflow = cashflow.fed5GCode == "1.O.7" isRule33c toCounterparty t flow = let cpty = toCounterparty flow days = daysToMaturity t flow.maturityDate in ( List.member flow.fed5GCode ["I.U.5", "I.U.6"] && List.member cpty.counterpartyType [ Retail, SmallBusiness ] && (0 < days && days <= 30) ) || ( List.member flow.fed5GCode ["I.S.1", "I.S.2", "I.S.4", "I.S.5", "I.S.6", "I.S.7"] && cpty.counterpartyType == Retail && (0 < days && days <= 30) ) isRule33d1 toCounterparty flow = let cpty = toCounterparty flow in List.member flow.fed5GCode ["I.U.1", "I.U.2", "I.U.4"] || ( List.member flow.fed5GCode ["I.U.5", "I.U.6"] && List.member cpty.counterpartyType [ CentralBank , Bank , SupervisedNonBankFinancialEntity , DebtIssuingSpecialPurposeEntity , OtherFinancialEntity ] ) isRule33d2 toCounterparty flow = let cpty = toCounterparty flow in List.member flow.fed5GCode ["I.U.5", "I.U.6"] && List.member cpty.counterpartyType [ NonFinancialCorporate , Sovereign , GovernmentSponsoredEntity , PublicSectorEntity , MultilateralDevelopmentBank , OtherSupranational , Other ] isRule33e cashflow = cashflow.fed5GCode == "I.O.6" || cashflow.fed5GCode == "I.O.8" isRule33f flow = Debug.todo "Rule 33(f) is actually a bunch of rules. Too many to do for now..." isRule33g cashflow = cashflow.fed5GCode == "I.O.5" && cashflow.isTreasuryControl isRule33h cashflow = cashflow.fed5GCode == "I.O.9" && cashflow.isTreasuryControl
elm
[ { "context": "\"Accepted!\")\n\n-- === RECORDS ===\n\nbill = {name = \"Gates\", age = 62}\n\nbill.name -- -> \"Gates\"\n.name bill -", "end": 330, "score": 0.9994863868, "start": 325, "tag": "NAME", "value": "Gates" }, { "context": "ll = {name = \"Gates\", age = 62}\n\nbill.name -- -> \"Gates\"\n.name bill -- -> \"Gates\"\n\nunder70 {age} = age < ", "end": 366, "score": 0.9992078543, "start": 361, "tag": "NAME", "value": "Gates" }, { "context": " = 62}\n\nbill.name -- -> \"Gates\"\n.name bill -- -> \"Gates\"\n\nunder70 {age} = age < 70\nunder70 bill -- -> Tru", "end": 391, "score": 0.9993405342, "start": 386, "tag": "NAME", "value": "Gates" }, { "context": "ps\", age = 68000000} -- -> False\n\n{bill | name = \"Nye\"} -- -> {age = 62, name = \"Nye\"}\n{bill | age = 22", "end": 525, "score": 0.9987411499, "start": 522, "tag": "NAME", "value": "Nye" }, { "context": "e\n\n{bill | name = \"Nye\"} -- -> {age = 62, name = \"Nye\"}\n{bill | age = 22} -- -> {age = 22, name = \"Gate", "end": 556, "score": 0.9979109168, "start": 553, "tag": "NAME", "value": "Nye" }, { "context": "\"Nye\"}\n{bill | age = 22} -- -> {age = 22, name = \"Gates\"}", "end": 607, "score": 0.9989640713, "start": 602, "tag": "NAME", "value": "Gates" } ]
Technology/Software/ProgrammingLanguage/Elm/DataStructures/DataStructures.elm
MislavJaksic/Knowledge-Repository
3
-- === LISTS === numbers = [1,4,3,2] List.isEmpty numbers -- -> False List.length numbers -- -> 4 List.reverse numbers -- -> [2,3,4,1] List.sort numbers -- -> [1,2,3,4] List.map double numbers -- -> [2,8,6,4] -- === TUPLES === -- Consider using records instead. (True, "Accepted!") -- === RECORDS === bill = {name = "Gates", age = 62} bill.name -- -> "Gates" .name bill -- -> "Gates" under70 {age} = age < 70 under70 bill -- -> True under70 {species = "Triceratops", age = 68000000} -- -> False {bill | name = "Nye"} -- -> {age = 62, name = "Nye"} {bill | age = 22} -- -> {age = 22, name = "Gates"}
7600
-- === LISTS === numbers = [1,4,3,2] List.isEmpty numbers -- -> False List.length numbers -- -> 4 List.reverse numbers -- -> [2,3,4,1] List.sort numbers -- -> [1,2,3,4] List.map double numbers -- -> [2,8,6,4] -- === TUPLES === -- Consider using records instead. (True, "Accepted!") -- === RECORDS === bill = {name = "<NAME>", age = 62} bill.name -- -> "<NAME>" .name bill -- -> "<NAME>" under70 {age} = age < 70 under70 bill -- -> True under70 {species = "Triceratops", age = 68000000} -- -> False {bill | name = "<NAME>"} -- -> {age = 62, name = "<NAME>"} {bill | age = 22} -- -> {age = 22, name = "<NAME>"}
true
-- === LISTS === numbers = [1,4,3,2] List.isEmpty numbers -- -> False List.length numbers -- -> 4 List.reverse numbers -- -> [2,3,4,1] List.sort numbers -- -> [1,2,3,4] List.map double numbers -- -> [2,8,6,4] -- === TUPLES === -- Consider using records instead. (True, "Accepted!") -- === RECORDS === bill = {name = "PI:NAME:<NAME>END_PI", age = 62} bill.name -- -> "PI:NAME:<NAME>END_PI" .name bill -- -> "PI:NAME:<NAME>END_PI" under70 {age} = age < 70 under70 bill -- -> True under70 {species = "Triceratops", age = 68000000} -- -> False {bill | name = "PI:NAME:<NAME>END_PI"} -- -> {age = 62, name = "PI:NAME:<NAME>END_PI"} {bill | age = 22} -- -> {age = 22, name = "PI:NAME:<NAME>END_PI"}
elm
[ { "context": "Pretty-printing Tables\nName | Year of birth\n--|-:\nTom Hanks | 1956\nPhilipp | 1997\nJesus | -4\nCaesar | -100\n\nA", "end": 715, "score": 0.9998268485, "start": 706, "tag": "NAME", "value": "Tom Hanks" }, { "context": "ables\nName | Year of birth\n--|-:\nTom Hanks | 1956\nPhilipp | 1997\nJesus | -4\nCaesar | -100\n\nAppliance | Cost", "end": 730, "score": 0.9989435673, "start": 723, "tag": "NAME", "value": "Philipp" }, { "context": "ar of birth\n--|-:\nTom Hanks | 1956\nPhilipp | 1997\nJesus | -4\nCaesar | -100\n\nAppliance | Cost | Own\n:-:|-:", "end": 743, "score": 0.867685616, "start": 738, "tag": "NAME", "value": "Jesus" }, { "context": "00\n , githubUrl = Just \"https://github.com/matheus23/elm-markdown-transforms/blob/master/examples/src/", "end": 3120, "score": 0.9995439649, "start": 3111, "tag": "USERNAME", "value": "matheus23" }, { "context": "Url = Just \"https://package.elm-lang.org/packages/matheus23/elm-markdown-transforms/latest\"\n }\n ", "end": 3272, "score": 0.9964334369, "start": 3263, "tag": "USERNAME", "value": "matheus23" } ]
examples/src/FormatTables.elm
elm-review-bot/elm-markdown-transforms
6
module FormatTables exposing (main) import BeautifulExample import Browser exposing (Document) import Color import Html exposing (Html) import Html.Attributes as Attr import Html.Events as Events import List.Extra as List import Markdown.Block as Markdown import Markdown.Html import Markdown.Parser as Markdown import Markdown.PrettyTables as Tables import Markdown.Renderer as Markdown import Markdown.Scaffolded as Scaffolded import Result.Extra as Result type alias Model = { markdown : String , parsed : Result String (List Markdown.Block) } type Msg = MarkdownChanged String exampleMarkdown : String exampleMarkdown = """# Pretty-printing Tables Name | Year of birth --|-: Tom Hanks | 1956 Philipp | 1997 Jesus | -4 Caesar | -100 Appliance | Cost | Own :-:|-:|:- Dishwasher | 500€ | Yes Toaster | 40€ | No Refrigerator | 600€ | Yes Washing Machine | 1200€ | Yes """ view : Model -> Document Msg view model = { title = "Format Markdown Tables" , body = List.concat [ [ Html.h2 [] [ Html.text "This Markdown Document:" ] , Html.textarea [ Attr.style "height" "400px" , Attr.style "min-width" "100%" , Attr.style "max-width" "100%" , Attr.style "font-family" "monospace" , Attr.value model.markdown , Events.onInput MarkdownChanged ] [] ] , model.parsed |> Result.andThen (Markdown.render customHtmlRenderer) |> Result.map Tables.finishReduction |> Result.unpack viewError viewMarkdown ] } viewMarkdown : String -> List (Html Msg) viewMarkdown markdown = [ Html.h2 [] [ Html.text "Prettyprinted:" ] , Html.hr [] [] , Html.pre [ Attr.style "white-space" "pre-wrap" ] [ Html.text markdown ] ] viewError : String -> List (Html Msg) viewError errorMessage = [ Html.pre [ Attr.style "white-space" "pre-wrap" ] [ Html.text errorMessage ] ] -- FORMATTING customHtmlRenderer : Markdown.Renderer (Int -> Tables.TableInfo String) customHtmlRenderer = Scaffolded.toRenderer { renderHtml = Markdown.Html.oneOf [] , renderMarkdown = Tables.reducePrettyTable Tables.defaultStyle } -- UPDATE update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of MarkdownChanged newMarkdown -> ( { model | markdown = newMarkdown , parsed = newMarkdown |> Markdown.parse |> Result.mapError (List.map Markdown.deadEndToString >> String.join "\n") } , Cmd.none ) -- MAIN main : Platform.Program () Model Msg main = BeautifulExample.document { title = "Format markdown by printing it back to text." , details = Nothing , color = Just (Color.rgb255 69 133 136) , maxWidth = 800 , githubUrl = Just "https://github.com/matheus23/elm-markdown-transforms/blob/master/examples/src/FormatMarkdown.elm" , documentationUrl = Just "https://package.elm-lang.org/packages/matheus23/elm-markdown-transforms/latest" } { init = \() -> update (MarkdownChanged exampleMarkdown) { markdown = "" , parsed = Err "This should be impossible. Report a bug if you see this." } , view = view , update = update , subscriptions = always Sub.none }
51473
module FormatTables exposing (main) import BeautifulExample import Browser exposing (Document) import Color import Html exposing (Html) import Html.Attributes as Attr import Html.Events as Events import List.Extra as List import Markdown.Block as Markdown import Markdown.Html import Markdown.Parser as Markdown import Markdown.PrettyTables as Tables import Markdown.Renderer as Markdown import Markdown.Scaffolded as Scaffolded import Result.Extra as Result type alias Model = { markdown : String , parsed : Result String (List Markdown.Block) } type Msg = MarkdownChanged String exampleMarkdown : String exampleMarkdown = """# Pretty-printing Tables Name | Year of birth --|-: <NAME> | 1956 <NAME> | 1997 <NAME> | -4 Caesar | -100 Appliance | Cost | Own :-:|-:|:- Dishwasher | 500€ | Yes Toaster | 40€ | No Refrigerator | 600€ | Yes Washing Machine | 1200€ | Yes """ view : Model -> Document Msg view model = { title = "Format Markdown Tables" , body = List.concat [ [ Html.h2 [] [ Html.text "This Markdown Document:" ] , Html.textarea [ Attr.style "height" "400px" , Attr.style "min-width" "100%" , Attr.style "max-width" "100%" , Attr.style "font-family" "monospace" , Attr.value model.markdown , Events.onInput MarkdownChanged ] [] ] , model.parsed |> Result.andThen (Markdown.render customHtmlRenderer) |> Result.map Tables.finishReduction |> Result.unpack viewError viewMarkdown ] } viewMarkdown : String -> List (Html Msg) viewMarkdown markdown = [ Html.h2 [] [ Html.text "Prettyprinted:" ] , Html.hr [] [] , Html.pre [ Attr.style "white-space" "pre-wrap" ] [ Html.text markdown ] ] viewError : String -> List (Html Msg) viewError errorMessage = [ Html.pre [ Attr.style "white-space" "pre-wrap" ] [ Html.text errorMessage ] ] -- FORMATTING customHtmlRenderer : Markdown.Renderer (Int -> Tables.TableInfo String) customHtmlRenderer = Scaffolded.toRenderer { renderHtml = Markdown.Html.oneOf [] , renderMarkdown = Tables.reducePrettyTable Tables.defaultStyle } -- UPDATE update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of MarkdownChanged newMarkdown -> ( { model | markdown = newMarkdown , parsed = newMarkdown |> Markdown.parse |> Result.mapError (List.map Markdown.deadEndToString >> String.join "\n") } , Cmd.none ) -- MAIN main : Platform.Program () Model Msg main = BeautifulExample.document { title = "Format markdown by printing it back to text." , details = Nothing , color = Just (Color.rgb255 69 133 136) , maxWidth = 800 , githubUrl = Just "https://github.com/matheus23/elm-markdown-transforms/blob/master/examples/src/FormatMarkdown.elm" , documentationUrl = Just "https://package.elm-lang.org/packages/matheus23/elm-markdown-transforms/latest" } { init = \() -> update (MarkdownChanged exampleMarkdown) { markdown = "" , parsed = Err "This should be impossible. Report a bug if you see this." } , view = view , update = update , subscriptions = always Sub.none }
true
module FormatTables exposing (main) import BeautifulExample import Browser exposing (Document) import Color import Html exposing (Html) import Html.Attributes as Attr import Html.Events as Events import List.Extra as List import Markdown.Block as Markdown import Markdown.Html import Markdown.Parser as Markdown import Markdown.PrettyTables as Tables import Markdown.Renderer as Markdown import Markdown.Scaffolded as Scaffolded import Result.Extra as Result type alias Model = { markdown : String , parsed : Result String (List Markdown.Block) } type Msg = MarkdownChanged String exampleMarkdown : String exampleMarkdown = """# Pretty-printing Tables Name | Year of birth --|-: PI:NAME:<NAME>END_PI | 1956 PI:NAME:<NAME>END_PI | 1997 PI:NAME:<NAME>END_PI | -4 Caesar | -100 Appliance | Cost | Own :-:|-:|:- Dishwasher | 500€ | Yes Toaster | 40€ | No Refrigerator | 600€ | Yes Washing Machine | 1200€ | Yes """ view : Model -> Document Msg view model = { title = "Format Markdown Tables" , body = List.concat [ [ Html.h2 [] [ Html.text "This Markdown Document:" ] , Html.textarea [ Attr.style "height" "400px" , Attr.style "min-width" "100%" , Attr.style "max-width" "100%" , Attr.style "font-family" "monospace" , Attr.value model.markdown , Events.onInput MarkdownChanged ] [] ] , model.parsed |> Result.andThen (Markdown.render customHtmlRenderer) |> Result.map Tables.finishReduction |> Result.unpack viewError viewMarkdown ] } viewMarkdown : String -> List (Html Msg) viewMarkdown markdown = [ Html.h2 [] [ Html.text "Prettyprinted:" ] , Html.hr [] [] , Html.pre [ Attr.style "white-space" "pre-wrap" ] [ Html.text markdown ] ] viewError : String -> List (Html Msg) viewError errorMessage = [ Html.pre [ Attr.style "white-space" "pre-wrap" ] [ Html.text errorMessage ] ] -- FORMATTING customHtmlRenderer : Markdown.Renderer (Int -> Tables.TableInfo String) customHtmlRenderer = Scaffolded.toRenderer { renderHtml = Markdown.Html.oneOf [] , renderMarkdown = Tables.reducePrettyTable Tables.defaultStyle } -- UPDATE update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of MarkdownChanged newMarkdown -> ( { model | markdown = newMarkdown , parsed = newMarkdown |> Markdown.parse |> Result.mapError (List.map Markdown.deadEndToString >> String.join "\n") } , Cmd.none ) -- MAIN main : Platform.Program () Model Msg main = BeautifulExample.document { title = "Format markdown by printing it back to text." , details = Nothing , color = Just (Color.rgb255 69 133 136) , maxWidth = 800 , githubUrl = Just "https://github.com/matheus23/elm-markdown-transforms/blob/master/examples/src/FormatMarkdown.elm" , documentationUrl = Just "https://package.elm-lang.org/packages/matheus23/elm-markdown-transforms/latest" } { init = \() -> update (MarkdownChanged exampleMarkdown) { markdown = "" , parsed = Err "This should be impossible. Report a bug if you see this." } , view = view , update = update , subscriptions = always Sub.none }
elm
[ { "context": "olumnDisplayProperties\nnameColumn =\n { name = \"Column Name\"\n , viewData = \\c -> Grid.HtmlDetails [ c", "end": 29646, "score": 0.8859851956, "start": 29640, "tag": "NAME", "value": "Column" } ]
src/View/ColumnMetadataEditor.elm
Nexosis/dashboard
29
module View.ColumnMetadataEditor exposing (ExternalMsg(..), Model, Msg, init, subscriptions, update, updateDataSetResponse, view, viewTargetAndKeyColumns) import Autocomplete import Char import Data.Columns as Columns exposing (enumDataType, enumRole) import Data.Context exposing (ContextModel, contextToAuth, setPageSize) import Data.ImputationStrategy exposing (enumImputationStrategy) import Dict exposing (Dict) import Dict.Extra as Dict import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onFocus, onInput) import Http import Json.Decode as Decode import Nexosis.Api.Data import Nexosis.Types.Columns as Columns exposing (ColumnMetadata, ColumnStats, ColumnStatsDict, DataType(..), Role(..)) import Nexosis.Types.DataSet as DataSet exposing (DataSetData, DataSetName, DataSetStats, toDataSetName) import Nexosis.Types.ImputationStrategy exposing (ImputationStrategy(..)) import Nexosis.Types.SortParameters exposing (SortDirection(..), SortParameters) import Ports import RemoteData as Remote import Request.Log exposing (logHttpError) import SelectWithStyle as UnionSelect import StateStorage exposing (saveAppState) import String.Extra as String import Task import Util exposing ((=>), commaFormatInteger, delayTask, formatDisplayName, formatFloatToString, isJust, spinner, styledNumber) import VegaLite exposing (Spec, combineSpecs) import View.Charts exposing (distributionHistogram, wordOccurrenceTable) import View.Error exposing (viewRemoteError) import View.Extra exposing (viewIf) import View.Grid as Grid exposing (defaultCustomizations) import View.PageSize as PageSize import View.Pager as Pager import View.Tooltip exposing (helpIcon) type alias Model = { columnMetadata : Remote.WebData ColumnMetadataListing , statsResponse : Dict String (Remote.WebData ColumnStats) , dataSetName : DataSetName , tableState : Grid.State , modifiedMetadata : Dict String ColumnMetadata , changesPendingSave : Dict String ColumnMetadata , autoState : Autocomplete.State , targetQuery : String , previewTarget : Maybe String , showAutocomplete : Bool , showTarget : Bool , columnInEditMode : Maybe ColumnMetadata , saveResult : Remote.WebData () } type ExternalMsg = NoOp | Updated (List ColumnMetadata) type alias ColumnMetadataListing = { pageNumber : Int , totalPages : Int , pageSize : Int , totalCount : Int , metadata : Dict String ColumnMetadata } type Msg = StatsResponse (Remote.WebData DataSetStats) | SingleStatsResponse String (Remote.WebData DataSetStats) | SetTableState Grid.State | ChangePage Int | ChangePageSize Int | TypeSelectionChanged DataType | RoleSelectionChanged Role | ImputationSelectionChanged ImputationStrategy | SetAutoCompleteState Autocomplete.Msg | SetTarget String | SetQuery String | PreviewTarget String | AutocompleteWrap Bool | AutocompleteReset | SelectColumnForEdit ColumnMetadata | CancelColumnEdit | CommitMetadataChange | NoOpMsg | SaveMetadata (Remote.WebData ()) type alias StatsDict = Dict String (Remote.WebData ColumnStats) init : DataSetName -> Bool -> ( Model, Cmd Msg ) init dataSetName showTarget = Model Remote.Loading Dict.empty dataSetName (Grid.initialSort "columnName" Ascending) Dict.empty Dict.empty Autocomplete.empty "" Nothing False showTarget Nothing Remote.NotAsked => Cmd.none mapColumnListToPagedListing : ContextModel -> List ColumnMetadata -> ColumnMetadataListing mapColumnListToPagedListing context columns = let count = List.length columns pageSize = context.localStorage.userPageSize in { pageNumber = 0 , totalPages = calcTotalPages count pageSize , pageSize = pageSize , totalCount = count , metadata = Dict.fromListBy .name columns } calcTotalPages : Int -> Int -> Int calcTotalPages count pageSize = (count + pageSize - 1) // pageSize updateDataSetResponse : ContextModel -> Model -> Remote.WebData DataSetData -> ( Model, Cmd Msg ) updateDataSetResponse context model dataSetResponse = let mappedColumns = Remote.map (.columns >> mapColumnListToPagedListing context) dataSetResponse targetName = mappedColumns |> Remote.map .metadata |> Remote.withDefault Dict.empty |> Dict.find (\_ m -> m.role == Columns.Target) |> Maybe.map Tuple.first |> Maybe.withDefault "" in { model | columnMetadata = mappedColumns, targetQuery = targetName, showAutocomplete = False } => (Nexosis.Api.Data.getStats (contextToAuth context) model.dataSetName |> Remote.sendRequest |> Cmd.map StatsResponse ) delayAndRecheckStats : ContextModel -> DataSetName -> Cmd Msg delayAndRecheckStats context dataSetName = delayTask 20 |> Task.andThen (\_ -> Nexosis.Api.Data.getStats (contextToAuth context) dataSetName |> Http.toTask) |> Remote.asCmd |> Cmd.map StatsResponse update : Msg -> Model -> ContextModel -> (List ColumnMetadata -> Cmd (Remote.WebData ())) -> ( ( Model, Cmd Msg ), ExternalMsg ) update msg model context pendingSaveCommand = case msg of StatsResponse resp -> case resp of Remote.Success s -> let stats = s.columns |> Dict.map (\_ columnStats -> Remote.succeed columnStats) allMetadata = model.columnMetadata |> Remote.map (\m -> m.metadata |> Dict.values |> List.filter (\c -> c.role /= Key) |> List.length ) |> Remote.withDefault 0 reFetchStats = if Dict.size stats < allMetadata then delayAndRecheckStats context model.dataSetName else Cmd.none in { model | statsResponse = stats } => reFetchStats => NoOp Remote.Failure err -> model => logHttpError err => NoOp _ -> model => Cmd.none => NoOp SingleStatsResponse columnName resp -> case resp of Remote.Success { columns } -> let updatedStats = columns |> Dict.map (\_ columnStats -> Remote.succeed columnStats) |> flip Dict.union model.statsResponse in { model | statsResponse = updatedStats } => Cmd.none => NoOp Remote.Failure err -> { model | statsResponse = Dict.insert columnName (Remote.Failure err) model.statsResponse } => Cmd.none => NoOp _ -> model => Cmd.none => NoOp SetTableState newState -> { model | tableState = newState } => Cmd.none => NoOp ChangePage pageNumber -> let ( columnListing, cmd ) = Remote.update (updateColumnPageNumber pageNumber) model.columnMetadata in { model | columnMetadata = columnListing } => cmd => NoOp ChangePageSize pageSize -> let ( columnListing, cmd ) = Remote.update (updateColumnPageSize pageSize) model.columnMetadata in { model | columnMetadata = columnListing } => Cmd.batch [ StateStorage.saveAppState <| setPageSize context pageSize, cmd ] => NoOp RoleSelectionChanged selection -> { model | columnInEditMode = model.columnInEditMode |> Maybe.map (updateRole selection) } => Cmd.none => NoOp TypeSelectionChanged selection -> { model | columnInEditMode = model.columnInEditMode |> Maybe.map (updateDataType selection) } => Cmd.none => NoOp ImputationSelectionChanged selection -> { model | columnInEditMode = model.columnInEditMode |> Maybe.map (updateImputation selection) } => Cmd.none => NoOp CommitMetadataChange -> updateMetadata model model.columnInEditMode pendingSaveCommand SetQuery query -> let showAutocomplete = not << List.isEmpty <| filterColumnNames query model.columnMetadata in { model | targetQuery = query, showAutocomplete = showAutocomplete } => Cmd.none => NoOp SetAutoCompleteState autoMsg -> let ( newState, maybeMsg ) = Autocomplete.update autocompleteUpdateConfig autoMsg 5 model.autoState (filterColumnNames model.targetQuery model.columnMetadata) newModel = { model | autoState = newState } in case maybeMsg of Nothing -> newModel => Cmd.none => NoOp Just updateMsg -> update updateMsg newModel context pendingSaveCommand PreviewTarget targetName -> { model | previewTarget = Just targetName } => Cmd.none => NoOp AutocompleteWrap toTop -> case model.previewTarget of Just target -> update AutocompleteReset model context pendingSaveCommand Nothing -> if toTop then { model | autoState = Autocomplete.resetToLastItem autocompleteUpdateConfig (filterColumnNames model.targetQuery model.columnMetadata) 5 model.autoState , previewTarget = Maybe.map .name <| List.head <| List.reverse <| List.take 5 <| filterColumnNames model.targetQuery model.columnMetadata } => Cmd.none => NoOp else { model | autoState = Autocomplete.resetToFirstItem autocompleteUpdateConfig (filterColumnNames model.targetQuery model.columnMetadata) 5 model.autoState , previewTarget = Maybe.map .name <| List.head <| List.take 5 <| filterColumnNames model.targetQuery model.columnMetadata } => Cmd.none => NoOp AutocompleteReset -> { model | autoState = Autocomplete.reset autocompleteUpdateConfig model.autoState, previewTarget = Nothing } => Cmd.none => NoOp SetTarget targetName -> let newTarget = model.columnMetadata |> Remote.map (\cm -> cm.metadata |> Dict.get targetName |> Maybe.map (updateRole Target) ) |> Remote.withDefault Nothing in updateMetadata model newTarget pendingSaveCommand SelectColumnForEdit column -> { model | columnInEditMode = Just column, saveResult = Remote.NotAsked } => Cmd.none => NoOp CancelColumnEdit -> { model | columnInEditMode = Nothing, changesPendingSave = Dict.empty, saveResult = Remote.NotAsked } => Cmd.none => NoOp NoOpMsg -> model => Cmd.none => NoOp SaveMetadata result -> if Remote.isSuccess result then let columnsWithNewDataType = model.changesPendingSave |> Dict.values |> List.filter (\c -> model.columnMetadata |> Remote.map (\cm -> cm.metadata) |> Remote.withDefault Dict.empty |> Dict.union model.modifiedMetadata |> Dict.get c.name |> Maybe.map (\old -> old.dataType /= c.dataType) |> Maybe.withDefault False ) statsBeingRequested = columnsWithNewDataType |> List.map (\c -> ( c.name, Remote.Loading )) |> Dict.fromList |> flip Dict.union model.statsResponse modifiedMetadata = Dict.union model.changesPendingSave model.modifiedMetadata in { model | modifiedMetadata = modifiedMetadata, changesPendingSave = Dict.empty, saveResult = result, columnInEditMode = Nothing, showAutocomplete = False, previewTarget = Nothing, statsResponse = statsBeingRequested } => Cmd.batch (Ports.highlightIds (model.changesPendingSave |> Dict.keys |> List.map (\c -> "column_" ++ c |> String.classify)) :: List.map (\c -> Nexosis.Api.Data.getStatsForColumn (contextToAuth context) model.dataSetName c.name c.dataType |> Remote.sendRequest |> Cmd.map (SingleStatsResponse c.name) ) columnsWithNewDataType ) => Updated (Dict.values modifiedMetadata) else { model | saveResult = result } => Cmd.none => NoOp updateMetadata : Model -> Maybe ColumnMetadata -> (List ColumnMetadata -> Cmd (Remote.WebData ())) -> ( ( Model, Cmd Msg ), ExternalMsg ) updateMetadata model updatedColumn saveCommand = let existingColumns = model.columnMetadata |> Remote.map .metadata |> Remote.withDefault Dict.empty ensureSingleTarget newColumn = if newColumn.role == Target then existingColumns |> Dict.union model.modifiedMetadata |> Dict.find (\_ c -> c.role == Target) |> Maybe.map (\( _, oldTarget ) -> Just [ updateRole Feature oldTarget, newColumn ]) |> Maybe.withDefault (Just [ newColumn ]) else Just [ newColumn ] changedMetadata = updatedColumn |> Maybe.andThen ensureSingleTarget |> Maybe.withDefault [] |> Dict.fromListBy .name modifiedMetadata = Dict.intersect model.modifiedMetadata existingColumns |> Dict.union changedMetadata targetName = existingColumns |> Dict.union modifiedMetadata |> Dict.find (\_ c -> c.role == Target) |> Maybe.map (\( _, c ) -> c.name) |> Maybe.withDefault "" in if modifiedMetadata /= Dict.empty then { model | changesPendingSave = changedMetadata, targetQuery = targetName, saveResult = Remote.Loading } => Cmd.map SaveMetadata (saveCommand <| Dict.values changedMetadata) => NoOp else { model | modifiedMetadata = modifiedMetadata, columnInEditMode = Nothing, targetQuery = targetName, saveResult = Remote.NotAsked, showAutocomplete = False, previewTarget = Nothing } => Cmd.none => NoOp subscriptions : Model -> Sub Msg subscriptions model = Autocomplete.subscription |> Sub.map SetAutoCompleteState filterColumnNames : String -> Remote.WebData ColumnMetadataListing -> List ColumnMetadata filterColumnNames query columnMetadata = let columns = columnMetadata |> Remote.map (\cm -> Dict.values cm.metadata) |> Remote.withDefault [] lowerQuery = String.toLower query in List.filter (String.contains lowerQuery << String.toLower << .name) columns onKeyDown : Char.KeyCode -> Maybe String -> Maybe Msg onKeyDown code maybeId = if code == 38 || code == 40 then -- up & down arrows Maybe.map PreviewTarget maybeId else if code == 13 || code == 9 then -- enter & tab Maybe.map SetTarget maybeId else if code == 27 then --escape Just <| SetQuery "" else Nothing autocompleteUpdateConfig : Autocomplete.UpdateConfig Msg ColumnMetadata autocompleteUpdateConfig = Autocomplete.updateConfig { toId = .name , onKeyDown = onKeyDown , onTooLow = Just <| AutocompleteWrap True , onTooHigh = Just <| AutocompleteWrap False , onMouseEnter = \_ -> Nothing , onMouseLeave = \_ -> Nothing , onMouseClick = \id -> Just <| SetTarget id , separateSelections = False } updateImputation : ImputationStrategy -> ColumnMetadata -> ColumnMetadata updateImputation value column = { column | imputation = value } updateRole : Role -> ColumnMetadata -> ColumnMetadata updateRole value column = { column | role = value } updateDataType : DataType -> ColumnMetadata -> ColumnMetadata updateDataType value column = { column | dataType = value } updateColumnPageNumber : Int -> ColumnMetadataListing -> ( ColumnMetadataListing, Cmd Msg ) updateColumnPageNumber pageNumber columnListing = { columnListing | pageNumber = pageNumber } => Cmd.none updateColumnPageSize : Int -> ColumnMetadataListing -> ( ColumnMetadataListing, Cmd Msg ) updateColumnPageSize pageSize columnListing = { columnListing | pageSize = pageSize, pageNumber = 0, totalPages = calcTotalPages columnListing.totalCount pageSize } => Cmd.none updateColumnMetadata : Dict String ColumnMetadata -> ColumnMetadataListing -> ( ColumnMetadataListing, Cmd msg ) updateColumnMetadata info columnListing = { columnListing | metadata = info } => Cmd.none generateVegaSpec : ColumnMetadata -> ( String, Spec ) generateVegaSpec column = column.name => VegaLite.toVegaLite [ VegaLite.title column.name , VegaLite.dataFromColumns [] <| VegaLite.dataColumn "x" (VegaLite.Numbers [ 10, 20, 30 ]) [] , VegaLite.mark VegaLite.Circle [] , VegaLite.encoding <| VegaLite.position VegaLite.X [ VegaLite.PName "x", VegaLite.PmType VegaLite.Quantitative ] [] ] view : ContextModel -> Model -> Html Msg view context model = let mergedMetadata = model.columnMetadata |> Remote.map (\cm -> let unionedMetadata = cm.metadata |> Dict.union model.modifiedMetadata in { cm | metadata = unionedMetadata } ) editTable = buildEditTable context model.statsResponse model in div [] [ div [ id "pagination-controls", class "row" ] [ div [ class "col-xs-12 col-sm-3 pleft0" ] [ h3 [] [ text "Column metadata" ] ] , div [ class "col-sm-6 p0" ] [ Pager.view model.columnMetadata ChangePage ] , div [ id "view-rows", class "col-sm-2 col-sm-offset-1 right" ] [ PageSize.view ChangePageSize context.localStorage.userPageSize ] ] , div [ class "row mb25", id "list" ] [ Grid.view filterColumnsToDisplay (config context.config.toolTips model.statsResponse editTable model.columnInEditMode) model.tableState mergedMetadata ] , hr [] [] , div [ class "center" ] [ Pager.view model.columnMetadata ChangePage ] ] buildEditTable : ContextModel -> StatsDict -> Model -> ColumnMetadata -> Html Msg buildEditTable context stats model column = let saveButton = case model.saveResult of Remote.Loading -> button [ class "btn btn-danger btn-sm" ] [ spinner ] _ -> button [ class "btn btn-danger btn-sm", onClick CommitMetadataChange ] [ text "Save Changes" ] in tr [ class "modal fade in", style [ ( "display", "table-row" ), ( "position", "static" ) ] ] [ td [ class "p0", colspan 6 ] [ div [ class "modal-dialog modal-content metadata-editor m0", style [ ( "z-index", "1050" ), ( "width", "auto" ) ] ] [ Grid.view identity (editConfig context.config.toolTips stats) Grid.initialUnsorted (Remote.succeed [ column ]) , div [ class "text-left mr10 ml10" ] [ viewRemoteError model.saveResult ] , div [ class "modal-footer" ] [ button [ class "btn btn-link btn-sm", onClick CancelColumnEdit ] [ text "Discard" ] , saveButton ] ] , div [ class "modal-backdrop in", onClick CancelColumnEdit ] [] ] ] viewEditModeOverlay : Maybe ColumnMetadata -> Html Msg viewEditModeOverlay editColumn = if isJust editColumn then div [ class "modal-backdrop in", onClick CancelColumnEdit ] [] else div [] [] viewTargetAndKeyColumns : ContextModel -> Model -> Html Msg viewTargetAndKeyColumns context model = let ( keyFormGroup, targetFormGroup ) = case model.columnMetadata of Remote.Success resp -> let keyGroup = resp.metadata |> Dict.find (\_ m -> m.role == Columns.Key) |> Maybe.map (viewKeyFormGroup << Tuple.second) |> Maybe.withDefault (div [] []) in ( keyGroup, viewTargetFormGroup context model ) Remote.Loading -> ( viewLoadingFormGroup, viewLoadingFormGroup ) _ -> ( div [] [], div [] [] ) in div [ class "form-horizontal" ] [ keyFormGroup , targetFormGroup ] viewLoadingFormGroup : Html Msg viewLoadingFormGroup = div [ class "form-group" ] [ label [ class "control-label col-sm-3 mr0 pr0" ] [ div [ class "loading--line" ] [] ] , div [ class "col-sm-8" ] [ div [ class "loading--line" ] [] ] ] viewKeyFormGroup : ColumnMetadata -> Html Msg viewKeyFormGroup key = div [ class "form-group" ] [ label [ class "control-label col-sm-3 mr0 pr0" ] [ text "Key" ] , div [ class "col-sm-8" ] [ p [ class "mb5", style [ ( "padding", "7px 10px 0;" ) ] ] [ text key.name ] , p [ class "small color-mediumGray" ] [ text "The key role can only be set when importing a new dataset." ] ] ] viewTargetFormGroup : ContextModel -> Model -> Html Msg viewTargetFormGroup context model = if model.showTarget then let queryText = Maybe.withDefault model.targetQuery model.previewTarget in div [ class "form-group" ] [ label [ class "control-label col-sm-3 mr0 pr0" ] (text "Target " :: helpIcon context.config.toolTips "Target") , div [ class "col-sm-8" ] [ input [ type_ "text", class "form-control", value queryText, onInput SetQuery ] [] , viewIf (\() -> div [ class "autocomplete-menu" ] [ Html.map SetAutoCompleteState (Autocomplete.view viewConfig 5 model.autoState (filterColumnNames model.targetQuery model.columnMetadata)) ] ) model.showAutocomplete , viewIf (\() -> viewRemoteError model.saveResult) <| not <| isJust model.columnInEditMode ] ] else div [] [] viewConfig : Autocomplete.ViewConfig ColumnMetadata viewConfig = let customizedLi keySelected mouseSelected person = { attributes = [ classList [ ( "autocomplete-item", True ) , ( "key-selected", keySelected ) , ( "mouse-selected", mouseSelected ) ] ] , children = [ Html.text person.name ] } in Autocomplete.viewConfig { toId = .name , ul = [ class "autocomplete-list" ] , li = customizedLi } filterColumnsToDisplay : ColumnMetadataListing -> List ColumnMetadata filterColumnsToDisplay columnListing = let drop = columnListing.pageSize * columnListing.pageNumber in columnListing.metadata |> Dict.values |> List.drop drop |> List.take columnListing.pageSize config : Dict String String -> StatsDict -> (ColumnMetadata -> Html Msg) -> Maybe ColumnMetadata -> Grid.Config ColumnMetadata Msg config toolTips stats buildEditTable columnInEdit = let makeIcon = helpIcon toolTips columns = [ nameColumn , typeColumn makeIcon |> (\c -> { c | viewData = lockedDropdownCell (\v -> toString v.dataType) }) , roleColumn makeIcon |> (\c -> { c | viewData = lockedDropdownCell (\v -> toString v.role) }) , imputationColumn makeIcon |> (\c -> { c | viewData = stringImputationCell (\v -> toString v.imputation) }) , statsColumn stats , histogramColumn stats ] in Grid.configCustom { toId = \c -> c.name , toMsg = SetTableState , columns = columns |> List.map Grid.veryCustomColumn , customizations = \defaults -> { defaults | rowAttrs = customRowAttributes , rowOverride = rowOverride buildEditTable columnInEdit , tableAttrs = metadataTableAttrs } } editConfig : Dict String String -> StatsDict -> Grid.Config ColumnMetadata Msg editConfig toolTips stats = let makeIcon = helpIcon toolTips columns = [ { nameColumn | sorter = Grid.unsortable } , typeColumn makeIcon , roleColumn makeIcon , imputationColumn makeIcon , statsColumn stats , histogramColumn stats ] in Grid.configCustom { toId = \c -> c.name , toMsg = SetTableState , columns = columns |> List.map Grid.veryCustomColumn , customizations = \defaults -> { defaults | tableAttrs = [ class "table table-striped mb0" ] } } metadataTableAttrs : List (Attribute msg) metadataTableAttrs = [ id "metadata", class "table table-striped" ] rowOverride : (ColumnMetadata -> Html Msg) -> Maybe ColumnMetadata -> ( ColumnMetadata -> Bool, ColumnMetadata -> Html Msg ) rowOverride buildEditTable columnInEdit = case columnInEdit of Just column -> ( \c -> c.name == column.name, \c -> buildEditTable c ) Nothing -> ( \_ -> False, \_ -> div [] [] ) lockedDropdownCell : (ColumnMetadata -> String) -> ColumnMetadata -> Grid.HtmlDetails Msg lockedDropdownCell getValue column = if column.role == Key then if getValue column == "Key" then Grid.HtmlDetails [ class "form-group" ] [ select [ disabled True, class "form-control" ] [ option [] [ text "Key" ] ] ] else emptyDropdown else Grid.HtmlDetails [ class "form-group" ] [ select [ class "form-control" , Html.Events.onWithOptions "mousedown" { preventDefault = True , stopPropagation = False } (Decode.succeed NoOpMsg) ] [ option [] [ text <| getValue column ] ] ] stringImputationCell : (ColumnMetadata -> String) -> ColumnMetadata -> Grid.HtmlDetails Msg stringImputationCell getValue column = if column.dataType == Text then naDropdown else lockedDropdownCell getValue column customRowAttributes : ColumnMetadata -> List (Attribute Msg) customRowAttributes column = if column.role == Key then [ id "key" ] else [ id <| String.classify <| "column_" ++ column.name, onClick <| SelectColumnForEdit column ] type alias ColumnDisplayProperties = { headAttributes : List (Attribute Msg) , headHtml : List (Html Msg) , name : String , sorter : Grid.Sorter ColumnMetadata , viewData : ColumnMetadata -> Grid.HtmlDetails Msg } nameColumn : ColumnDisplayProperties nameColumn = { name = "Column Name" , viewData = \c -> Grid.HtmlDetails [ class "name" ] [ text <| formatDisplayName c.name ] , sorter = Grid.increasingOrDecreasingBy (\c -> c.name) , headAttributes = [ class "left per30" ] , headHtml = [] } typeColumn : (String -> List (Html Msg)) -> ColumnDisplayProperties typeColumn makeIcon = { name = "Type" , viewData = dataTypeCell , sorter = Grid.unsortable , headAttributes = [ class "per10" ] , headHtml = text "Type " :: makeIcon "Type" } dataTypeCell : ColumnMetadata -> Grid.HtmlDetails Msg dataTypeCell column = Grid.HtmlDetails [ class "form-group" ] [ UnionSelect.fromSelected [ class "form-control" ] enumDataType TypeSelectionChanged column.dataType ] emptyDropdown : Grid.HtmlDetails Msg emptyDropdown = Grid.HtmlDetails [ class "form-group" ] [ select [ disabled True, class "form-control" ] [] ] naDropdown : Grid.HtmlDetails Msg naDropdown = Grid.HtmlDetails [ class "form-group color-mediumGray" ] [ text "N/A" ] roleColumn : (String -> List (Html Msg)) -> ColumnDisplayProperties roleColumn makeIcon = { name = "Role" , viewData = roleCell , sorter = Grid.unsortable , headAttributes = [ class "per10" ] , headHtml = text "Role " :: makeIcon "Role" } roleCell : ColumnMetadata -> Grid.HtmlDetails Msg roleCell column = Grid.HtmlDetails [ class "form-group" ] [ UnionSelect.fromSelected [ class "form-control" ] enumRole RoleSelectionChanged column.role ] imputationColumn : (String -> List (Html Msg)) -> ColumnDisplayProperties imputationColumn makeIcon = { name = "Imputation" , viewData = imputationCell , sorter = Grid.unsortable , headAttributes = [ class "per10" ] , headHtml = text "Imputation " :: makeIcon "Imputation" } imputationCell : ColumnMetadata -> Grid.HtmlDetails Msg imputationCell column = if column.dataType == Text then naDropdown else Grid.HtmlDetails [ class "form-group" ] [ UnionSelect.fromSelected [ class "form-control" ] enumImputationStrategy ImputationSelectionChanged column.imputation ] statsColumn : StatsDict -> ColumnDisplayProperties statsColumn stats = { name = "Stats" , viewData = statsCell stats , sorter = Grid.unsortable , headAttributes = [ class "per25" ] , headHtml = [] } statsCell : StatsDict -> ColumnMetadata -> Grid.HtmlDetails Msg statsCell stats column = if column.role == Key then Grid.HtmlDetails [ class "stats" ] [ div [ class "row m0" ] [ div [ class "col-xs-6 pl0 pr0" ] [ text "N/A" ] , div [ class "col-xs-6 pl0 pr0" ] [ text "N/A" ] ] ] else let columnStat = Dict.get column.name stats statsClass = columnStat |> Maybe.map (\s -> s |> Remote.map (\_ -> "stats") |> Remote.withDefault "stats loading") |> Maybe.withDefault "stats loading" columnStats = columnStat |> Maybe.withDefault Remote.Loading |> Remote.map (\s -> ( s, column.dataType )) in Grid.HtmlDetails [ class statsClass ] [ statsDisplay columnStats ] statsDisplay : Remote.WebData ( ColumnStats, DataType ) -> Html Msg statsDisplay columnStats = case columnStats of Remote.Loading -> div [ class "row m0" ] [ div [ class "col-xs-6 pl0 pr0" ] [ i [ class "fa fa-refresh fa-spin fa-fw" ] [] , span [ class "sr-only" ] [ text "Calculating..." ] ] , div [ class "col-xs-6 pl0 pr0" ] [ i [ class "fa fa-refresh fa-spin fa-fw" ] [] , span [ class "sr-only" ] [ text "Calculating..." ] ] ] Remote.Success ( stats, dataType ) -> let errorStyle = if stats.errorCount == 0 then "" else if (toFloat stats.errorCount / toFloat stats.totalCount) * 100 < 10 then "text-danger" else "label label-danger" missingStyle = if stats.missingCount == 0 then "" else if (toFloat stats.missingCount / toFloat stats.totalCount) * 100 < 10 then "text-danger" else "label label-danger" min = [ strong [] [ text "Min: " ] , styledNumber <| stats.min ] max = [ strong [] [ text "Max: " ] , styledNumber <| stats.max ] count = [ strong [] [ text "Count: " ] , styledNumber <| commaFormatInteger stats.totalCount ] missing = [ span [ class missingStyle ] [ strong [] [ text "# Missing: " ] , styledNumber <| commaFormatInteger stats.missingCount ] ] mean = [ strong [] [ text "Mean: " ] , styledNumber <| formatFloatToString stats.mean ] mode = [ strong [] [ text "Mode: " ] , styledNumber <| stats.mode ] errors = [ span [ class errorStyle ] [ strong [] [ text "Errors: " ] , styledNumber <| commaFormatInteger stats.errorCount ] ] stdDev = [ strong [] [ text "Std Dev: " ] , styledNumber <| formatFloatToString stats.stddev ] variance = [ strong [] [ text "Variance: " ] , styledNumber <| formatFloatToString stats.variance ] ( statsLeft, statsRight ) = case dataType of String -> [ min, max, count ] => [ missing, mean, mode ] Text -> [ count, missing ] => [] Logical -> [ min, max, mode ] => [ count, errors, missing ] Date -> [ min, max, mode ] => [ count, errors, missing ] Numeric -> [ min, max, stdDev, errors, variance ] => [ count, missing, mean, mode ] Measure -> [ min, max, stdDev, errors, variance ] => [ count, missing, mean, mode ] in div [ class "row m0" ] [ div [ class "col-xs-6 pl0 pr0" ] (statsLeft |> List.intersperse [ br [] [] ] |> List.concat ) , div [ class "col-xs-6 pl0 pr0" ] (statsRight |> List.intersperse [ br [] [] ] |> List.concat ) ] _ -> div [ class "row m0" ] [ div [ class "col-sm-6 pl0 pr0" ] [] , div [ class "col-sm-6 pl0 pr0" ] [] ] histogramColumn : StatsDict -> ColumnDisplayProperties histogramColumn stats = { name = "Distribution" , viewData = histogram stats , sorter = Grid.unsortable , headAttributes = [ class "per15" ] , headHtml = [] } histogram : StatsDict -> ColumnMetadata -> Grid.HtmlDetails Msg histogram stats column = if column.role == Key then Grid.HtmlDetails [ class "stats" ] [ text "N/A" ] else let columnStats = stats |> Dict.get column.name |> Maybe.withDefault Remote.Loading in case columnStats of Remote.Loading -> Grid.HtmlDetails [ class "loading" ] [ i [ class "fa fa-refresh fa-spin fa-fw" ] [] , span [ class "sr-only" ] [ text "Calculating..." ] ] Remote.Success stats -> if column.dataType == Text then Grid.HtmlDetails [ class "distribution text" ] [ stats.distribution |> wordOccurrenceTable ] else Grid.HtmlDetails [] [ stats.distribution |> distributionHistogram ] _ -> Grid.HtmlDetails [] [ div [] [] ]
3296
module View.ColumnMetadataEditor exposing (ExternalMsg(..), Model, Msg, init, subscriptions, update, updateDataSetResponse, view, viewTargetAndKeyColumns) import Autocomplete import Char import Data.Columns as Columns exposing (enumDataType, enumRole) import Data.Context exposing (ContextModel, contextToAuth, setPageSize) import Data.ImputationStrategy exposing (enumImputationStrategy) import Dict exposing (Dict) import Dict.Extra as Dict import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onFocus, onInput) import Http import Json.Decode as Decode import Nexosis.Api.Data import Nexosis.Types.Columns as Columns exposing (ColumnMetadata, ColumnStats, ColumnStatsDict, DataType(..), Role(..)) import Nexosis.Types.DataSet as DataSet exposing (DataSetData, DataSetName, DataSetStats, toDataSetName) import Nexosis.Types.ImputationStrategy exposing (ImputationStrategy(..)) import Nexosis.Types.SortParameters exposing (SortDirection(..), SortParameters) import Ports import RemoteData as Remote import Request.Log exposing (logHttpError) import SelectWithStyle as UnionSelect import StateStorage exposing (saveAppState) import String.Extra as String import Task import Util exposing ((=>), commaFormatInteger, delayTask, formatDisplayName, formatFloatToString, isJust, spinner, styledNumber) import VegaLite exposing (Spec, combineSpecs) import View.Charts exposing (distributionHistogram, wordOccurrenceTable) import View.Error exposing (viewRemoteError) import View.Extra exposing (viewIf) import View.Grid as Grid exposing (defaultCustomizations) import View.PageSize as PageSize import View.Pager as Pager import View.Tooltip exposing (helpIcon) type alias Model = { columnMetadata : Remote.WebData ColumnMetadataListing , statsResponse : Dict String (Remote.WebData ColumnStats) , dataSetName : DataSetName , tableState : Grid.State , modifiedMetadata : Dict String ColumnMetadata , changesPendingSave : Dict String ColumnMetadata , autoState : Autocomplete.State , targetQuery : String , previewTarget : Maybe String , showAutocomplete : Bool , showTarget : Bool , columnInEditMode : Maybe ColumnMetadata , saveResult : Remote.WebData () } type ExternalMsg = NoOp | Updated (List ColumnMetadata) type alias ColumnMetadataListing = { pageNumber : Int , totalPages : Int , pageSize : Int , totalCount : Int , metadata : Dict String ColumnMetadata } type Msg = StatsResponse (Remote.WebData DataSetStats) | SingleStatsResponse String (Remote.WebData DataSetStats) | SetTableState Grid.State | ChangePage Int | ChangePageSize Int | TypeSelectionChanged DataType | RoleSelectionChanged Role | ImputationSelectionChanged ImputationStrategy | SetAutoCompleteState Autocomplete.Msg | SetTarget String | SetQuery String | PreviewTarget String | AutocompleteWrap Bool | AutocompleteReset | SelectColumnForEdit ColumnMetadata | CancelColumnEdit | CommitMetadataChange | NoOpMsg | SaveMetadata (Remote.WebData ()) type alias StatsDict = Dict String (Remote.WebData ColumnStats) init : DataSetName -> Bool -> ( Model, Cmd Msg ) init dataSetName showTarget = Model Remote.Loading Dict.empty dataSetName (Grid.initialSort "columnName" Ascending) Dict.empty Dict.empty Autocomplete.empty "" Nothing False showTarget Nothing Remote.NotAsked => Cmd.none mapColumnListToPagedListing : ContextModel -> List ColumnMetadata -> ColumnMetadataListing mapColumnListToPagedListing context columns = let count = List.length columns pageSize = context.localStorage.userPageSize in { pageNumber = 0 , totalPages = calcTotalPages count pageSize , pageSize = pageSize , totalCount = count , metadata = Dict.fromListBy .name columns } calcTotalPages : Int -> Int -> Int calcTotalPages count pageSize = (count + pageSize - 1) // pageSize updateDataSetResponse : ContextModel -> Model -> Remote.WebData DataSetData -> ( Model, Cmd Msg ) updateDataSetResponse context model dataSetResponse = let mappedColumns = Remote.map (.columns >> mapColumnListToPagedListing context) dataSetResponse targetName = mappedColumns |> Remote.map .metadata |> Remote.withDefault Dict.empty |> Dict.find (\_ m -> m.role == Columns.Target) |> Maybe.map Tuple.first |> Maybe.withDefault "" in { model | columnMetadata = mappedColumns, targetQuery = targetName, showAutocomplete = False } => (Nexosis.Api.Data.getStats (contextToAuth context) model.dataSetName |> Remote.sendRequest |> Cmd.map StatsResponse ) delayAndRecheckStats : ContextModel -> DataSetName -> Cmd Msg delayAndRecheckStats context dataSetName = delayTask 20 |> Task.andThen (\_ -> Nexosis.Api.Data.getStats (contextToAuth context) dataSetName |> Http.toTask) |> Remote.asCmd |> Cmd.map StatsResponse update : Msg -> Model -> ContextModel -> (List ColumnMetadata -> Cmd (Remote.WebData ())) -> ( ( Model, Cmd Msg ), ExternalMsg ) update msg model context pendingSaveCommand = case msg of StatsResponse resp -> case resp of Remote.Success s -> let stats = s.columns |> Dict.map (\_ columnStats -> Remote.succeed columnStats) allMetadata = model.columnMetadata |> Remote.map (\m -> m.metadata |> Dict.values |> List.filter (\c -> c.role /= Key) |> List.length ) |> Remote.withDefault 0 reFetchStats = if Dict.size stats < allMetadata then delayAndRecheckStats context model.dataSetName else Cmd.none in { model | statsResponse = stats } => reFetchStats => NoOp Remote.Failure err -> model => logHttpError err => NoOp _ -> model => Cmd.none => NoOp SingleStatsResponse columnName resp -> case resp of Remote.Success { columns } -> let updatedStats = columns |> Dict.map (\_ columnStats -> Remote.succeed columnStats) |> flip Dict.union model.statsResponse in { model | statsResponse = updatedStats } => Cmd.none => NoOp Remote.Failure err -> { model | statsResponse = Dict.insert columnName (Remote.Failure err) model.statsResponse } => Cmd.none => NoOp _ -> model => Cmd.none => NoOp SetTableState newState -> { model | tableState = newState } => Cmd.none => NoOp ChangePage pageNumber -> let ( columnListing, cmd ) = Remote.update (updateColumnPageNumber pageNumber) model.columnMetadata in { model | columnMetadata = columnListing } => cmd => NoOp ChangePageSize pageSize -> let ( columnListing, cmd ) = Remote.update (updateColumnPageSize pageSize) model.columnMetadata in { model | columnMetadata = columnListing } => Cmd.batch [ StateStorage.saveAppState <| setPageSize context pageSize, cmd ] => NoOp RoleSelectionChanged selection -> { model | columnInEditMode = model.columnInEditMode |> Maybe.map (updateRole selection) } => Cmd.none => NoOp TypeSelectionChanged selection -> { model | columnInEditMode = model.columnInEditMode |> Maybe.map (updateDataType selection) } => Cmd.none => NoOp ImputationSelectionChanged selection -> { model | columnInEditMode = model.columnInEditMode |> Maybe.map (updateImputation selection) } => Cmd.none => NoOp CommitMetadataChange -> updateMetadata model model.columnInEditMode pendingSaveCommand SetQuery query -> let showAutocomplete = not << List.isEmpty <| filterColumnNames query model.columnMetadata in { model | targetQuery = query, showAutocomplete = showAutocomplete } => Cmd.none => NoOp SetAutoCompleteState autoMsg -> let ( newState, maybeMsg ) = Autocomplete.update autocompleteUpdateConfig autoMsg 5 model.autoState (filterColumnNames model.targetQuery model.columnMetadata) newModel = { model | autoState = newState } in case maybeMsg of Nothing -> newModel => Cmd.none => NoOp Just updateMsg -> update updateMsg newModel context pendingSaveCommand PreviewTarget targetName -> { model | previewTarget = Just targetName } => Cmd.none => NoOp AutocompleteWrap toTop -> case model.previewTarget of Just target -> update AutocompleteReset model context pendingSaveCommand Nothing -> if toTop then { model | autoState = Autocomplete.resetToLastItem autocompleteUpdateConfig (filterColumnNames model.targetQuery model.columnMetadata) 5 model.autoState , previewTarget = Maybe.map .name <| List.head <| List.reverse <| List.take 5 <| filterColumnNames model.targetQuery model.columnMetadata } => Cmd.none => NoOp else { model | autoState = Autocomplete.resetToFirstItem autocompleteUpdateConfig (filterColumnNames model.targetQuery model.columnMetadata) 5 model.autoState , previewTarget = Maybe.map .name <| List.head <| List.take 5 <| filterColumnNames model.targetQuery model.columnMetadata } => Cmd.none => NoOp AutocompleteReset -> { model | autoState = Autocomplete.reset autocompleteUpdateConfig model.autoState, previewTarget = Nothing } => Cmd.none => NoOp SetTarget targetName -> let newTarget = model.columnMetadata |> Remote.map (\cm -> cm.metadata |> Dict.get targetName |> Maybe.map (updateRole Target) ) |> Remote.withDefault Nothing in updateMetadata model newTarget pendingSaveCommand SelectColumnForEdit column -> { model | columnInEditMode = Just column, saveResult = Remote.NotAsked } => Cmd.none => NoOp CancelColumnEdit -> { model | columnInEditMode = Nothing, changesPendingSave = Dict.empty, saveResult = Remote.NotAsked } => Cmd.none => NoOp NoOpMsg -> model => Cmd.none => NoOp SaveMetadata result -> if Remote.isSuccess result then let columnsWithNewDataType = model.changesPendingSave |> Dict.values |> List.filter (\c -> model.columnMetadata |> Remote.map (\cm -> cm.metadata) |> Remote.withDefault Dict.empty |> Dict.union model.modifiedMetadata |> Dict.get c.name |> Maybe.map (\old -> old.dataType /= c.dataType) |> Maybe.withDefault False ) statsBeingRequested = columnsWithNewDataType |> List.map (\c -> ( c.name, Remote.Loading )) |> Dict.fromList |> flip Dict.union model.statsResponse modifiedMetadata = Dict.union model.changesPendingSave model.modifiedMetadata in { model | modifiedMetadata = modifiedMetadata, changesPendingSave = Dict.empty, saveResult = result, columnInEditMode = Nothing, showAutocomplete = False, previewTarget = Nothing, statsResponse = statsBeingRequested } => Cmd.batch (Ports.highlightIds (model.changesPendingSave |> Dict.keys |> List.map (\c -> "column_" ++ c |> String.classify)) :: List.map (\c -> Nexosis.Api.Data.getStatsForColumn (contextToAuth context) model.dataSetName c.name c.dataType |> Remote.sendRequest |> Cmd.map (SingleStatsResponse c.name) ) columnsWithNewDataType ) => Updated (Dict.values modifiedMetadata) else { model | saveResult = result } => Cmd.none => NoOp updateMetadata : Model -> Maybe ColumnMetadata -> (List ColumnMetadata -> Cmd (Remote.WebData ())) -> ( ( Model, Cmd Msg ), ExternalMsg ) updateMetadata model updatedColumn saveCommand = let existingColumns = model.columnMetadata |> Remote.map .metadata |> Remote.withDefault Dict.empty ensureSingleTarget newColumn = if newColumn.role == Target then existingColumns |> Dict.union model.modifiedMetadata |> Dict.find (\_ c -> c.role == Target) |> Maybe.map (\( _, oldTarget ) -> Just [ updateRole Feature oldTarget, newColumn ]) |> Maybe.withDefault (Just [ newColumn ]) else Just [ newColumn ] changedMetadata = updatedColumn |> Maybe.andThen ensureSingleTarget |> Maybe.withDefault [] |> Dict.fromListBy .name modifiedMetadata = Dict.intersect model.modifiedMetadata existingColumns |> Dict.union changedMetadata targetName = existingColumns |> Dict.union modifiedMetadata |> Dict.find (\_ c -> c.role == Target) |> Maybe.map (\( _, c ) -> c.name) |> Maybe.withDefault "" in if modifiedMetadata /= Dict.empty then { model | changesPendingSave = changedMetadata, targetQuery = targetName, saveResult = Remote.Loading } => Cmd.map SaveMetadata (saveCommand <| Dict.values changedMetadata) => NoOp else { model | modifiedMetadata = modifiedMetadata, columnInEditMode = Nothing, targetQuery = targetName, saveResult = Remote.NotAsked, showAutocomplete = False, previewTarget = Nothing } => Cmd.none => NoOp subscriptions : Model -> Sub Msg subscriptions model = Autocomplete.subscription |> Sub.map SetAutoCompleteState filterColumnNames : String -> Remote.WebData ColumnMetadataListing -> List ColumnMetadata filterColumnNames query columnMetadata = let columns = columnMetadata |> Remote.map (\cm -> Dict.values cm.metadata) |> Remote.withDefault [] lowerQuery = String.toLower query in List.filter (String.contains lowerQuery << String.toLower << .name) columns onKeyDown : Char.KeyCode -> Maybe String -> Maybe Msg onKeyDown code maybeId = if code == 38 || code == 40 then -- up & down arrows Maybe.map PreviewTarget maybeId else if code == 13 || code == 9 then -- enter & tab Maybe.map SetTarget maybeId else if code == 27 then --escape Just <| SetQuery "" else Nothing autocompleteUpdateConfig : Autocomplete.UpdateConfig Msg ColumnMetadata autocompleteUpdateConfig = Autocomplete.updateConfig { toId = .name , onKeyDown = onKeyDown , onTooLow = Just <| AutocompleteWrap True , onTooHigh = Just <| AutocompleteWrap False , onMouseEnter = \_ -> Nothing , onMouseLeave = \_ -> Nothing , onMouseClick = \id -> Just <| SetTarget id , separateSelections = False } updateImputation : ImputationStrategy -> ColumnMetadata -> ColumnMetadata updateImputation value column = { column | imputation = value } updateRole : Role -> ColumnMetadata -> ColumnMetadata updateRole value column = { column | role = value } updateDataType : DataType -> ColumnMetadata -> ColumnMetadata updateDataType value column = { column | dataType = value } updateColumnPageNumber : Int -> ColumnMetadataListing -> ( ColumnMetadataListing, Cmd Msg ) updateColumnPageNumber pageNumber columnListing = { columnListing | pageNumber = pageNumber } => Cmd.none updateColumnPageSize : Int -> ColumnMetadataListing -> ( ColumnMetadataListing, Cmd Msg ) updateColumnPageSize pageSize columnListing = { columnListing | pageSize = pageSize, pageNumber = 0, totalPages = calcTotalPages columnListing.totalCount pageSize } => Cmd.none updateColumnMetadata : Dict String ColumnMetadata -> ColumnMetadataListing -> ( ColumnMetadataListing, Cmd msg ) updateColumnMetadata info columnListing = { columnListing | metadata = info } => Cmd.none generateVegaSpec : ColumnMetadata -> ( String, Spec ) generateVegaSpec column = column.name => VegaLite.toVegaLite [ VegaLite.title column.name , VegaLite.dataFromColumns [] <| VegaLite.dataColumn "x" (VegaLite.Numbers [ 10, 20, 30 ]) [] , VegaLite.mark VegaLite.Circle [] , VegaLite.encoding <| VegaLite.position VegaLite.X [ VegaLite.PName "x", VegaLite.PmType VegaLite.Quantitative ] [] ] view : ContextModel -> Model -> Html Msg view context model = let mergedMetadata = model.columnMetadata |> Remote.map (\cm -> let unionedMetadata = cm.metadata |> Dict.union model.modifiedMetadata in { cm | metadata = unionedMetadata } ) editTable = buildEditTable context model.statsResponse model in div [] [ div [ id "pagination-controls", class "row" ] [ div [ class "col-xs-12 col-sm-3 pleft0" ] [ h3 [] [ text "Column metadata" ] ] , div [ class "col-sm-6 p0" ] [ Pager.view model.columnMetadata ChangePage ] , div [ id "view-rows", class "col-sm-2 col-sm-offset-1 right" ] [ PageSize.view ChangePageSize context.localStorage.userPageSize ] ] , div [ class "row mb25", id "list" ] [ Grid.view filterColumnsToDisplay (config context.config.toolTips model.statsResponse editTable model.columnInEditMode) model.tableState mergedMetadata ] , hr [] [] , div [ class "center" ] [ Pager.view model.columnMetadata ChangePage ] ] buildEditTable : ContextModel -> StatsDict -> Model -> ColumnMetadata -> Html Msg buildEditTable context stats model column = let saveButton = case model.saveResult of Remote.Loading -> button [ class "btn btn-danger btn-sm" ] [ spinner ] _ -> button [ class "btn btn-danger btn-sm", onClick CommitMetadataChange ] [ text "Save Changes" ] in tr [ class "modal fade in", style [ ( "display", "table-row" ), ( "position", "static" ) ] ] [ td [ class "p0", colspan 6 ] [ div [ class "modal-dialog modal-content metadata-editor m0", style [ ( "z-index", "1050" ), ( "width", "auto" ) ] ] [ Grid.view identity (editConfig context.config.toolTips stats) Grid.initialUnsorted (Remote.succeed [ column ]) , div [ class "text-left mr10 ml10" ] [ viewRemoteError model.saveResult ] , div [ class "modal-footer" ] [ button [ class "btn btn-link btn-sm", onClick CancelColumnEdit ] [ text "Discard" ] , saveButton ] ] , div [ class "modal-backdrop in", onClick CancelColumnEdit ] [] ] ] viewEditModeOverlay : Maybe ColumnMetadata -> Html Msg viewEditModeOverlay editColumn = if isJust editColumn then div [ class "modal-backdrop in", onClick CancelColumnEdit ] [] else div [] [] viewTargetAndKeyColumns : ContextModel -> Model -> Html Msg viewTargetAndKeyColumns context model = let ( keyFormGroup, targetFormGroup ) = case model.columnMetadata of Remote.Success resp -> let keyGroup = resp.metadata |> Dict.find (\_ m -> m.role == Columns.Key) |> Maybe.map (viewKeyFormGroup << Tuple.second) |> Maybe.withDefault (div [] []) in ( keyGroup, viewTargetFormGroup context model ) Remote.Loading -> ( viewLoadingFormGroup, viewLoadingFormGroup ) _ -> ( div [] [], div [] [] ) in div [ class "form-horizontal" ] [ keyFormGroup , targetFormGroup ] viewLoadingFormGroup : Html Msg viewLoadingFormGroup = div [ class "form-group" ] [ label [ class "control-label col-sm-3 mr0 pr0" ] [ div [ class "loading--line" ] [] ] , div [ class "col-sm-8" ] [ div [ class "loading--line" ] [] ] ] viewKeyFormGroup : ColumnMetadata -> Html Msg viewKeyFormGroup key = div [ class "form-group" ] [ label [ class "control-label col-sm-3 mr0 pr0" ] [ text "Key" ] , div [ class "col-sm-8" ] [ p [ class "mb5", style [ ( "padding", "7px 10px 0;" ) ] ] [ text key.name ] , p [ class "small color-mediumGray" ] [ text "The key role can only be set when importing a new dataset." ] ] ] viewTargetFormGroup : ContextModel -> Model -> Html Msg viewTargetFormGroup context model = if model.showTarget then let queryText = Maybe.withDefault model.targetQuery model.previewTarget in div [ class "form-group" ] [ label [ class "control-label col-sm-3 mr0 pr0" ] (text "Target " :: helpIcon context.config.toolTips "Target") , div [ class "col-sm-8" ] [ input [ type_ "text", class "form-control", value queryText, onInput SetQuery ] [] , viewIf (\() -> div [ class "autocomplete-menu" ] [ Html.map SetAutoCompleteState (Autocomplete.view viewConfig 5 model.autoState (filterColumnNames model.targetQuery model.columnMetadata)) ] ) model.showAutocomplete , viewIf (\() -> viewRemoteError model.saveResult) <| not <| isJust model.columnInEditMode ] ] else div [] [] viewConfig : Autocomplete.ViewConfig ColumnMetadata viewConfig = let customizedLi keySelected mouseSelected person = { attributes = [ classList [ ( "autocomplete-item", True ) , ( "key-selected", keySelected ) , ( "mouse-selected", mouseSelected ) ] ] , children = [ Html.text person.name ] } in Autocomplete.viewConfig { toId = .name , ul = [ class "autocomplete-list" ] , li = customizedLi } filterColumnsToDisplay : ColumnMetadataListing -> List ColumnMetadata filterColumnsToDisplay columnListing = let drop = columnListing.pageSize * columnListing.pageNumber in columnListing.metadata |> Dict.values |> List.drop drop |> List.take columnListing.pageSize config : Dict String String -> StatsDict -> (ColumnMetadata -> Html Msg) -> Maybe ColumnMetadata -> Grid.Config ColumnMetadata Msg config toolTips stats buildEditTable columnInEdit = let makeIcon = helpIcon toolTips columns = [ nameColumn , typeColumn makeIcon |> (\c -> { c | viewData = lockedDropdownCell (\v -> toString v.dataType) }) , roleColumn makeIcon |> (\c -> { c | viewData = lockedDropdownCell (\v -> toString v.role) }) , imputationColumn makeIcon |> (\c -> { c | viewData = stringImputationCell (\v -> toString v.imputation) }) , statsColumn stats , histogramColumn stats ] in Grid.configCustom { toId = \c -> c.name , toMsg = SetTableState , columns = columns |> List.map Grid.veryCustomColumn , customizations = \defaults -> { defaults | rowAttrs = customRowAttributes , rowOverride = rowOverride buildEditTable columnInEdit , tableAttrs = metadataTableAttrs } } editConfig : Dict String String -> StatsDict -> Grid.Config ColumnMetadata Msg editConfig toolTips stats = let makeIcon = helpIcon toolTips columns = [ { nameColumn | sorter = Grid.unsortable } , typeColumn makeIcon , roleColumn makeIcon , imputationColumn makeIcon , statsColumn stats , histogramColumn stats ] in Grid.configCustom { toId = \c -> c.name , toMsg = SetTableState , columns = columns |> List.map Grid.veryCustomColumn , customizations = \defaults -> { defaults | tableAttrs = [ class "table table-striped mb0" ] } } metadataTableAttrs : List (Attribute msg) metadataTableAttrs = [ id "metadata", class "table table-striped" ] rowOverride : (ColumnMetadata -> Html Msg) -> Maybe ColumnMetadata -> ( ColumnMetadata -> Bool, ColumnMetadata -> Html Msg ) rowOverride buildEditTable columnInEdit = case columnInEdit of Just column -> ( \c -> c.name == column.name, \c -> buildEditTable c ) Nothing -> ( \_ -> False, \_ -> div [] [] ) lockedDropdownCell : (ColumnMetadata -> String) -> ColumnMetadata -> Grid.HtmlDetails Msg lockedDropdownCell getValue column = if column.role == Key then if getValue column == "Key" then Grid.HtmlDetails [ class "form-group" ] [ select [ disabled True, class "form-control" ] [ option [] [ text "Key" ] ] ] else emptyDropdown else Grid.HtmlDetails [ class "form-group" ] [ select [ class "form-control" , Html.Events.onWithOptions "mousedown" { preventDefault = True , stopPropagation = False } (Decode.succeed NoOpMsg) ] [ option [] [ text <| getValue column ] ] ] stringImputationCell : (ColumnMetadata -> String) -> ColumnMetadata -> Grid.HtmlDetails Msg stringImputationCell getValue column = if column.dataType == Text then naDropdown else lockedDropdownCell getValue column customRowAttributes : ColumnMetadata -> List (Attribute Msg) customRowAttributes column = if column.role == Key then [ id "key" ] else [ id <| String.classify <| "column_" ++ column.name, onClick <| SelectColumnForEdit column ] type alias ColumnDisplayProperties = { headAttributes : List (Attribute Msg) , headHtml : List (Html Msg) , name : String , sorter : Grid.Sorter ColumnMetadata , viewData : ColumnMetadata -> Grid.HtmlDetails Msg } nameColumn : ColumnDisplayProperties nameColumn = { name = "<NAME> Name" , viewData = \c -> Grid.HtmlDetails [ class "name" ] [ text <| formatDisplayName c.name ] , sorter = Grid.increasingOrDecreasingBy (\c -> c.name) , headAttributes = [ class "left per30" ] , headHtml = [] } typeColumn : (String -> List (Html Msg)) -> ColumnDisplayProperties typeColumn makeIcon = { name = "Type" , viewData = dataTypeCell , sorter = Grid.unsortable , headAttributes = [ class "per10" ] , headHtml = text "Type " :: makeIcon "Type" } dataTypeCell : ColumnMetadata -> Grid.HtmlDetails Msg dataTypeCell column = Grid.HtmlDetails [ class "form-group" ] [ UnionSelect.fromSelected [ class "form-control" ] enumDataType TypeSelectionChanged column.dataType ] emptyDropdown : Grid.HtmlDetails Msg emptyDropdown = Grid.HtmlDetails [ class "form-group" ] [ select [ disabled True, class "form-control" ] [] ] naDropdown : Grid.HtmlDetails Msg naDropdown = Grid.HtmlDetails [ class "form-group color-mediumGray" ] [ text "N/A" ] roleColumn : (String -> List (Html Msg)) -> ColumnDisplayProperties roleColumn makeIcon = { name = "Role" , viewData = roleCell , sorter = Grid.unsortable , headAttributes = [ class "per10" ] , headHtml = text "Role " :: makeIcon "Role" } roleCell : ColumnMetadata -> Grid.HtmlDetails Msg roleCell column = Grid.HtmlDetails [ class "form-group" ] [ UnionSelect.fromSelected [ class "form-control" ] enumRole RoleSelectionChanged column.role ] imputationColumn : (String -> List (Html Msg)) -> ColumnDisplayProperties imputationColumn makeIcon = { name = "Imputation" , viewData = imputationCell , sorter = Grid.unsortable , headAttributes = [ class "per10" ] , headHtml = text "Imputation " :: makeIcon "Imputation" } imputationCell : ColumnMetadata -> Grid.HtmlDetails Msg imputationCell column = if column.dataType == Text then naDropdown else Grid.HtmlDetails [ class "form-group" ] [ UnionSelect.fromSelected [ class "form-control" ] enumImputationStrategy ImputationSelectionChanged column.imputation ] statsColumn : StatsDict -> ColumnDisplayProperties statsColumn stats = { name = "Stats" , viewData = statsCell stats , sorter = Grid.unsortable , headAttributes = [ class "per25" ] , headHtml = [] } statsCell : StatsDict -> ColumnMetadata -> Grid.HtmlDetails Msg statsCell stats column = if column.role == Key then Grid.HtmlDetails [ class "stats" ] [ div [ class "row m0" ] [ div [ class "col-xs-6 pl0 pr0" ] [ text "N/A" ] , div [ class "col-xs-6 pl0 pr0" ] [ text "N/A" ] ] ] else let columnStat = Dict.get column.name stats statsClass = columnStat |> Maybe.map (\s -> s |> Remote.map (\_ -> "stats") |> Remote.withDefault "stats loading") |> Maybe.withDefault "stats loading" columnStats = columnStat |> Maybe.withDefault Remote.Loading |> Remote.map (\s -> ( s, column.dataType )) in Grid.HtmlDetails [ class statsClass ] [ statsDisplay columnStats ] statsDisplay : Remote.WebData ( ColumnStats, DataType ) -> Html Msg statsDisplay columnStats = case columnStats of Remote.Loading -> div [ class "row m0" ] [ div [ class "col-xs-6 pl0 pr0" ] [ i [ class "fa fa-refresh fa-spin fa-fw" ] [] , span [ class "sr-only" ] [ text "Calculating..." ] ] , div [ class "col-xs-6 pl0 pr0" ] [ i [ class "fa fa-refresh fa-spin fa-fw" ] [] , span [ class "sr-only" ] [ text "Calculating..." ] ] ] Remote.Success ( stats, dataType ) -> let errorStyle = if stats.errorCount == 0 then "" else if (toFloat stats.errorCount / toFloat stats.totalCount) * 100 < 10 then "text-danger" else "label label-danger" missingStyle = if stats.missingCount == 0 then "" else if (toFloat stats.missingCount / toFloat stats.totalCount) * 100 < 10 then "text-danger" else "label label-danger" min = [ strong [] [ text "Min: " ] , styledNumber <| stats.min ] max = [ strong [] [ text "Max: " ] , styledNumber <| stats.max ] count = [ strong [] [ text "Count: " ] , styledNumber <| commaFormatInteger stats.totalCount ] missing = [ span [ class missingStyle ] [ strong [] [ text "# Missing: " ] , styledNumber <| commaFormatInteger stats.missingCount ] ] mean = [ strong [] [ text "Mean: " ] , styledNumber <| formatFloatToString stats.mean ] mode = [ strong [] [ text "Mode: " ] , styledNumber <| stats.mode ] errors = [ span [ class errorStyle ] [ strong [] [ text "Errors: " ] , styledNumber <| commaFormatInteger stats.errorCount ] ] stdDev = [ strong [] [ text "Std Dev: " ] , styledNumber <| formatFloatToString stats.stddev ] variance = [ strong [] [ text "Variance: " ] , styledNumber <| formatFloatToString stats.variance ] ( statsLeft, statsRight ) = case dataType of String -> [ min, max, count ] => [ missing, mean, mode ] Text -> [ count, missing ] => [] Logical -> [ min, max, mode ] => [ count, errors, missing ] Date -> [ min, max, mode ] => [ count, errors, missing ] Numeric -> [ min, max, stdDev, errors, variance ] => [ count, missing, mean, mode ] Measure -> [ min, max, stdDev, errors, variance ] => [ count, missing, mean, mode ] in div [ class "row m0" ] [ div [ class "col-xs-6 pl0 pr0" ] (statsLeft |> List.intersperse [ br [] [] ] |> List.concat ) , div [ class "col-xs-6 pl0 pr0" ] (statsRight |> List.intersperse [ br [] [] ] |> List.concat ) ] _ -> div [ class "row m0" ] [ div [ class "col-sm-6 pl0 pr0" ] [] , div [ class "col-sm-6 pl0 pr0" ] [] ] histogramColumn : StatsDict -> ColumnDisplayProperties histogramColumn stats = { name = "Distribution" , viewData = histogram stats , sorter = Grid.unsortable , headAttributes = [ class "per15" ] , headHtml = [] } histogram : StatsDict -> ColumnMetadata -> Grid.HtmlDetails Msg histogram stats column = if column.role == Key then Grid.HtmlDetails [ class "stats" ] [ text "N/A" ] else let columnStats = stats |> Dict.get column.name |> Maybe.withDefault Remote.Loading in case columnStats of Remote.Loading -> Grid.HtmlDetails [ class "loading" ] [ i [ class "fa fa-refresh fa-spin fa-fw" ] [] , span [ class "sr-only" ] [ text "Calculating..." ] ] Remote.Success stats -> if column.dataType == Text then Grid.HtmlDetails [ class "distribution text" ] [ stats.distribution |> wordOccurrenceTable ] else Grid.HtmlDetails [] [ stats.distribution |> distributionHistogram ] _ -> Grid.HtmlDetails [] [ div [] [] ]
true
module View.ColumnMetadataEditor exposing (ExternalMsg(..), Model, Msg, init, subscriptions, update, updateDataSetResponse, view, viewTargetAndKeyColumns) import Autocomplete import Char import Data.Columns as Columns exposing (enumDataType, enumRole) import Data.Context exposing (ContextModel, contextToAuth, setPageSize) import Data.ImputationStrategy exposing (enumImputationStrategy) import Dict exposing (Dict) import Dict.Extra as Dict import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onFocus, onInput) import Http import Json.Decode as Decode import Nexosis.Api.Data import Nexosis.Types.Columns as Columns exposing (ColumnMetadata, ColumnStats, ColumnStatsDict, DataType(..), Role(..)) import Nexosis.Types.DataSet as DataSet exposing (DataSetData, DataSetName, DataSetStats, toDataSetName) import Nexosis.Types.ImputationStrategy exposing (ImputationStrategy(..)) import Nexosis.Types.SortParameters exposing (SortDirection(..), SortParameters) import Ports import RemoteData as Remote import Request.Log exposing (logHttpError) import SelectWithStyle as UnionSelect import StateStorage exposing (saveAppState) import String.Extra as String import Task import Util exposing ((=>), commaFormatInteger, delayTask, formatDisplayName, formatFloatToString, isJust, spinner, styledNumber) import VegaLite exposing (Spec, combineSpecs) import View.Charts exposing (distributionHistogram, wordOccurrenceTable) import View.Error exposing (viewRemoteError) import View.Extra exposing (viewIf) import View.Grid as Grid exposing (defaultCustomizations) import View.PageSize as PageSize import View.Pager as Pager import View.Tooltip exposing (helpIcon) type alias Model = { columnMetadata : Remote.WebData ColumnMetadataListing , statsResponse : Dict String (Remote.WebData ColumnStats) , dataSetName : DataSetName , tableState : Grid.State , modifiedMetadata : Dict String ColumnMetadata , changesPendingSave : Dict String ColumnMetadata , autoState : Autocomplete.State , targetQuery : String , previewTarget : Maybe String , showAutocomplete : Bool , showTarget : Bool , columnInEditMode : Maybe ColumnMetadata , saveResult : Remote.WebData () } type ExternalMsg = NoOp | Updated (List ColumnMetadata) type alias ColumnMetadataListing = { pageNumber : Int , totalPages : Int , pageSize : Int , totalCount : Int , metadata : Dict String ColumnMetadata } type Msg = StatsResponse (Remote.WebData DataSetStats) | SingleStatsResponse String (Remote.WebData DataSetStats) | SetTableState Grid.State | ChangePage Int | ChangePageSize Int | TypeSelectionChanged DataType | RoleSelectionChanged Role | ImputationSelectionChanged ImputationStrategy | SetAutoCompleteState Autocomplete.Msg | SetTarget String | SetQuery String | PreviewTarget String | AutocompleteWrap Bool | AutocompleteReset | SelectColumnForEdit ColumnMetadata | CancelColumnEdit | CommitMetadataChange | NoOpMsg | SaveMetadata (Remote.WebData ()) type alias StatsDict = Dict String (Remote.WebData ColumnStats) init : DataSetName -> Bool -> ( Model, Cmd Msg ) init dataSetName showTarget = Model Remote.Loading Dict.empty dataSetName (Grid.initialSort "columnName" Ascending) Dict.empty Dict.empty Autocomplete.empty "" Nothing False showTarget Nothing Remote.NotAsked => Cmd.none mapColumnListToPagedListing : ContextModel -> List ColumnMetadata -> ColumnMetadataListing mapColumnListToPagedListing context columns = let count = List.length columns pageSize = context.localStorage.userPageSize in { pageNumber = 0 , totalPages = calcTotalPages count pageSize , pageSize = pageSize , totalCount = count , metadata = Dict.fromListBy .name columns } calcTotalPages : Int -> Int -> Int calcTotalPages count pageSize = (count + pageSize - 1) // pageSize updateDataSetResponse : ContextModel -> Model -> Remote.WebData DataSetData -> ( Model, Cmd Msg ) updateDataSetResponse context model dataSetResponse = let mappedColumns = Remote.map (.columns >> mapColumnListToPagedListing context) dataSetResponse targetName = mappedColumns |> Remote.map .metadata |> Remote.withDefault Dict.empty |> Dict.find (\_ m -> m.role == Columns.Target) |> Maybe.map Tuple.first |> Maybe.withDefault "" in { model | columnMetadata = mappedColumns, targetQuery = targetName, showAutocomplete = False } => (Nexosis.Api.Data.getStats (contextToAuth context) model.dataSetName |> Remote.sendRequest |> Cmd.map StatsResponse ) delayAndRecheckStats : ContextModel -> DataSetName -> Cmd Msg delayAndRecheckStats context dataSetName = delayTask 20 |> Task.andThen (\_ -> Nexosis.Api.Data.getStats (contextToAuth context) dataSetName |> Http.toTask) |> Remote.asCmd |> Cmd.map StatsResponse update : Msg -> Model -> ContextModel -> (List ColumnMetadata -> Cmd (Remote.WebData ())) -> ( ( Model, Cmd Msg ), ExternalMsg ) update msg model context pendingSaveCommand = case msg of StatsResponse resp -> case resp of Remote.Success s -> let stats = s.columns |> Dict.map (\_ columnStats -> Remote.succeed columnStats) allMetadata = model.columnMetadata |> Remote.map (\m -> m.metadata |> Dict.values |> List.filter (\c -> c.role /= Key) |> List.length ) |> Remote.withDefault 0 reFetchStats = if Dict.size stats < allMetadata then delayAndRecheckStats context model.dataSetName else Cmd.none in { model | statsResponse = stats } => reFetchStats => NoOp Remote.Failure err -> model => logHttpError err => NoOp _ -> model => Cmd.none => NoOp SingleStatsResponse columnName resp -> case resp of Remote.Success { columns } -> let updatedStats = columns |> Dict.map (\_ columnStats -> Remote.succeed columnStats) |> flip Dict.union model.statsResponse in { model | statsResponse = updatedStats } => Cmd.none => NoOp Remote.Failure err -> { model | statsResponse = Dict.insert columnName (Remote.Failure err) model.statsResponse } => Cmd.none => NoOp _ -> model => Cmd.none => NoOp SetTableState newState -> { model | tableState = newState } => Cmd.none => NoOp ChangePage pageNumber -> let ( columnListing, cmd ) = Remote.update (updateColumnPageNumber pageNumber) model.columnMetadata in { model | columnMetadata = columnListing } => cmd => NoOp ChangePageSize pageSize -> let ( columnListing, cmd ) = Remote.update (updateColumnPageSize pageSize) model.columnMetadata in { model | columnMetadata = columnListing } => Cmd.batch [ StateStorage.saveAppState <| setPageSize context pageSize, cmd ] => NoOp RoleSelectionChanged selection -> { model | columnInEditMode = model.columnInEditMode |> Maybe.map (updateRole selection) } => Cmd.none => NoOp TypeSelectionChanged selection -> { model | columnInEditMode = model.columnInEditMode |> Maybe.map (updateDataType selection) } => Cmd.none => NoOp ImputationSelectionChanged selection -> { model | columnInEditMode = model.columnInEditMode |> Maybe.map (updateImputation selection) } => Cmd.none => NoOp CommitMetadataChange -> updateMetadata model model.columnInEditMode pendingSaveCommand SetQuery query -> let showAutocomplete = not << List.isEmpty <| filterColumnNames query model.columnMetadata in { model | targetQuery = query, showAutocomplete = showAutocomplete } => Cmd.none => NoOp SetAutoCompleteState autoMsg -> let ( newState, maybeMsg ) = Autocomplete.update autocompleteUpdateConfig autoMsg 5 model.autoState (filterColumnNames model.targetQuery model.columnMetadata) newModel = { model | autoState = newState } in case maybeMsg of Nothing -> newModel => Cmd.none => NoOp Just updateMsg -> update updateMsg newModel context pendingSaveCommand PreviewTarget targetName -> { model | previewTarget = Just targetName } => Cmd.none => NoOp AutocompleteWrap toTop -> case model.previewTarget of Just target -> update AutocompleteReset model context pendingSaveCommand Nothing -> if toTop then { model | autoState = Autocomplete.resetToLastItem autocompleteUpdateConfig (filterColumnNames model.targetQuery model.columnMetadata) 5 model.autoState , previewTarget = Maybe.map .name <| List.head <| List.reverse <| List.take 5 <| filterColumnNames model.targetQuery model.columnMetadata } => Cmd.none => NoOp else { model | autoState = Autocomplete.resetToFirstItem autocompleteUpdateConfig (filterColumnNames model.targetQuery model.columnMetadata) 5 model.autoState , previewTarget = Maybe.map .name <| List.head <| List.take 5 <| filterColumnNames model.targetQuery model.columnMetadata } => Cmd.none => NoOp AutocompleteReset -> { model | autoState = Autocomplete.reset autocompleteUpdateConfig model.autoState, previewTarget = Nothing } => Cmd.none => NoOp SetTarget targetName -> let newTarget = model.columnMetadata |> Remote.map (\cm -> cm.metadata |> Dict.get targetName |> Maybe.map (updateRole Target) ) |> Remote.withDefault Nothing in updateMetadata model newTarget pendingSaveCommand SelectColumnForEdit column -> { model | columnInEditMode = Just column, saveResult = Remote.NotAsked } => Cmd.none => NoOp CancelColumnEdit -> { model | columnInEditMode = Nothing, changesPendingSave = Dict.empty, saveResult = Remote.NotAsked } => Cmd.none => NoOp NoOpMsg -> model => Cmd.none => NoOp SaveMetadata result -> if Remote.isSuccess result then let columnsWithNewDataType = model.changesPendingSave |> Dict.values |> List.filter (\c -> model.columnMetadata |> Remote.map (\cm -> cm.metadata) |> Remote.withDefault Dict.empty |> Dict.union model.modifiedMetadata |> Dict.get c.name |> Maybe.map (\old -> old.dataType /= c.dataType) |> Maybe.withDefault False ) statsBeingRequested = columnsWithNewDataType |> List.map (\c -> ( c.name, Remote.Loading )) |> Dict.fromList |> flip Dict.union model.statsResponse modifiedMetadata = Dict.union model.changesPendingSave model.modifiedMetadata in { model | modifiedMetadata = modifiedMetadata, changesPendingSave = Dict.empty, saveResult = result, columnInEditMode = Nothing, showAutocomplete = False, previewTarget = Nothing, statsResponse = statsBeingRequested } => Cmd.batch (Ports.highlightIds (model.changesPendingSave |> Dict.keys |> List.map (\c -> "column_" ++ c |> String.classify)) :: List.map (\c -> Nexosis.Api.Data.getStatsForColumn (contextToAuth context) model.dataSetName c.name c.dataType |> Remote.sendRequest |> Cmd.map (SingleStatsResponse c.name) ) columnsWithNewDataType ) => Updated (Dict.values modifiedMetadata) else { model | saveResult = result } => Cmd.none => NoOp updateMetadata : Model -> Maybe ColumnMetadata -> (List ColumnMetadata -> Cmd (Remote.WebData ())) -> ( ( Model, Cmd Msg ), ExternalMsg ) updateMetadata model updatedColumn saveCommand = let existingColumns = model.columnMetadata |> Remote.map .metadata |> Remote.withDefault Dict.empty ensureSingleTarget newColumn = if newColumn.role == Target then existingColumns |> Dict.union model.modifiedMetadata |> Dict.find (\_ c -> c.role == Target) |> Maybe.map (\( _, oldTarget ) -> Just [ updateRole Feature oldTarget, newColumn ]) |> Maybe.withDefault (Just [ newColumn ]) else Just [ newColumn ] changedMetadata = updatedColumn |> Maybe.andThen ensureSingleTarget |> Maybe.withDefault [] |> Dict.fromListBy .name modifiedMetadata = Dict.intersect model.modifiedMetadata existingColumns |> Dict.union changedMetadata targetName = existingColumns |> Dict.union modifiedMetadata |> Dict.find (\_ c -> c.role == Target) |> Maybe.map (\( _, c ) -> c.name) |> Maybe.withDefault "" in if modifiedMetadata /= Dict.empty then { model | changesPendingSave = changedMetadata, targetQuery = targetName, saveResult = Remote.Loading } => Cmd.map SaveMetadata (saveCommand <| Dict.values changedMetadata) => NoOp else { model | modifiedMetadata = modifiedMetadata, columnInEditMode = Nothing, targetQuery = targetName, saveResult = Remote.NotAsked, showAutocomplete = False, previewTarget = Nothing } => Cmd.none => NoOp subscriptions : Model -> Sub Msg subscriptions model = Autocomplete.subscription |> Sub.map SetAutoCompleteState filterColumnNames : String -> Remote.WebData ColumnMetadataListing -> List ColumnMetadata filterColumnNames query columnMetadata = let columns = columnMetadata |> Remote.map (\cm -> Dict.values cm.metadata) |> Remote.withDefault [] lowerQuery = String.toLower query in List.filter (String.contains lowerQuery << String.toLower << .name) columns onKeyDown : Char.KeyCode -> Maybe String -> Maybe Msg onKeyDown code maybeId = if code == 38 || code == 40 then -- up & down arrows Maybe.map PreviewTarget maybeId else if code == 13 || code == 9 then -- enter & tab Maybe.map SetTarget maybeId else if code == 27 then --escape Just <| SetQuery "" else Nothing autocompleteUpdateConfig : Autocomplete.UpdateConfig Msg ColumnMetadata autocompleteUpdateConfig = Autocomplete.updateConfig { toId = .name , onKeyDown = onKeyDown , onTooLow = Just <| AutocompleteWrap True , onTooHigh = Just <| AutocompleteWrap False , onMouseEnter = \_ -> Nothing , onMouseLeave = \_ -> Nothing , onMouseClick = \id -> Just <| SetTarget id , separateSelections = False } updateImputation : ImputationStrategy -> ColumnMetadata -> ColumnMetadata updateImputation value column = { column | imputation = value } updateRole : Role -> ColumnMetadata -> ColumnMetadata updateRole value column = { column | role = value } updateDataType : DataType -> ColumnMetadata -> ColumnMetadata updateDataType value column = { column | dataType = value } updateColumnPageNumber : Int -> ColumnMetadataListing -> ( ColumnMetadataListing, Cmd Msg ) updateColumnPageNumber pageNumber columnListing = { columnListing | pageNumber = pageNumber } => Cmd.none updateColumnPageSize : Int -> ColumnMetadataListing -> ( ColumnMetadataListing, Cmd Msg ) updateColumnPageSize pageSize columnListing = { columnListing | pageSize = pageSize, pageNumber = 0, totalPages = calcTotalPages columnListing.totalCount pageSize } => Cmd.none updateColumnMetadata : Dict String ColumnMetadata -> ColumnMetadataListing -> ( ColumnMetadataListing, Cmd msg ) updateColumnMetadata info columnListing = { columnListing | metadata = info } => Cmd.none generateVegaSpec : ColumnMetadata -> ( String, Spec ) generateVegaSpec column = column.name => VegaLite.toVegaLite [ VegaLite.title column.name , VegaLite.dataFromColumns [] <| VegaLite.dataColumn "x" (VegaLite.Numbers [ 10, 20, 30 ]) [] , VegaLite.mark VegaLite.Circle [] , VegaLite.encoding <| VegaLite.position VegaLite.X [ VegaLite.PName "x", VegaLite.PmType VegaLite.Quantitative ] [] ] view : ContextModel -> Model -> Html Msg view context model = let mergedMetadata = model.columnMetadata |> Remote.map (\cm -> let unionedMetadata = cm.metadata |> Dict.union model.modifiedMetadata in { cm | metadata = unionedMetadata } ) editTable = buildEditTable context model.statsResponse model in div [] [ div [ id "pagination-controls", class "row" ] [ div [ class "col-xs-12 col-sm-3 pleft0" ] [ h3 [] [ text "Column metadata" ] ] , div [ class "col-sm-6 p0" ] [ Pager.view model.columnMetadata ChangePage ] , div [ id "view-rows", class "col-sm-2 col-sm-offset-1 right" ] [ PageSize.view ChangePageSize context.localStorage.userPageSize ] ] , div [ class "row mb25", id "list" ] [ Grid.view filterColumnsToDisplay (config context.config.toolTips model.statsResponse editTable model.columnInEditMode) model.tableState mergedMetadata ] , hr [] [] , div [ class "center" ] [ Pager.view model.columnMetadata ChangePage ] ] buildEditTable : ContextModel -> StatsDict -> Model -> ColumnMetadata -> Html Msg buildEditTable context stats model column = let saveButton = case model.saveResult of Remote.Loading -> button [ class "btn btn-danger btn-sm" ] [ spinner ] _ -> button [ class "btn btn-danger btn-sm", onClick CommitMetadataChange ] [ text "Save Changes" ] in tr [ class "modal fade in", style [ ( "display", "table-row" ), ( "position", "static" ) ] ] [ td [ class "p0", colspan 6 ] [ div [ class "modal-dialog modal-content metadata-editor m0", style [ ( "z-index", "1050" ), ( "width", "auto" ) ] ] [ Grid.view identity (editConfig context.config.toolTips stats) Grid.initialUnsorted (Remote.succeed [ column ]) , div [ class "text-left mr10 ml10" ] [ viewRemoteError model.saveResult ] , div [ class "modal-footer" ] [ button [ class "btn btn-link btn-sm", onClick CancelColumnEdit ] [ text "Discard" ] , saveButton ] ] , div [ class "modal-backdrop in", onClick CancelColumnEdit ] [] ] ] viewEditModeOverlay : Maybe ColumnMetadata -> Html Msg viewEditModeOverlay editColumn = if isJust editColumn then div [ class "modal-backdrop in", onClick CancelColumnEdit ] [] else div [] [] viewTargetAndKeyColumns : ContextModel -> Model -> Html Msg viewTargetAndKeyColumns context model = let ( keyFormGroup, targetFormGroup ) = case model.columnMetadata of Remote.Success resp -> let keyGroup = resp.metadata |> Dict.find (\_ m -> m.role == Columns.Key) |> Maybe.map (viewKeyFormGroup << Tuple.second) |> Maybe.withDefault (div [] []) in ( keyGroup, viewTargetFormGroup context model ) Remote.Loading -> ( viewLoadingFormGroup, viewLoadingFormGroup ) _ -> ( div [] [], div [] [] ) in div [ class "form-horizontal" ] [ keyFormGroup , targetFormGroup ] viewLoadingFormGroup : Html Msg viewLoadingFormGroup = div [ class "form-group" ] [ label [ class "control-label col-sm-3 mr0 pr0" ] [ div [ class "loading--line" ] [] ] , div [ class "col-sm-8" ] [ div [ class "loading--line" ] [] ] ] viewKeyFormGroup : ColumnMetadata -> Html Msg viewKeyFormGroup key = div [ class "form-group" ] [ label [ class "control-label col-sm-3 mr0 pr0" ] [ text "Key" ] , div [ class "col-sm-8" ] [ p [ class "mb5", style [ ( "padding", "7px 10px 0;" ) ] ] [ text key.name ] , p [ class "small color-mediumGray" ] [ text "The key role can only be set when importing a new dataset." ] ] ] viewTargetFormGroup : ContextModel -> Model -> Html Msg viewTargetFormGroup context model = if model.showTarget then let queryText = Maybe.withDefault model.targetQuery model.previewTarget in div [ class "form-group" ] [ label [ class "control-label col-sm-3 mr0 pr0" ] (text "Target " :: helpIcon context.config.toolTips "Target") , div [ class "col-sm-8" ] [ input [ type_ "text", class "form-control", value queryText, onInput SetQuery ] [] , viewIf (\() -> div [ class "autocomplete-menu" ] [ Html.map SetAutoCompleteState (Autocomplete.view viewConfig 5 model.autoState (filterColumnNames model.targetQuery model.columnMetadata)) ] ) model.showAutocomplete , viewIf (\() -> viewRemoteError model.saveResult) <| not <| isJust model.columnInEditMode ] ] else div [] [] viewConfig : Autocomplete.ViewConfig ColumnMetadata viewConfig = let customizedLi keySelected mouseSelected person = { attributes = [ classList [ ( "autocomplete-item", True ) , ( "key-selected", keySelected ) , ( "mouse-selected", mouseSelected ) ] ] , children = [ Html.text person.name ] } in Autocomplete.viewConfig { toId = .name , ul = [ class "autocomplete-list" ] , li = customizedLi } filterColumnsToDisplay : ColumnMetadataListing -> List ColumnMetadata filterColumnsToDisplay columnListing = let drop = columnListing.pageSize * columnListing.pageNumber in columnListing.metadata |> Dict.values |> List.drop drop |> List.take columnListing.pageSize config : Dict String String -> StatsDict -> (ColumnMetadata -> Html Msg) -> Maybe ColumnMetadata -> Grid.Config ColumnMetadata Msg config toolTips stats buildEditTable columnInEdit = let makeIcon = helpIcon toolTips columns = [ nameColumn , typeColumn makeIcon |> (\c -> { c | viewData = lockedDropdownCell (\v -> toString v.dataType) }) , roleColumn makeIcon |> (\c -> { c | viewData = lockedDropdownCell (\v -> toString v.role) }) , imputationColumn makeIcon |> (\c -> { c | viewData = stringImputationCell (\v -> toString v.imputation) }) , statsColumn stats , histogramColumn stats ] in Grid.configCustom { toId = \c -> c.name , toMsg = SetTableState , columns = columns |> List.map Grid.veryCustomColumn , customizations = \defaults -> { defaults | rowAttrs = customRowAttributes , rowOverride = rowOverride buildEditTable columnInEdit , tableAttrs = metadataTableAttrs } } editConfig : Dict String String -> StatsDict -> Grid.Config ColumnMetadata Msg editConfig toolTips stats = let makeIcon = helpIcon toolTips columns = [ { nameColumn | sorter = Grid.unsortable } , typeColumn makeIcon , roleColumn makeIcon , imputationColumn makeIcon , statsColumn stats , histogramColumn stats ] in Grid.configCustom { toId = \c -> c.name , toMsg = SetTableState , columns = columns |> List.map Grid.veryCustomColumn , customizations = \defaults -> { defaults | tableAttrs = [ class "table table-striped mb0" ] } } metadataTableAttrs : List (Attribute msg) metadataTableAttrs = [ id "metadata", class "table table-striped" ] rowOverride : (ColumnMetadata -> Html Msg) -> Maybe ColumnMetadata -> ( ColumnMetadata -> Bool, ColumnMetadata -> Html Msg ) rowOverride buildEditTable columnInEdit = case columnInEdit of Just column -> ( \c -> c.name == column.name, \c -> buildEditTable c ) Nothing -> ( \_ -> False, \_ -> div [] [] ) lockedDropdownCell : (ColumnMetadata -> String) -> ColumnMetadata -> Grid.HtmlDetails Msg lockedDropdownCell getValue column = if column.role == Key then if getValue column == "Key" then Grid.HtmlDetails [ class "form-group" ] [ select [ disabled True, class "form-control" ] [ option [] [ text "Key" ] ] ] else emptyDropdown else Grid.HtmlDetails [ class "form-group" ] [ select [ class "form-control" , Html.Events.onWithOptions "mousedown" { preventDefault = True , stopPropagation = False } (Decode.succeed NoOpMsg) ] [ option [] [ text <| getValue column ] ] ] stringImputationCell : (ColumnMetadata -> String) -> ColumnMetadata -> Grid.HtmlDetails Msg stringImputationCell getValue column = if column.dataType == Text then naDropdown else lockedDropdownCell getValue column customRowAttributes : ColumnMetadata -> List (Attribute Msg) customRowAttributes column = if column.role == Key then [ id "key" ] else [ id <| String.classify <| "column_" ++ column.name, onClick <| SelectColumnForEdit column ] type alias ColumnDisplayProperties = { headAttributes : List (Attribute Msg) , headHtml : List (Html Msg) , name : String , sorter : Grid.Sorter ColumnMetadata , viewData : ColumnMetadata -> Grid.HtmlDetails Msg } nameColumn : ColumnDisplayProperties nameColumn = { name = "PI:NAME:<NAME>END_PI Name" , viewData = \c -> Grid.HtmlDetails [ class "name" ] [ text <| formatDisplayName c.name ] , sorter = Grid.increasingOrDecreasingBy (\c -> c.name) , headAttributes = [ class "left per30" ] , headHtml = [] } typeColumn : (String -> List (Html Msg)) -> ColumnDisplayProperties typeColumn makeIcon = { name = "Type" , viewData = dataTypeCell , sorter = Grid.unsortable , headAttributes = [ class "per10" ] , headHtml = text "Type " :: makeIcon "Type" } dataTypeCell : ColumnMetadata -> Grid.HtmlDetails Msg dataTypeCell column = Grid.HtmlDetails [ class "form-group" ] [ UnionSelect.fromSelected [ class "form-control" ] enumDataType TypeSelectionChanged column.dataType ] emptyDropdown : Grid.HtmlDetails Msg emptyDropdown = Grid.HtmlDetails [ class "form-group" ] [ select [ disabled True, class "form-control" ] [] ] naDropdown : Grid.HtmlDetails Msg naDropdown = Grid.HtmlDetails [ class "form-group color-mediumGray" ] [ text "N/A" ] roleColumn : (String -> List (Html Msg)) -> ColumnDisplayProperties roleColumn makeIcon = { name = "Role" , viewData = roleCell , sorter = Grid.unsortable , headAttributes = [ class "per10" ] , headHtml = text "Role " :: makeIcon "Role" } roleCell : ColumnMetadata -> Grid.HtmlDetails Msg roleCell column = Grid.HtmlDetails [ class "form-group" ] [ UnionSelect.fromSelected [ class "form-control" ] enumRole RoleSelectionChanged column.role ] imputationColumn : (String -> List (Html Msg)) -> ColumnDisplayProperties imputationColumn makeIcon = { name = "Imputation" , viewData = imputationCell , sorter = Grid.unsortable , headAttributes = [ class "per10" ] , headHtml = text "Imputation " :: makeIcon "Imputation" } imputationCell : ColumnMetadata -> Grid.HtmlDetails Msg imputationCell column = if column.dataType == Text then naDropdown else Grid.HtmlDetails [ class "form-group" ] [ UnionSelect.fromSelected [ class "form-control" ] enumImputationStrategy ImputationSelectionChanged column.imputation ] statsColumn : StatsDict -> ColumnDisplayProperties statsColumn stats = { name = "Stats" , viewData = statsCell stats , sorter = Grid.unsortable , headAttributes = [ class "per25" ] , headHtml = [] } statsCell : StatsDict -> ColumnMetadata -> Grid.HtmlDetails Msg statsCell stats column = if column.role == Key then Grid.HtmlDetails [ class "stats" ] [ div [ class "row m0" ] [ div [ class "col-xs-6 pl0 pr0" ] [ text "N/A" ] , div [ class "col-xs-6 pl0 pr0" ] [ text "N/A" ] ] ] else let columnStat = Dict.get column.name stats statsClass = columnStat |> Maybe.map (\s -> s |> Remote.map (\_ -> "stats") |> Remote.withDefault "stats loading") |> Maybe.withDefault "stats loading" columnStats = columnStat |> Maybe.withDefault Remote.Loading |> Remote.map (\s -> ( s, column.dataType )) in Grid.HtmlDetails [ class statsClass ] [ statsDisplay columnStats ] statsDisplay : Remote.WebData ( ColumnStats, DataType ) -> Html Msg statsDisplay columnStats = case columnStats of Remote.Loading -> div [ class "row m0" ] [ div [ class "col-xs-6 pl0 pr0" ] [ i [ class "fa fa-refresh fa-spin fa-fw" ] [] , span [ class "sr-only" ] [ text "Calculating..." ] ] , div [ class "col-xs-6 pl0 pr0" ] [ i [ class "fa fa-refresh fa-spin fa-fw" ] [] , span [ class "sr-only" ] [ text "Calculating..." ] ] ] Remote.Success ( stats, dataType ) -> let errorStyle = if stats.errorCount == 0 then "" else if (toFloat stats.errorCount / toFloat stats.totalCount) * 100 < 10 then "text-danger" else "label label-danger" missingStyle = if stats.missingCount == 0 then "" else if (toFloat stats.missingCount / toFloat stats.totalCount) * 100 < 10 then "text-danger" else "label label-danger" min = [ strong [] [ text "Min: " ] , styledNumber <| stats.min ] max = [ strong [] [ text "Max: " ] , styledNumber <| stats.max ] count = [ strong [] [ text "Count: " ] , styledNumber <| commaFormatInteger stats.totalCount ] missing = [ span [ class missingStyle ] [ strong [] [ text "# Missing: " ] , styledNumber <| commaFormatInteger stats.missingCount ] ] mean = [ strong [] [ text "Mean: " ] , styledNumber <| formatFloatToString stats.mean ] mode = [ strong [] [ text "Mode: " ] , styledNumber <| stats.mode ] errors = [ span [ class errorStyle ] [ strong [] [ text "Errors: " ] , styledNumber <| commaFormatInteger stats.errorCount ] ] stdDev = [ strong [] [ text "Std Dev: " ] , styledNumber <| formatFloatToString stats.stddev ] variance = [ strong [] [ text "Variance: " ] , styledNumber <| formatFloatToString stats.variance ] ( statsLeft, statsRight ) = case dataType of String -> [ min, max, count ] => [ missing, mean, mode ] Text -> [ count, missing ] => [] Logical -> [ min, max, mode ] => [ count, errors, missing ] Date -> [ min, max, mode ] => [ count, errors, missing ] Numeric -> [ min, max, stdDev, errors, variance ] => [ count, missing, mean, mode ] Measure -> [ min, max, stdDev, errors, variance ] => [ count, missing, mean, mode ] in div [ class "row m0" ] [ div [ class "col-xs-6 pl0 pr0" ] (statsLeft |> List.intersperse [ br [] [] ] |> List.concat ) , div [ class "col-xs-6 pl0 pr0" ] (statsRight |> List.intersperse [ br [] [] ] |> List.concat ) ] _ -> div [ class "row m0" ] [ div [ class "col-sm-6 pl0 pr0" ] [] , div [ class "col-sm-6 pl0 pr0" ] [] ] histogramColumn : StatsDict -> ColumnDisplayProperties histogramColumn stats = { name = "Distribution" , viewData = histogram stats , sorter = Grid.unsortable , headAttributes = [ class "per15" ] , headHtml = [] } histogram : StatsDict -> ColumnMetadata -> Grid.HtmlDetails Msg histogram stats column = if column.role == Key then Grid.HtmlDetails [ class "stats" ] [ text "N/A" ] else let columnStats = stats |> Dict.get column.name |> Maybe.withDefault Remote.Loading in case columnStats of Remote.Loading -> Grid.HtmlDetails [ class "loading" ] [ i [ class "fa fa-refresh fa-spin fa-fw" ] [] , span [ class "sr-only" ] [ text "Calculating..." ] ] Remote.Success stats -> if column.dataType == Text then Grid.HtmlDetails [ class "distribution text" ] [ stats.distribution |> wordOccurrenceTable ] else Grid.HtmlDetails [] [ stats.distribution |> distributionHistogram ] _ -> Grid.HtmlDetails [] [ div [] [] ]
elm
[ { "context": "ck;\n margin-top: 1em;\n}\n\"\"\"\n\nparticipants = [\n \"John Doe\",\n \"Mam Butterfly\",\n \"Mysterious Man\"\n ]\n\nchoi", "end": 3331, "score": 0.999779284, "start": 3323, "tag": "NAME", "value": "John Doe" }, { "context": "op: 1em;\n}\n\"\"\"\n\nparticipants = [\n \"John Doe\",\n \"Mam Butterfly\",\n \"Mysterious Man\"\n ]\n\nchoix = [\n [0, 0, True", "end": 3350, "score": 0.9998777509, "start": 3337, "tag": "NAME", "value": "Mam Butterfly" }, { "context": "ticipants = [\n \"John Doe\",\n \"Mam Butterfly\",\n \"Mysterious Man\"\n ]\n\nchoix = [\n [0, 0, True ],\n [0, 1, False],", "end": 3370, "score": 0.9995441437, "start": 3356, "tag": "NAME", "value": "Mysterious Man" }, { "context": "=\"pname\" maxlength=\"64\" name =\"name\" placeholder=\"Your name\"\n onkeypress=\"\"\"if(event.keyCode == 1", "end": 6712, "score": 0.7042676806, "start": 6703, "tag": "NAME", "value": "Your name" }, { "context": "@page\n <a contenteditable=\"False\" href=\"\"\"mailto:pizzaiolo@@gmail.com?subject=Pizzas for @date&body=@(urlencode sms)\"\"\"", "end": 7932, "score": 0.9995583296, "start": 7912, "tag": "EMAIL", "value": "pizzaiolo@@gmail.com" } ]
examples/fromleo/pizzas_doodle.elm
digitalsatori/sketch-n-sketch
565
{join} = String {matchIn} = Regex {indices, map, find} = List { onChangeAttribute } = Html css = """ .partTableCell{ cursor:pointer; } .partTableCell:hover{ outline: 1px solid black; } .hiddenAcc{ display:block; position:absolute; top:-999em; } .form-control, textarea, select, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input{ height:30px; padding-top:4px; padding-bottom:4px; border-radius:0; border-color:#b7b7b7; font-size:13px; } .textPoll th, .textPoll .foot td{ max-width:94px; } label{ font-weight:normal; } label{ display:inline-block; margin-bottom:5px; font-weight:bold; } table.poll tr.participation td { text-align:center; background-color:#ffffff; } table.poll tr.participant td.n { background-color:#ffccca; } table.poll tr.participant td.y { background-color:#d1f3d1; } table.poll tr.participant td { text-align:center; vertical-align:middle; height:33px; } table.poll tr.participation.inEdit td:hover{ background-color:#d6d6d6; } table.poll tr.participation td.pname,table.poll tr.participant td.pname{ position:relative; min-width:182px; width:182px; border-top:1px solid #fff; border-bottom:2px solid #fff; background:url('http://doodle.com/builtstatic/1465286543/doodle/graphics/sprites/common/normal-s92f91c2182.png') -15px -972px no-repeat #fff; imageRendering:-moz-crisp-edges; imageRendering:-o-crisp-edges; imageRendering:-webkit-optimize-contrast; imageRendering:crisp-edges; -ms-interpolation-mode:nearest-neighbor; padding:0 2px 0 0; } table.poll tr.header.month th.xsep{ background:url("http://doodle.com/graphics/polls/tick31r.png") right 0 repeat-y #3385e4; padding-right:13px; } table.poll td.pname div.pname{ text-align:left; font-size:15px; line-height:15px; padding:8px 0 5px 0; margin-left:3px; white-space:nowrap; overflow:hidden; max-width:135px; width:135px; position:relative; } table.poll tr.date th, table.poll tr.date td{ background:#3385e4; color:#fff; } table.poll{ border-collapse:separate; } table.poll tr.date.month th{ padding-top:7px; padding-bottom:3px; } table.poll tr.header th, table.poll tr.header td{ padding:0 10px 0; } table.poll th, table.poll td{ font-size:13px; line-height:17px; font-weight:normal; } table.poll tr.participation td.pname input{ font-size:12px; height:24px; line-height:20px; margin:3px 0 3px 3px; width:131px; padding:2px 6px 2px 9px; } table.poll tr th.nonHeader.partCount, table.poll tr td.partCount{ background:#fff; padding:0 0 9px 0; vertical-align:bottom; font-size:13px; color:#323232; min-width:184px; width:184px; font-weight:bold; max-width:none; } table.poll tr.sums td{ text-align:center; line-height:16px; padding-left:5px; padding-right:8px; padding-top:5px; color:#6f6f6f; } table.poll tr.participant td.q { background-color:#eaeaea; } pre { cursor:text; } .columnadder { opacity: 0.1; } .columnadder:hover { opacity: 1; } a { display: block; margin-top: 1em; } """ participants = [ "John Doe", "Mam Butterfly", "Mysterious Man" ] choix = [ [0, 0, True ], [0, 1, False], [0, 2, False], [1, 0, False], [1, 1, True ], [1, 2, False], [2, 0, False ], [2, 2, True ] ] menus = [ "Margharita", "Pepperoni", "Chicken" ] addPerson participants choix = { apply (participants, choix) = "" update {input=(oldParticipants, oldChoix), outputNew = newParticipant} = if newParticipant /= "" then let newParticipants = oldParticipants ++ [newParticipant] in let newChoix = choix ++ (map (\i -> [len oldParticipants, i, False]) (indices menus)) in Ok (Inputs [(newParticipants, newChoix)]) else Ok (Inputs [(oldParticipants, oldChoix)]) }.apply (participants, choix) total menuId = let n = choix |> List.map (\[userId, mId, check] -> if check && menuId == mId then 1 else 0) |> List.sum in <td>@n</td> onChangeAttribute model controller = { apply model = "" update {input, outputNew} = Ok (Inputs [controller input outputNew]) }.apply model wantsToEat personId menuId = let predicate [pId, mId, b] = pId == personId && mId == menuId in case find predicate choix of Just ([pId, mId, checked] as choix) -> if checked then <td class=(Update.softFreeze "partTableCell xsep pok y") onclick="this.classList.remove('y');this.classList.add('n');this.setAttribute('x', 'NO')" title=((nth participants personId) + ", " + (nth menus menuId) + ": Yes") x=(onChangeAttribute checked (\old newValue -> newValue == "YES")) > <span class="glyphicon glyphicon-ok"></span> </td> else <td class=(Update.softFreeze "partTableCell xsep pn n") onclick="this.classList.remove('n');this.classList.add('y');this.setAttribute('y', 'YES')" title=((nth participants personId) + ", " + (nth menus menuId)+ ": No") y=(onChangeAttribute checked (\old newValue -> newValue == "YES")) > </td> _ -> <td class="partTableCell q sep pog" title=((nth participants personId) + ", " + (nth menus menuId)) onclick="this.setAttribute('z', 't')" z=(onChangeAttribute choix (\old _ -> [personId, menuId, True]::choix)) >?</td> ligne menu = <th>@menu</th> pollInfo personId = <tr class="participant partMyself"> <td class="pname" id="part1367130755"> <span class="pname">@(nth participants personId)</span> </td> @(map (\menusId -> wantsToEat personId menusId) (indices menus)) </tr> numMenus = len menus page = <table cellpadding="0" cellspacing="0" class="poll textPoll " summary="LARA Thai"> <tbody> <tr class="header date month"> <th class="nonHeader partCount boldText"> <div>@(toString (len participants) + " participants")</div> </th> @(map (\menu -> <th>@menu</th>) menus) <th class="columnadder"><button onclick="""this.setAttribute('v@numMenus', 'T')""" @([["""v@numMenus""", onChangeAttribute menus (\oldMenus _ -> oldMenus++["""Meal#@numMenus"""])]])>+</button></th> </tr> <tr></tr> @(map pollInfo (indices participants)) <tr class="participation yesNo"> <td class="pname"> <label class="hiddenAcc" forid="pname" title="l10n_yourName"></label> <input class="form-control" id="pname" maxlength="64" name ="name" placeholder="Your name" onkeypress="""if(event.keyCode == 13) this.setAttribute("v", this.value);""" type ="text" v=(addPerson participants choix)> </td> @(map total (indices menus) ) </tr> </tbody> </table> date = "Thursday, April 26th 2018" urlencode txt = txt |> Regex.replace ":" "%2F5" |> Regex.replace "/" "%2F" |> Regex.replace " " "%20" |> Regex.replace "\n" "%0A" command = String.join "," <| map (\(index, menu) -> let [_, _, [[_, t]]] = total index in let who = choix |> List.filterMap (\[pId, mId, checked] -> if checked && mId == index then Just (nth participants pId) else Nothing) in if t == "0" then "" else " " + t + " pizza" + (if t=="1" then "" else "s") +" " + menu + " (" + String.join ", " who + ")" ) <| zipWithIndex menus sms = """Hello Pizzaiolo, Always a pleaure to do business with you. For the lunch of @date, we would like to order@command. I'll pick up the pizzas at 1:15pm. Best regards, The Dream Team """ <div style="margin:20px"> <style>@css</style> <h1>Pizza meeting, @date</h1> <p>Choose your favorite pizzas. We will order some to satisfy everyone</p> @page <a contenteditable="False" href="""mailto:pizzaiolo@@gmail.com?subject=Pizzas for @date&body=@(urlencode sms)""">Send this email to the pizzaiolo</a> <br> <pre style="white-space:pre-wrap">@sms</pre> </div>
35075
{join} = String {matchIn} = Regex {indices, map, find} = List { onChangeAttribute } = Html css = """ .partTableCell{ cursor:pointer; } .partTableCell:hover{ outline: 1px solid black; } .hiddenAcc{ display:block; position:absolute; top:-999em; } .form-control, textarea, select, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input{ height:30px; padding-top:4px; padding-bottom:4px; border-radius:0; border-color:#b7b7b7; font-size:13px; } .textPoll th, .textPoll .foot td{ max-width:94px; } label{ font-weight:normal; } label{ display:inline-block; margin-bottom:5px; font-weight:bold; } table.poll tr.participation td { text-align:center; background-color:#ffffff; } table.poll tr.participant td.n { background-color:#ffccca; } table.poll tr.participant td.y { background-color:#d1f3d1; } table.poll tr.participant td { text-align:center; vertical-align:middle; height:33px; } table.poll tr.participation.inEdit td:hover{ background-color:#d6d6d6; } table.poll tr.participation td.pname,table.poll tr.participant td.pname{ position:relative; min-width:182px; width:182px; border-top:1px solid #fff; border-bottom:2px solid #fff; background:url('http://doodle.com/builtstatic/1465286543/doodle/graphics/sprites/common/normal-s92f91c2182.png') -15px -972px no-repeat #fff; imageRendering:-moz-crisp-edges; imageRendering:-o-crisp-edges; imageRendering:-webkit-optimize-contrast; imageRendering:crisp-edges; -ms-interpolation-mode:nearest-neighbor; padding:0 2px 0 0; } table.poll tr.header.month th.xsep{ background:url("http://doodle.com/graphics/polls/tick31r.png") right 0 repeat-y #3385e4; padding-right:13px; } table.poll td.pname div.pname{ text-align:left; font-size:15px; line-height:15px; padding:8px 0 5px 0; margin-left:3px; white-space:nowrap; overflow:hidden; max-width:135px; width:135px; position:relative; } table.poll tr.date th, table.poll tr.date td{ background:#3385e4; color:#fff; } table.poll{ border-collapse:separate; } table.poll tr.date.month th{ padding-top:7px; padding-bottom:3px; } table.poll tr.header th, table.poll tr.header td{ padding:0 10px 0; } table.poll th, table.poll td{ font-size:13px; line-height:17px; font-weight:normal; } table.poll tr.participation td.pname input{ font-size:12px; height:24px; line-height:20px; margin:3px 0 3px 3px; width:131px; padding:2px 6px 2px 9px; } table.poll tr th.nonHeader.partCount, table.poll tr td.partCount{ background:#fff; padding:0 0 9px 0; vertical-align:bottom; font-size:13px; color:#323232; min-width:184px; width:184px; font-weight:bold; max-width:none; } table.poll tr.sums td{ text-align:center; line-height:16px; padding-left:5px; padding-right:8px; padding-top:5px; color:#6f6f6f; } table.poll tr.participant td.q { background-color:#eaeaea; } pre { cursor:text; } .columnadder { opacity: 0.1; } .columnadder:hover { opacity: 1; } a { display: block; margin-top: 1em; } """ participants = [ "<NAME>", "<NAME>", "<NAME>" ] choix = [ [0, 0, True ], [0, 1, False], [0, 2, False], [1, 0, False], [1, 1, True ], [1, 2, False], [2, 0, False ], [2, 2, True ] ] menus = [ "Margharita", "Pepperoni", "Chicken" ] addPerson participants choix = { apply (participants, choix) = "" update {input=(oldParticipants, oldChoix), outputNew = newParticipant} = if newParticipant /= "" then let newParticipants = oldParticipants ++ [newParticipant] in let newChoix = choix ++ (map (\i -> [len oldParticipants, i, False]) (indices menus)) in Ok (Inputs [(newParticipants, newChoix)]) else Ok (Inputs [(oldParticipants, oldChoix)]) }.apply (participants, choix) total menuId = let n = choix |> List.map (\[userId, mId, check] -> if check && menuId == mId then 1 else 0) |> List.sum in <td>@n</td> onChangeAttribute model controller = { apply model = "" update {input, outputNew} = Ok (Inputs [controller input outputNew]) }.apply model wantsToEat personId menuId = let predicate [pId, mId, b] = pId == personId && mId == menuId in case find predicate choix of Just ([pId, mId, checked] as choix) -> if checked then <td class=(Update.softFreeze "partTableCell xsep pok y") onclick="this.classList.remove('y');this.classList.add('n');this.setAttribute('x', 'NO')" title=((nth participants personId) + ", " + (nth menus menuId) + ": Yes") x=(onChangeAttribute checked (\old newValue -> newValue == "YES")) > <span class="glyphicon glyphicon-ok"></span> </td> else <td class=(Update.softFreeze "partTableCell xsep pn n") onclick="this.classList.remove('n');this.classList.add('y');this.setAttribute('y', 'YES')" title=((nth participants personId) + ", " + (nth menus menuId)+ ": No") y=(onChangeAttribute checked (\old newValue -> newValue == "YES")) > </td> _ -> <td class="partTableCell q sep pog" title=((nth participants personId) + ", " + (nth menus menuId)) onclick="this.setAttribute('z', 't')" z=(onChangeAttribute choix (\old _ -> [personId, menuId, True]::choix)) >?</td> ligne menu = <th>@menu</th> pollInfo personId = <tr class="participant partMyself"> <td class="pname" id="part1367130755"> <span class="pname">@(nth participants personId)</span> </td> @(map (\menusId -> wantsToEat personId menusId) (indices menus)) </tr> numMenus = len menus page = <table cellpadding="0" cellspacing="0" class="poll textPoll " summary="LARA Thai"> <tbody> <tr class="header date month"> <th class="nonHeader partCount boldText"> <div>@(toString (len participants) + " participants")</div> </th> @(map (\menu -> <th>@menu</th>) menus) <th class="columnadder"><button onclick="""this.setAttribute('v@numMenus', 'T')""" @([["""v@numMenus""", onChangeAttribute menus (\oldMenus _ -> oldMenus++["""Meal#@numMenus"""])]])>+</button></th> </tr> <tr></tr> @(map pollInfo (indices participants)) <tr class="participation yesNo"> <td class="pname"> <label class="hiddenAcc" forid="pname" title="l10n_yourName"></label> <input class="form-control" id="pname" maxlength="64" name ="name" placeholder="<NAME>" onkeypress="""if(event.keyCode == 13) this.setAttribute("v", this.value);""" type ="text" v=(addPerson participants choix)> </td> @(map total (indices menus) ) </tr> </tbody> </table> date = "Thursday, April 26th 2018" urlencode txt = txt |> Regex.replace ":" "%2F5" |> Regex.replace "/" "%2F" |> Regex.replace " " "%20" |> Regex.replace "\n" "%0A" command = String.join "," <| map (\(index, menu) -> let [_, _, [[_, t]]] = total index in let who = choix |> List.filterMap (\[pId, mId, checked] -> if checked && mId == index then Just (nth participants pId) else Nothing) in if t == "0" then "" else " " + t + " pizza" + (if t=="1" then "" else "s") +" " + menu + " (" + String.join ", " who + ")" ) <| zipWithIndex menus sms = """Hello Pizzaiolo, Always a pleaure to do business with you. For the lunch of @date, we would like to order@command. I'll pick up the pizzas at 1:15pm. Best regards, The Dream Team """ <div style="margin:20px"> <style>@css</style> <h1>Pizza meeting, @date</h1> <p>Choose your favorite pizzas. We will order some to satisfy everyone</p> @page <a contenteditable="False" href="""mailto:<EMAIL>?subject=Pizzas for @date&body=@(urlencode sms)""">Send this email to the pizzaiolo</a> <br> <pre style="white-space:pre-wrap">@sms</pre> </div>
true
{join} = String {matchIn} = Regex {indices, map, find} = List { onChangeAttribute } = Html css = """ .partTableCell{ cursor:pointer; } .partTableCell:hover{ outline: 1px solid black; } .hiddenAcc{ display:block; position:absolute; top:-999em; } .form-control, textarea, select, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input{ height:30px; padding-top:4px; padding-bottom:4px; border-radius:0; border-color:#b7b7b7; font-size:13px; } .textPoll th, .textPoll .foot td{ max-width:94px; } label{ font-weight:normal; } label{ display:inline-block; margin-bottom:5px; font-weight:bold; } table.poll tr.participation td { text-align:center; background-color:#ffffff; } table.poll tr.participant td.n { background-color:#ffccca; } table.poll tr.participant td.y { background-color:#d1f3d1; } table.poll tr.participant td { text-align:center; vertical-align:middle; height:33px; } table.poll tr.participation.inEdit td:hover{ background-color:#d6d6d6; } table.poll tr.participation td.pname,table.poll tr.participant td.pname{ position:relative; min-width:182px; width:182px; border-top:1px solid #fff; border-bottom:2px solid #fff; background:url('http://doodle.com/builtstatic/1465286543/doodle/graphics/sprites/common/normal-s92f91c2182.png') -15px -972px no-repeat #fff; imageRendering:-moz-crisp-edges; imageRendering:-o-crisp-edges; imageRendering:-webkit-optimize-contrast; imageRendering:crisp-edges; -ms-interpolation-mode:nearest-neighbor; padding:0 2px 0 0; } table.poll tr.header.month th.xsep{ background:url("http://doodle.com/graphics/polls/tick31r.png") right 0 repeat-y #3385e4; padding-right:13px; } table.poll td.pname div.pname{ text-align:left; font-size:15px; line-height:15px; padding:8px 0 5px 0; margin-left:3px; white-space:nowrap; overflow:hidden; max-width:135px; width:135px; position:relative; } table.poll tr.date th, table.poll tr.date td{ background:#3385e4; color:#fff; } table.poll{ border-collapse:separate; } table.poll tr.date.month th{ padding-top:7px; padding-bottom:3px; } table.poll tr.header th, table.poll tr.header td{ padding:0 10px 0; } table.poll th, table.poll td{ font-size:13px; line-height:17px; font-weight:normal; } table.poll tr.participation td.pname input{ font-size:12px; height:24px; line-height:20px; margin:3px 0 3px 3px; width:131px; padding:2px 6px 2px 9px; } table.poll tr th.nonHeader.partCount, table.poll tr td.partCount{ background:#fff; padding:0 0 9px 0; vertical-align:bottom; font-size:13px; color:#323232; min-width:184px; width:184px; font-weight:bold; max-width:none; } table.poll tr.sums td{ text-align:center; line-height:16px; padding-left:5px; padding-right:8px; padding-top:5px; color:#6f6f6f; } table.poll tr.participant td.q { background-color:#eaeaea; } pre { cursor:text; } .columnadder { opacity: 0.1; } .columnadder:hover { opacity: 1; } a { display: block; margin-top: 1em; } """ participants = [ "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI", "PI:NAME:<NAME>END_PI" ] choix = [ [0, 0, True ], [0, 1, False], [0, 2, False], [1, 0, False], [1, 1, True ], [1, 2, False], [2, 0, False ], [2, 2, True ] ] menus = [ "Margharita", "Pepperoni", "Chicken" ] addPerson participants choix = { apply (participants, choix) = "" update {input=(oldParticipants, oldChoix), outputNew = newParticipant} = if newParticipant /= "" then let newParticipants = oldParticipants ++ [newParticipant] in let newChoix = choix ++ (map (\i -> [len oldParticipants, i, False]) (indices menus)) in Ok (Inputs [(newParticipants, newChoix)]) else Ok (Inputs [(oldParticipants, oldChoix)]) }.apply (participants, choix) total menuId = let n = choix |> List.map (\[userId, mId, check] -> if check && menuId == mId then 1 else 0) |> List.sum in <td>@n</td> onChangeAttribute model controller = { apply model = "" update {input, outputNew} = Ok (Inputs [controller input outputNew]) }.apply model wantsToEat personId menuId = let predicate [pId, mId, b] = pId == personId && mId == menuId in case find predicate choix of Just ([pId, mId, checked] as choix) -> if checked then <td class=(Update.softFreeze "partTableCell xsep pok y") onclick="this.classList.remove('y');this.classList.add('n');this.setAttribute('x', 'NO')" title=((nth participants personId) + ", " + (nth menus menuId) + ": Yes") x=(onChangeAttribute checked (\old newValue -> newValue == "YES")) > <span class="glyphicon glyphicon-ok"></span> </td> else <td class=(Update.softFreeze "partTableCell xsep pn n") onclick="this.classList.remove('n');this.classList.add('y');this.setAttribute('y', 'YES')" title=((nth participants personId) + ", " + (nth menus menuId)+ ": No") y=(onChangeAttribute checked (\old newValue -> newValue == "YES")) > </td> _ -> <td class="partTableCell q sep pog" title=((nth participants personId) + ", " + (nth menus menuId)) onclick="this.setAttribute('z', 't')" z=(onChangeAttribute choix (\old _ -> [personId, menuId, True]::choix)) >?</td> ligne menu = <th>@menu</th> pollInfo personId = <tr class="participant partMyself"> <td class="pname" id="part1367130755"> <span class="pname">@(nth participants personId)</span> </td> @(map (\menusId -> wantsToEat personId menusId) (indices menus)) </tr> numMenus = len menus page = <table cellpadding="0" cellspacing="0" class="poll textPoll " summary="LARA Thai"> <tbody> <tr class="header date month"> <th class="nonHeader partCount boldText"> <div>@(toString (len participants) + " participants")</div> </th> @(map (\menu -> <th>@menu</th>) menus) <th class="columnadder"><button onclick="""this.setAttribute('v@numMenus', 'T')""" @([["""v@numMenus""", onChangeAttribute menus (\oldMenus _ -> oldMenus++["""Meal#@numMenus"""])]])>+</button></th> </tr> <tr></tr> @(map pollInfo (indices participants)) <tr class="participation yesNo"> <td class="pname"> <label class="hiddenAcc" forid="pname" title="l10n_yourName"></label> <input class="form-control" id="pname" maxlength="64" name ="name" placeholder="PI:NAME:<NAME>END_PI" onkeypress="""if(event.keyCode == 13) this.setAttribute("v", this.value);""" type ="text" v=(addPerson participants choix)> </td> @(map total (indices menus) ) </tr> </tbody> </table> date = "Thursday, April 26th 2018" urlencode txt = txt |> Regex.replace ":" "%2F5" |> Regex.replace "/" "%2F" |> Regex.replace " " "%20" |> Regex.replace "\n" "%0A" command = String.join "," <| map (\(index, menu) -> let [_, _, [[_, t]]] = total index in let who = choix |> List.filterMap (\[pId, mId, checked] -> if checked && mId == index then Just (nth participants pId) else Nothing) in if t == "0" then "" else " " + t + " pizza" + (if t=="1" then "" else "s") +" " + menu + " (" + String.join ", " who + ")" ) <| zipWithIndex menus sms = """Hello Pizzaiolo, Always a pleaure to do business with you. For the lunch of @date, we would like to order@command. I'll pick up the pizzas at 1:15pm. Best regards, The Dream Team """ <div style="margin:20px"> <style>@css</style> <h1>Pizza meeting, @date</h1> <p>Choose your favorite pizzas. We will order some to satisfy everyone</p> @page <a contenteditable="False" href="""mailto:PI:EMAIL:<EMAIL>END_PI?subject=Pizzas for @date&body=@(urlencode sms)""">Send this email to the pizzaiolo</a> <br> <pre style="white-space:pre-wrap">@sms</pre> </div>
elm
[ { "context": "ord newPassword ->\n ( { model | newPassword = newPassword\n , banner = Nothing\n }\n ", "end": 978, "score": 0.9965913892, "start": 967, "tag": "PASSWORD", "value": "newPassword" } ]
app/ProfileApp/Update.elm
digitalsatori/narrows
116
module ProfileApp.Update exposing (..) import Http import Core.Routes exposing (Route(..)) import Common.Models exposing (bannerForHttpError, errorBanner, successBanner) import ProfileApp.Api import ProfileApp.Messages exposing (..) import ProfileApp.Models exposing (..) urlUpdate : Route -> Model -> (Model, Cmd Msg) urlUpdate route model = case route of ProfilePage -> ( { model | banner = Nothing , user = Nothing , newPassword = "" } , ProfileApp.Api.fetchCurrentUser ) _ -> (model, Cmd.none) update : Msg -> Model -> (Model, Cmd Msg) update msg model = case msg of NoOp -> (model, Cmd.none) UserFetchResult (Err error) -> ( { model | banner = bannerForHttpError error } , Cmd.none ) UserFetchResult (Ok resp) -> ( { model | user = Just resp } , Cmd.none ) UpdatePassword newPassword -> ( { model | newPassword = newPassword , banner = Nothing } , Cmd.none ) UpdateDisplayName newDisplayName -> let updatedUser = case model.user of Just user -> Just { user | displayName = newDisplayName } Nothing -> model.user in ( { model | user = updatedUser , banner = Nothing } , Cmd.none ) SaveUser -> case model.user of Just user -> ( model , ProfileApp.Api.saveUser user.id user.displayName model.newPassword ) Nothing -> (model, Cmd.none) SaveUserResult (Err error) -> ( { model | banner = bannerForHttpError error } , Cmd.none ) SaveUserResult (Ok resp) -> case resp of Http.GoodStatus_ _ _ -> ( { model | banner = successBanner "User updated" , newPassword = "" } , Cmd.none ) Http.BadStatus_ metadata _ -> ( { model | banner = errorBanner <| "Error updating user, error code " ++ (String.fromInt metadata.statusCode) } , Cmd.none ) _ -> ( { model | banner = errorBanner "Error updating user, network error" } , Cmd.none )
22922
module ProfileApp.Update exposing (..) import Http import Core.Routes exposing (Route(..)) import Common.Models exposing (bannerForHttpError, errorBanner, successBanner) import ProfileApp.Api import ProfileApp.Messages exposing (..) import ProfileApp.Models exposing (..) urlUpdate : Route -> Model -> (Model, Cmd Msg) urlUpdate route model = case route of ProfilePage -> ( { model | banner = Nothing , user = Nothing , newPassword = "" } , ProfileApp.Api.fetchCurrentUser ) _ -> (model, Cmd.none) update : Msg -> Model -> (Model, Cmd Msg) update msg model = case msg of NoOp -> (model, Cmd.none) UserFetchResult (Err error) -> ( { model | banner = bannerForHttpError error } , Cmd.none ) UserFetchResult (Ok resp) -> ( { model | user = Just resp } , Cmd.none ) UpdatePassword newPassword -> ( { model | newPassword = <PASSWORD> , banner = Nothing } , Cmd.none ) UpdateDisplayName newDisplayName -> let updatedUser = case model.user of Just user -> Just { user | displayName = newDisplayName } Nothing -> model.user in ( { model | user = updatedUser , banner = Nothing } , Cmd.none ) SaveUser -> case model.user of Just user -> ( model , ProfileApp.Api.saveUser user.id user.displayName model.newPassword ) Nothing -> (model, Cmd.none) SaveUserResult (Err error) -> ( { model | banner = bannerForHttpError error } , Cmd.none ) SaveUserResult (Ok resp) -> case resp of Http.GoodStatus_ _ _ -> ( { model | banner = successBanner "User updated" , newPassword = "" } , Cmd.none ) Http.BadStatus_ metadata _ -> ( { model | banner = errorBanner <| "Error updating user, error code " ++ (String.fromInt metadata.statusCode) } , Cmd.none ) _ -> ( { model | banner = errorBanner "Error updating user, network error" } , Cmd.none )
true
module ProfileApp.Update exposing (..) import Http import Core.Routes exposing (Route(..)) import Common.Models exposing (bannerForHttpError, errorBanner, successBanner) import ProfileApp.Api import ProfileApp.Messages exposing (..) import ProfileApp.Models exposing (..) urlUpdate : Route -> Model -> (Model, Cmd Msg) urlUpdate route model = case route of ProfilePage -> ( { model | banner = Nothing , user = Nothing , newPassword = "" } , ProfileApp.Api.fetchCurrentUser ) _ -> (model, Cmd.none) update : Msg -> Model -> (Model, Cmd Msg) update msg model = case msg of NoOp -> (model, Cmd.none) UserFetchResult (Err error) -> ( { model | banner = bannerForHttpError error } , Cmd.none ) UserFetchResult (Ok resp) -> ( { model | user = Just resp } , Cmd.none ) UpdatePassword newPassword -> ( { model | newPassword = PI:PASSWORD:<PASSWORD>END_PI , banner = Nothing } , Cmd.none ) UpdateDisplayName newDisplayName -> let updatedUser = case model.user of Just user -> Just { user | displayName = newDisplayName } Nothing -> model.user in ( { model | user = updatedUser , banner = Nothing } , Cmd.none ) SaveUser -> case model.user of Just user -> ( model , ProfileApp.Api.saveUser user.id user.displayName model.newPassword ) Nothing -> (model, Cmd.none) SaveUserResult (Err error) -> ( { model | banner = bannerForHttpError error } , Cmd.none ) SaveUserResult (Ok resp) -> case resp of Http.GoodStatus_ _ _ -> ( { model | banner = successBanner "User updated" , newPassword = "" } , Cmd.none ) Http.BadStatus_ metadata _ -> ( { model | banner = errorBanner <| "Error updating user, error code " ++ (String.fromInt metadata.statusCode) } , Cmd.none ) _ -> ( { model | banner = errorBanner "Error updating user, network error" } , Cmd.none )
elm
[ { "context": "apis.com/css?family=Catamaran\"\n , name = \"Catamaran\"\n , adjustment =\n { capital = 1", "end": 282, "score": 0.5990999341, "start": 274, "tag": "NAME", "value": "atamaran" } ]
tests-rendering/cases/resolved/Adjusted.elm
bburdette/elm-ui
1,236
module Main exposing (main) {-| -} import Element exposing (..) import Element.Background as Background import Element.Font as Font import Html.Attributes myFont = Font.with { url = Just "https://fonts.googleapis.com/css?family=Catamaran" , name = "Catamaran" , adjustment = { capital = 1.15 , lowercase = 0.96 , baseline = 0.465 , descender = 0.245 } } main = Element.layout [ Background.color (rgba 0 0.8 0.9 1) , Font.color (rgba 1 1 1 1) , Font.size 32 , Font.family [ myFont ] -- , Font.family -- [ Font.external -- { url = "https://fonts.googleapis.com/css?family=EB+Garamond" -- , name = "EB Garamond" -- } -- , Font.sansSerif -- ] ] <| column [ centerX, centerY, spacing 20, padding 100, htmlAttribute (Html.Attributes.style "display" "block") ] [ el [] (text "Hello stylish friend!") , el [ Font.family [ Font.external { url = "https://fonts.googleapis.com/css?family=EB+Garamond" , name = "EB Garamond" } ] ] <| el [ Font.sizeByCapital , Background.color (rgba 1 1 1 1) , Font.color (rgba 0 0 0 1) ] (text "Hello stylish friend!") , el [ Font.sizeByCapital , Background.color (rgba 1 1 1 1) , Font.color (rgba 0 0 0 1) ] (text "Hello stylish friend!") , el [ Background.color (rgba 1 1 1 1) , Font.color (rgba 0 0 0 1) ] (text "Hello stylish friend!") ]
9228
module Main exposing (main) {-| -} import Element exposing (..) import Element.Background as Background import Element.Font as Font import Html.Attributes myFont = Font.with { url = Just "https://fonts.googleapis.com/css?family=Catamaran" , name = "C<NAME>" , adjustment = { capital = 1.15 , lowercase = 0.96 , baseline = 0.465 , descender = 0.245 } } main = Element.layout [ Background.color (rgba 0 0.8 0.9 1) , Font.color (rgba 1 1 1 1) , Font.size 32 , Font.family [ myFont ] -- , Font.family -- [ Font.external -- { url = "https://fonts.googleapis.com/css?family=EB+Garamond" -- , name = "EB Garamond" -- } -- , Font.sansSerif -- ] ] <| column [ centerX, centerY, spacing 20, padding 100, htmlAttribute (Html.Attributes.style "display" "block") ] [ el [] (text "Hello stylish friend!") , el [ Font.family [ Font.external { url = "https://fonts.googleapis.com/css?family=EB+Garamond" , name = "EB Garamond" } ] ] <| el [ Font.sizeByCapital , Background.color (rgba 1 1 1 1) , Font.color (rgba 0 0 0 1) ] (text "Hello stylish friend!") , el [ Font.sizeByCapital , Background.color (rgba 1 1 1 1) , Font.color (rgba 0 0 0 1) ] (text "Hello stylish friend!") , el [ Background.color (rgba 1 1 1 1) , Font.color (rgba 0 0 0 1) ] (text "Hello stylish friend!") ]
true
module Main exposing (main) {-| -} import Element exposing (..) import Element.Background as Background import Element.Font as Font import Html.Attributes myFont = Font.with { url = Just "https://fonts.googleapis.com/css?family=Catamaran" , name = "CPI:NAME:<NAME>END_PI" , adjustment = { capital = 1.15 , lowercase = 0.96 , baseline = 0.465 , descender = 0.245 } } main = Element.layout [ Background.color (rgba 0 0.8 0.9 1) , Font.color (rgba 1 1 1 1) , Font.size 32 , Font.family [ myFont ] -- , Font.family -- [ Font.external -- { url = "https://fonts.googleapis.com/css?family=EB+Garamond" -- , name = "EB Garamond" -- } -- , Font.sansSerif -- ] ] <| column [ centerX, centerY, spacing 20, padding 100, htmlAttribute (Html.Attributes.style "display" "block") ] [ el [] (text "Hello stylish friend!") , el [ Font.family [ Font.external { url = "https://fonts.googleapis.com/css?family=EB+Garamond" , name = "EB Garamond" } ] ] <| el [ Font.sizeByCapital , Background.color (rgba 1 1 1 1) , Font.color (rgba 0 0 0 1) ] (text "Hello stylish friend!") , el [ Font.sizeByCapital , Background.color (rgba 1 1 1 1) , Font.color (rgba 0 0 0 1) ] (text "Hello stylish friend!") , el [ Background.color (rgba 1 1 1 1) , Font.color (rgba 0 0 0 1) ] (text "Hello stylish friend!") ]
elm
[ { "context": " , content =\n [ \"0151 40037773\"\n , \"treibisch@gmail.com\"\n , \"02 September 1986\"\n ]\n }\n\n\n", "end": 640, "score": 0.9999203086, "start": 621, "tag": "EMAIL", "value": "treibisch@gmail.com" }, { "context": "2013 - 2015\"\n ]\n , content =\n [ \"Friedrich-Ebert Elementary School in Büdelsdorf\"\n , ", "end": 926, "score": 0.7825059295, "start": 917, "tag": "NAME", "value": "Friedrich" }, { "context": "5\"\n ]\n , content =\n [ \"Friedrich-Ebert Elementary School in Büdelsdorf\"\n , \"Helen", "end": 932, "score": 0.7431210279, "start": 927, "tag": "NAME", "value": "Ebert" }, { "context": "g on an artificial intelligence project, Prof. Dr. Rainer Adelung (TF of the CAU Kiel)\"\n , \"Trainee at [ARIV", "end": 2456, "score": 0.9998949766, "start": 2442, "tag": "NAME", "value": "Rainer Adelung" } ]
Content.elm
MrMovl/cv
0
module Content exposing (..) import Html exposing (Attribute) import Html.Attributes exposing (src) type alias Group = { title : String , names : List String , content : List String } gravatarSource : Attribute a gravatarSource = src "https://secure.gravatar.com/avatar/fa61ab6f435658b0255a28d1ce2c7f69?s=200" blocks : List Group blocks = [ education , jobExperience , extraExperiences , misc ] contactInfo : Group contactInfo = { title = "Personal information" , names = [ "Phone", "E-Mail", "Date of birth" ] , content = [ "0151 40037773" , "treibisch@gmail.com" , "02 September 1986" ] } education : Group education = { title = "Education" , names = [ "1993 - 1997" , "1997 - 2006" , "2007 - 2009" , "2009 - 2013" , "2013 - 2015" ] , content = [ "Friedrich-Ebert Elementary School in Büdelsdorf" , "Helene-Lange-Gymnasium in Rendsburg - Degree: Abitur" , "CAU Kiel Bachelor Biology" , "CAU Kiel Bachelor Computer Science" , "RBZ Technik in Kiel - Degree: Fachinformatiker Anwendungsentwicklung (qualified application developer" ] } extraExperiences : Group extraExperiences = { title = "Other experiences" , names = [ "2010 - 2013" , "06/2012 - 05/2013" , "04/2016 - ongoing" ] , content = [ "Active member of the [student representatives for Math & Computer Science](https://www.fs-infmath.uni-kiel.de/wiki/Hauptseite) at the CAU Kiel" , "Co-Organiser of the [conference for the german student representatives for Computer Science 41.0](https://kif.fsinf.de/wiki/KIF410:Hauptseite)" , "Co-Organiser of the [Elmoin Meetup](https://www.meetup.com/de-DE/Elmoin/)" ] } jobExperience : Group jobExperience = { title = "Job experience" , names = [ "09/2006 - 06/2007" , "08/2008 - 10/2011" , "11/2011 - 03/2013" , "05/2013 - 01/2015" , "02/2015 - ongoing" ] , content = [ "Alternative civilian service at the inclusive day-care centre 'Regenbogen' in Rendsburg" , "Part time employee at [getdigital.de](https://www.getdigital.de), working on logistics, shipment and imprinting shirts" , "Student assistant working on an artificial intelligence project, Prof. Dr. Rainer Adelung (TF of the CAU Kiel)" , "Trainee at [ARIVA.DE](https://www.ariva.de), a stock price portal" , "Frontend Developer creating visualization tools at [graphomate GmbH](http://www.graphomate.com)" ] } misc : Group misc = { title = "Misc" , names = [ "Languages", "Non-technical hobbies" ] , content = [ "German (mother tounge), English (fluent)" , "photography, literature, comic books, drums, roleplaying and boardgames, woodworking" ] }
11176
module Content exposing (..) import Html exposing (Attribute) import Html.Attributes exposing (src) type alias Group = { title : String , names : List String , content : List String } gravatarSource : Attribute a gravatarSource = src "https://secure.gravatar.com/avatar/fa61ab6f435658b0255a28d1ce2c7f69?s=200" blocks : List Group blocks = [ education , jobExperience , extraExperiences , misc ] contactInfo : Group contactInfo = { title = "Personal information" , names = [ "Phone", "E-Mail", "Date of birth" ] , content = [ "0151 40037773" , "<EMAIL>" , "02 September 1986" ] } education : Group education = { title = "Education" , names = [ "1993 - 1997" , "1997 - 2006" , "2007 - 2009" , "2009 - 2013" , "2013 - 2015" ] , content = [ "<NAME>-<NAME> Elementary School in Büdelsdorf" , "Helene-Lange-Gymnasium in Rendsburg - Degree: Abitur" , "CAU Kiel Bachelor Biology" , "CAU Kiel Bachelor Computer Science" , "RBZ Technik in Kiel - Degree: Fachinformatiker Anwendungsentwicklung (qualified application developer" ] } extraExperiences : Group extraExperiences = { title = "Other experiences" , names = [ "2010 - 2013" , "06/2012 - 05/2013" , "04/2016 - ongoing" ] , content = [ "Active member of the [student representatives for Math & Computer Science](https://www.fs-infmath.uni-kiel.de/wiki/Hauptseite) at the CAU Kiel" , "Co-Organiser of the [conference for the german student representatives for Computer Science 41.0](https://kif.fsinf.de/wiki/KIF410:Hauptseite)" , "Co-Organiser of the [Elmoin Meetup](https://www.meetup.com/de-DE/Elmoin/)" ] } jobExperience : Group jobExperience = { title = "Job experience" , names = [ "09/2006 - 06/2007" , "08/2008 - 10/2011" , "11/2011 - 03/2013" , "05/2013 - 01/2015" , "02/2015 - ongoing" ] , content = [ "Alternative civilian service at the inclusive day-care centre 'Regenbogen' in Rendsburg" , "Part time employee at [getdigital.de](https://www.getdigital.de), working on logistics, shipment and imprinting shirts" , "Student assistant working on an artificial intelligence project, Prof. Dr. <NAME> (TF of the CAU Kiel)" , "Trainee at [ARIVA.DE](https://www.ariva.de), a stock price portal" , "Frontend Developer creating visualization tools at [graphomate GmbH](http://www.graphomate.com)" ] } misc : Group misc = { title = "Misc" , names = [ "Languages", "Non-technical hobbies" ] , content = [ "German (mother tounge), English (fluent)" , "photography, literature, comic books, drums, roleplaying and boardgames, woodworking" ] }
true
module Content exposing (..) import Html exposing (Attribute) import Html.Attributes exposing (src) type alias Group = { title : String , names : List String , content : List String } gravatarSource : Attribute a gravatarSource = src "https://secure.gravatar.com/avatar/fa61ab6f435658b0255a28d1ce2c7f69?s=200" blocks : List Group blocks = [ education , jobExperience , extraExperiences , misc ] contactInfo : Group contactInfo = { title = "Personal information" , names = [ "Phone", "E-Mail", "Date of birth" ] , content = [ "0151 40037773" , "PI:EMAIL:<EMAIL>END_PI" , "02 September 1986" ] } education : Group education = { title = "Education" , names = [ "1993 - 1997" , "1997 - 2006" , "2007 - 2009" , "2009 - 2013" , "2013 - 2015" ] , content = [ "PI:NAME:<NAME>END_PI-PI:NAME:<NAME>END_PI Elementary School in Büdelsdorf" , "Helene-Lange-Gymnasium in Rendsburg - Degree: Abitur" , "CAU Kiel Bachelor Biology" , "CAU Kiel Bachelor Computer Science" , "RBZ Technik in Kiel - Degree: Fachinformatiker Anwendungsentwicklung (qualified application developer" ] } extraExperiences : Group extraExperiences = { title = "Other experiences" , names = [ "2010 - 2013" , "06/2012 - 05/2013" , "04/2016 - ongoing" ] , content = [ "Active member of the [student representatives for Math & Computer Science](https://www.fs-infmath.uni-kiel.de/wiki/Hauptseite) at the CAU Kiel" , "Co-Organiser of the [conference for the german student representatives for Computer Science 41.0](https://kif.fsinf.de/wiki/KIF410:Hauptseite)" , "Co-Organiser of the [Elmoin Meetup](https://www.meetup.com/de-DE/Elmoin/)" ] } jobExperience : Group jobExperience = { title = "Job experience" , names = [ "09/2006 - 06/2007" , "08/2008 - 10/2011" , "11/2011 - 03/2013" , "05/2013 - 01/2015" , "02/2015 - ongoing" ] , content = [ "Alternative civilian service at the inclusive day-care centre 'Regenbogen' in Rendsburg" , "Part time employee at [getdigital.de](https://www.getdigital.de), working on logistics, shipment and imprinting shirts" , "Student assistant working on an artificial intelligence project, Prof. Dr. PI:NAME:<NAME>END_PI (TF of the CAU Kiel)" , "Trainee at [ARIVA.DE](https://www.ariva.de), a stock price portal" , "Frontend Developer creating visualization tools at [graphomate GmbH](http://www.graphomate.com)" ] } misc : Group misc = { title = "Misc" , names = [ "Languages", "Non-technical hobbies" ] , content = [ "German (mother tounge), English (fluent)" , "photography, literature, comic books, drums, roleplaying and boardgames, woodworking" ] }
elm
[ { "context": "[]\n }\n\nimages =\n { articleCovers =\n { chrisBarbalis0 = (buildImage [ \"article-covers\", \"chris-barbali", "end": 2779, "score": 0.671285212, "start": 2766, "tag": "NAME", "value": "chrisBarbalis" }, { "context": "-england-1.jpg\" ])\n , (buildImage [ \"author\", \"tomke.jpg\" ])\n , (buildImage [ \"elm-logo.svg\" ])\n , (", "end": 3974, "score": 0.9710190296, "start": 3965, "tag": "USERNAME", "value": "tomke.jpg" }, { "context": " , { frontMatter = \"\"\"{\"type\":\"blog\",\"author\":\"Tomke Reibisch\",\"title\":\"December 2019\",\"description\":\"Fun fact:", "end": 4959, "score": 0.9998785853, "start": 4945, "tag": "NAME", "value": "Tomke Reibisch" }, { "context": " , { frontMatter = \"\"\"{\"type\":\"blog\",\"author\":\"Tomke Reibisch\",\"title\":\"Februar 2020\",\"description\":\"Fun fact: ", "end": 5318, "score": 0.9998822212, "start": 5304, "tag": "NAME", "value": "Tomke Reibisch" }, { "context": " , { frontMatter = \"\"\"{\"type\":\"blog\",\"author\":\"Tomke Reibisch\",\"title\":\"November 2019\",\"description\":\"Fun Fact:", "end": 5634, "score": 0.9998610616, "start": 5620, "tag": "NAME", "value": "Tomke Reibisch" } ]
gen/Pages.elm
naymspace/nmsp-reading-elm
0
port module Pages exposing (PathKey, allPages, allImages, application, images, isValidRoute, pages) import Color exposing (Color) import Head import Html exposing (Html) import Json.Decode import Json.Encode import Mark import Pages.Platform import Pages.ContentCache exposing (Page) import Pages.Manifest exposing (DisplayMode, Orientation) import Pages.Manifest.Category as Category exposing (Category) import Url.Parser as Url exposing ((</>), s) import Pages.Document as Document import Pages.ImagePath as ImagePath exposing (ImagePath) import Pages.PagePath as PagePath exposing (PagePath) import Pages.Directory as Directory exposing (Directory) type PathKey = PathKey buildImage : List String -> ImagePath PathKey buildImage path = ImagePath.build PathKey ("images" :: path) buildPage : List String -> PagePath PathKey buildPage path = PagePath.build PathKey path directoryWithIndex : List String -> Directory PathKey Directory.WithIndex directoryWithIndex path = Directory.withIndex PathKey allPages path directoryWithoutIndex : List String -> Directory PathKey Directory.WithoutIndex directoryWithoutIndex path = Directory.withoutIndex PathKey allPages path port toJsPort : Json.Encode.Value -> Cmd msg application : { init : ( userModel, Cmd userMsg ) , update : userMsg -> userModel -> ( userModel, Cmd userMsg ) , subscriptions : userModel -> Sub userMsg , view : userModel -> List ( PagePath PathKey, metadata ) -> Page metadata view PathKey -> { title : String, body : Html userMsg } , head : metadata -> List (Head.Tag PathKey) , documents : List ( String, Document.DocumentHandler metadata view ) , manifest : Pages.Manifest.Config PathKey , canonicalSiteUrl : String } -> Pages.Platform.Program userModel userMsg metadata view application config = Pages.Platform.application { init = config.init , view = config.view , update = config.update , subscriptions = config.subscriptions , document = Document.fromList config.documents , content = content , toJsPort = toJsPort , head = config.head , manifest = config.manifest , canonicalSiteUrl = config.canonicalSiteUrl , pathKey = PathKey } allPages : List (PagePath PathKey) allPages = [ (buildPage [ ]) , (buildPage [ "reading-dez-19" ]) , (buildPage [ "reading-feb-20" ]) , (buildPage [ "reading-nov-19" ]) ] pages = { index = (buildPage [ ]) , readingDez19 = (buildPage [ "reading-dez-19" ]) , readingFeb20 = (buildPage [ "reading-feb-20" ]) , readingNov19 = (buildPage [ "reading-nov-19" ]) , directory = directoryWithIndex [] } images = { articleCovers = { chrisBarbalis0 = (buildImage [ "article-covers", "chris-barbalis-0.jpg" ]) , hello = (buildImage [ "article-covers", "hello.jpg" ]) , mikeKotsch2 = (buildImage [ "article-covers", "mike-kotsch-2.jpg" ]) , mountains = (buildImage [ "article-covers", "mountains.jpg" ]) , steinarEngland1 = (buildImage [ "article-covers", "steinar-england-1.jpg" ]) , directory = directoryWithoutIndex ["articleCovers"] } , author = { tomke = (buildImage [ "author", "tomke.jpg" ]) , directory = directoryWithoutIndex ["author"] } , elmLogo = (buildImage [ "elm-logo.svg" ]) , github = (buildImage [ "github.svg" ]) , iconPng = (buildImage [ "icon-png.png" ]) , icon = (buildImage [ "icon.svg" ]) , directory = directoryWithoutIndex [] } allImages : List (ImagePath PathKey) allImages = [(buildImage [ "article-covers", "chris-barbalis-0.jpg" ]) , (buildImage [ "article-covers", "hello.jpg" ]) , (buildImage [ "article-covers", "mike-kotsch-2.jpg" ]) , (buildImage [ "article-covers", "mountains.jpg" ]) , (buildImage [ "article-covers", "steinar-england-1.jpg" ]) , (buildImage [ "author", "tomke.jpg" ]) , (buildImage [ "elm-logo.svg" ]) , (buildImage [ "github.svg" ]) , (buildImage [ "icon-png.png" ]) , (buildImage [ "icon.svg" ]) ] isValidRoute : String -> Result String () isValidRoute route = let validRoutes = List.map PagePath.toString allPages in if (route |> String.startsWith "http://") || (route |> String.startsWith "https://") || (route |> String.startsWith "#") || (validRoutes |> List.member route) then Ok () else ("Valid routes:\n" ++ String.join "\n\n" validRoutes ) |> Err content : List ( List String, { extension: String, frontMatter : String, body : Maybe String } ) content = [ ( [] , { frontMatter = """{"title":"nmsp reading","type":"blog-index"} """ , body = Nothing , extension = "md" } ) , ( ["reading-dez-19"] , { frontMatter = """{"type":"blog","author":"Tomke Reibisch","title":"December 2019","description":"Fun fact: December in the Northern Hemisphere is similar to June in the Southern Hemisphere.","image":"/images/article-covers/steinar-england-1.jpg","published":"2019-12-17"} """ , body = Nothing , extension = "md" } ) , ( ["reading-feb-20"] , { frontMatter = """{"type":"blog","author":"Tomke Reibisch","title":"Februar 2020","description":"Fun fact: There are not many Fun Facts about months...","image":"/images/article-covers/mike-kotsch-2.jpg","published":"2020-02-07"} """ , body = Nothing , extension = "md" } ) , ( ["reading-nov-19"] , { frontMatter = """{"type":"blog","author":"Tomke Reibisch","title":"November 2019","description":"Fun Fact: November was referred to as Blōtmōnaþ by the Anglo-Saxons.","image":"/images/article-covers/chris-barbalis-0.jpg","published":"2019-11-29"} """ , body = Nothing , extension = "md" } ) ]
31864
port module Pages exposing (PathKey, allPages, allImages, application, images, isValidRoute, pages) import Color exposing (Color) import Head import Html exposing (Html) import Json.Decode import Json.Encode import Mark import Pages.Platform import Pages.ContentCache exposing (Page) import Pages.Manifest exposing (DisplayMode, Orientation) import Pages.Manifest.Category as Category exposing (Category) import Url.Parser as Url exposing ((</>), s) import Pages.Document as Document import Pages.ImagePath as ImagePath exposing (ImagePath) import Pages.PagePath as PagePath exposing (PagePath) import Pages.Directory as Directory exposing (Directory) type PathKey = PathKey buildImage : List String -> ImagePath PathKey buildImage path = ImagePath.build PathKey ("images" :: path) buildPage : List String -> PagePath PathKey buildPage path = PagePath.build PathKey path directoryWithIndex : List String -> Directory PathKey Directory.WithIndex directoryWithIndex path = Directory.withIndex PathKey allPages path directoryWithoutIndex : List String -> Directory PathKey Directory.WithoutIndex directoryWithoutIndex path = Directory.withoutIndex PathKey allPages path port toJsPort : Json.Encode.Value -> Cmd msg application : { init : ( userModel, Cmd userMsg ) , update : userMsg -> userModel -> ( userModel, Cmd userMsg ) , subscriptions : userModel -> Sub userMsg , view : userModel -> List ( PagePath PathKey, metadata ) -> Page metadata view PathKey -> { title : String, body : Html userMsg } , head : metadata -> List (Head.Tag PathKey) , documents : List ( String, Document.DocumentHandler metadata view ) , manifest : Pages.Manifest.Config PathKey , canonicalSiteUrl : String } -> Pages.Platform.Program userModel userMsg metadata view application config = Pages.Platform.application { init = config.init , view = config.view , update = config.update , subscriptions = config.subscriptions , document = Document.fromList config.documents , content = content , toJsPort = toJsPort , head = config.head , manifest = config.manifest , canonicalSiteUrl = config.canonicalSiteUrl , pathKey = PathKey } allPages : List (PagePath PathKey) allPages = [ (buildPage [ ]) , (buildPage [ "reading-dez-19" ]) , (buildPage [ "reading-feb-20" ]) , (buildPage [ "reading-nov-19" ]) ] pages = { index = (buildPage [ ]) , readingDez19 = (buildPage [ "reading-dez-19" ]) , readingFeb20 = (buildPage [ "reading-feb-20" ]) , readingNov19 = (buildPage [ "reading-nov-19" ]) , directory = directoryWithIndex [] } images = { articleCovers = { <NAME>0 = (buildImage [ "article-covers", "chris-barbalis-0.jpg" ]) , hello = (buildImage [ "article-covers", "hello.jpg" ]) , mikeKotsch2 = (buildImage [ "article-covers", "mike-kotsch-2.jpg" ]) , mountains = (buildImage [ "article-covers", "mountains.jpg" ]) , steinarEngland1 = (buildImage [ "article-covers", "steinar-england-1.jpg" ]) , directory = directoryWithoutIndex ["articleCovers"] } , author = { tomke = (buildImage [ "author", "tomke.jpg" ]) , directory = directoryWithoutIndex ["author"] } , elmLogo = (buildImage [ "elm-logo.svg" ]) , github = (buildImage [ "github.svg" ]) , iconPng = (buildImage [ "icon-png.png" ]) , icon = (buildImage [ "icon.svg" ]) , directory = directoryWithoutIndex [] } allImages : List (ImagePath PathKey) allImages = [(buildImage [ "article-covers", "chris-barbalis-0.jpg" ]) , (buildImage [ "article-covers", "hello.jpg" ]) , (buildImage [ "article-covers", "mike-kotsch-2.jpg" ]) , (buildImage [ "article-covers", "mountains.jpg" ]) , (buildImage [ "article-covers", "steinar-england-1.jpg" ]) , (buildImage [ "author", "tomke.jpg" ]) , (buildImage [ "elm-logo.svg" ]) , (buildImage [ "github.svg" ]) , (buildImage [ "icon-png.png" ]) , (buildImage [ "icon.svg" ]) ] isValidRoute : String -> Result String () isValidRoute route = let validRoutes = List.map PagePath.toString allPages in if (route |> String.startsWith "http://") || (route |> String.startsWith "https://") || (route |> String.startsWith "#") || (validRoutes |> List.member route) then Ok () else ("Valid routes:\n" ++ String.join "\n\n" validRoutes ) |> Err content : List ( List String, { extension: String, frontMatter : String, body : Maybe String } ) content = [ ( [] , { frontMatter = """{"title":"nmsp reading","type":"blog-index"} """ , body = Nothing , extension = "md" } ) , ( ["reading-dez-19"] , { frontMatter = """{"type":"blog","author":"<NAME>","title":"December 2019","description":"Fun fact: December in the Northern Hemisphere is similar to June in the Southern Hemisphere.","image":"/images/article-covers/steinar-england-1.jpg","published":"2019-12-17"} """ , body = Nothing , extension = "md" } ) , ( ["reading-feb-20"] , { frontMatter = """{"type":"blog","author":"<NAME>","title":"Februar 2020","description":"Fun fact: There are not many Fun Facts about months...","image":"/images/article-covers/mike-kotsch-2.jpg","published":"2020-02-07"} """ , body = Nothing , extension = "md" } ) , ( ["reading-nov-19"] , { frontMatter = """{"type":"blog","author":"<NAME>","title":"November 2019","description":"Fun Fact: November was referred to as Blōtmōnaþ by the Anglo-Saxons.","image":"/images/article-covers/chris-barbalis-0.jpg","published":"2019-11-29"} """ , body = Nothing , extension = "md" } ) ]
true
port module Pages exposing (PathKey, allPages, allImages, application, images, isValidRoute, pages) import Color exposing (Color) import Head import Html exposing (Html) import Json.Decode import Json.Encode import Mark import Pages.Platform import Pages.ContentCache exposing (Page) import Pages.Manifest exposing (DisplayMode, Orientation) import Pages.Manifest.Category as Category exposing (Category) import Url.Parser as Url exposing ((</>), s) import Pages.Document as Document import Pages.ImagePath as ImagePath exposing (ImagePath) import Pages.PagePath as PagePath exposing (PagePath) import Pages.Directory as Directory exposing (Directory) type PathKey = PathKey buildImage : List String -> ImagePath PathKey buildImage path = ImagePath.build PathKey ("images" :: path) buildPage : List String -> PagePath PathKey buildPage path = PagePath.build PathKey path directoryWithIndex : List String -> Directory PathKey Directory.WithIndex directoryWithIndex path = Directory.withIndex PathKey allPages path directoryWithoutIndex : List String -> Directory PathKey Directory.WithoutIndex directoryWithoutIndex path = Directory.withoutIndex PathKey allPages path port toJsPort : Json.Encode.Value -> Cmd msg application : { init : ( userModel, Cmd userMsg ) , update : userMsg -> userModel -> ( userModel, Cmd userMsg ) , subscriptions : userModel -> Sub userMsg , view : userModel -> List ( PagePath PathKey, metadata ) -> Page metadata view PathKey -> { title : String, body : Html userMsg } , head : metadata -> List (Head.Tag PathKey) , documents : List ( String, Document.DocumentHandler metadata view ) , manifest : Pages.Manifest.Config PathKey , canonicalSiteUrl : String } -> Pages.Platform.Program userModel userMsg metadata view application config = Pages.Platform.application { init = config.init , view = config.view , update = config.update , subscriptions = config.subscriptions , document = Document.fromList config.documents , content = content , toJsPort = toJsPort , head = config.head , manifest = config.manifest , canonicalSiteUrl = config.canonicalSiteUrl , pathKey = PathKey } allPages : List (PagePath PathKey) allPages = [ (buildPage [ ]) , (buildPage [ "reading-dez-19" ]) , (buildPage [ "reading-feb-20" ]) , (buildPage [ "reading-nov-19" ]) ] pages = { index = (buildPage [ ]) , readingDez19 = (buildPage [ "reading-dez-19" ]) , readingFeb20 = (buildPage [ "reading-feb-20" ]) , readingNov19 = (buildPage [ "reading-nov-19" ]) , directory = directoryWithIndex [] } images = { articleCovers = { PI:NAME:<NAME>END_PI0 = (buildImage [ "article-covers", "chris-barbalis-0.jpg" ]) , hello = (buildImage [ "article-covers", "hello.jpg" ]) , mikeKotsch2 = (buildImage [ "article-covers", "mike-kotsch-2.jpg" ]) , mountains = (buildImage [ "article-covers", "mountains.jpg" ]) , steinarEngland1 = (buildImage [ "article-covers", "steinar-england-1.jpg" ]) , directory = directoryWithoutIndex ["articleCovers"] } , author = { tomke = (buildImage [ "author", "tomke.jpg" ]) , directory = directoryWithoutIndex ["author"] } , elmLogo = (buildImage [ "elm-logo.svg" ]) , github = (buildImage [ "github.svg" ]) , iconPng = (buildImage [ "icon-png.png" ]) , icon = (buildImage [ "icon.svg" ]) , directory = directoryWithoutIndex [] } allImages : List (ImagePath PathKey) allImages = [(buildImage [ "article-covers", "chris-barbalis-0.jpg" ]) , (buildImage [ "article-covers", "hello.jpg" ]) , (buildImage [ "article-covers", "mike-kotsch-2.jpg" ]) , (buildImage [ "article-covers", "mountains.jpg" ]) , (buildImage [ "article-covers", "steinar-england-1.jpg" ]) , (buildImage [ "author", "tomke.jpg" ]) , (buildImage [ "elm-logo.svg" ]) , (buildImage [ "github.svg" ]) , (buildImage [ "icon-png.png" ]) , (buildImage [ "icon.svg" ]) ] isValidRoute : String -> Result String () isValidRoute route = let validRoutes = List.map PagePath.toString allPages in if (route |> String.startsWith "http://") || (route |> String.startsWith "https://") || (route |> String.startsWith "#") || (validRoutes |> List.member route) then Ok () else ("Valid routes:\n" ++ String.join "\n\n" validRoutes ) |> Err content : List ( List String, { extension: String, frontMatter : String, body : Maybe String } ) content = [ ( [] , { frontMatter = """{"title":"nmsp reading","type":"blog-index"} """ , body = Nothing , extension = "md" } ) , ( ["reading-dez-19"] , { frontMatter = """{"type":"blog","author":"PI:NAME:<NAME>END_PI","title":"December 2019","description":"Fun fact: December in the Northern Hemisphere is similar to June in the Southern Hemisphere.","image":"/images/article-covers/steinar-england-1.jpg","published":"2019-12-17"} """ , body = Nothing , extension = "md" } ) , ( ["reading-feb-20"] , { frontMatter = """{"type":"blog","author":"PI:NAME:<NAME>END_PI","title":"Februar 2020","description":"Fun fact: There are not many Fun Facts about months...","image":"/images/article-covers/mike-kotsch-2.jpg","published":"2020-02-07"} """ , body = Nothing , extension = "md" } ) , ( ["reading-nov-19"] , { frontMatter = """{"type":"blog","author":"PI:NAME:<NAME>END_PI","title":"November 2019","description":"Fun Fact: November was referred to as Blōtmōnaþ by the Anglo-Saxons.","image":"/images/article-covers/chris-barbalis-0.jpg","published":"2019-11-29"} """ , body = Nothing , extension = "md" } ) ]
elm
[ { "context": "downloaded from https://raw.githubusercontent.com/AdobeDocs/cloudmanager-api-docs/master/swagger-specs/api.ya", "end": 506, "score": 0.9984755516, "start": 497, "tag": "USERNAME", "value": "AdobeDocs" }, { "context": "version of the OpenAPI document: 1.0.0\n Contact: opensource@shinesolutions.com\n\n NOTE: This file is auto generated by the open", "end": 648, "score": 0.9999157786, "start": 619, "tag": "EMAIL", "value": "opensource@shinesolutions.com" }, { "context": "d by the openapi-generator.\n https://github.com/openapitools/openapi-generator.git\n Do not edit this file ma", "end": 747, "score": 0.9995190501, "start": 735, "tag": "USERNAME", "value": "openapitools" } ]
clients/elm/generated/src/Request/Pipelines.elm
shinesolutions/cloudmanager-api-clients
3
{- Cloud Manager API This API allows access to Cloud Manager programs, pipelines, and environments by an authorized technical account created through the Adobe I/O Console. The base url for this API is https://cloudmanager.adobe.io, e.g. to get the list of programs for an organization, you would make a GET request to https://cloudmanager.adobe.io/api/programs (with the correct set of headers as described below). This swagger file can be downloaded from https://raw.githubusercontent.com/AdobeDocs/cloudmanager-api-docs/master/swagger-specs/api.yaml. The version of the OpenAPI document: 1.0.0 Contact: opensource@shinesolutions.com NOTE: This file is auto generated by the openapi-generator. https://github.com/openapitools/openapi-generator.git Do not edit this file manually. -} module Request.Pipelines exposing (deletePipeline, getPipeline, getPipelines, patchPipeline) import Data.PipelineList as PipelineList exposing (PipelineList) import Data.Pipeline as Pipeline exposing (Pipeline) import Dict import Http import Json.Decode as Decode import Url.Builder as Url basePath : String basePath = "https://cloudmanager.adobe.io" {-| Delete a pipeline. All the data is wiped. -} deletePipeline : { xGwImsOrgId : String , authorization : String , xApiKey : String } -> { onSend : Result Http.Error () -> msg , programId : String , pipelineId : String } -> Cmd msg deletePipeline headers params = Http.request { method = "DELETE" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipeline", identity params.pipelineId] (List.filterMap identity []) , body = Http.emptyBody , expect = Http.expectWhatever params.onSend , timeout = Just 30000 , tracker = Nothing } {-| Returns a pipeline by its id -} getPipeline : { xGwImsOrgId : String , authorization : String , xApiKey : String } -> { onSend : Result Http.Error Pipeline -> msg , programId : String , pipelineId : String } -> Cmd msg getPipeline headers params = Http.request { method = "GET" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipeline", identity params.pipelineId] (List.filterMap identity []) , body = Http.emptyBody , expect = Http.expectJson params.onSend Pipeline.decoder , timeout = Just 30000 , tracker = Nothing } {-| Returns all the pipelines that the requesting user has access to in an program -} getPipelines : { xGwImsOrgId : String , authorization : String , xApiKey : String } -> { onSend : Result Http.Error PipelineList -> msg , programId : String } -> Cmd msg getPipelines headers params = Http.request { method = "GET" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipelines"] (List.filterMap identity []) , body = Http.emptyBody , expect = Http.expectJson params.onSend PipelineList.decoder , timeout = Just 30000 , tracker = Nothing } {-| Patches a pipeline within an program. -} patchPipeline : { xGwImsOrgId : String , authorization : String , xApiKey : String , contentType : String } -> { onSend : Result Http.Error Pipeline -> msg , body : Pipeline , programId : String , pipelineId : String } -> Cmd msg patchPipeline headers params = Http.request { method = "PATCH" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey, (Just << Http.header "Content-Type" << identity) headers.contentType] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipeline", identity params.pipelineId] (List.filterMap identity []) , body = Http.jsonBody <| Pipeline.encode params.body , expect = Http.expectJson params.onSend Pipeline.decoder , timeout = Just 30000 , tracker = Nothing }
31730
{- Cloud Manager API This API allows access to Cloud Manager programs, pipelines, and environments by an authorized technical account created through the Adobe I/O Console. The base url for this API is https://cloudmanager.adobe.io, e.g. to get the list of programs for an organization, you would make a GET request to https://cloudmanager.adobe.io/api/programs (with the correct set of headers as described below). This swagger file can be downloaded from https://raw.githubusercontent.com/AdobeDocs/cloudmanager-api-docs/master/swagger-specs/api.yaml. The version of the OpenAPI document: 1.0.0 Contact: <EMAIL> NOTE: This file is auto generated by the openapi-generator. https://github.com/openapitools/openapi-generator.git Do not edit this file manually. -} module Request.Pipelines exposing (deletePipeline, getPipeline, getPipelines, patchPipeline) import Data.PipelineList as PipelineList exposing (PipelineList) import Data.Pipeline as Pipeline exposing (Pipeline) import Dict import Http import Json.Decode as Decode import Url.Builder as Url basePath : String basePath = "https://cloudmanager.adobe.io" {-| Delete a pipeline. All the data is wiped. -} deletePipeline : { xGwImsOrgId : String , authorization : String , xApiKey : String } -> { onSend : Result Http.Error () -> msg , programId : String , pipelineId : String } -> Cmd msg deletePipeline headers params = Http.request { method = "DELETE" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipeline", identity params.pipelineId] (List.filterMap identity []) , body = Http.emptyBody , expect = Http.expectWhatever params.onSend , timeout = Just 30000 , tracker = Nothing } {-| Returns a pipeline by its id -} getPipeline : { xGwImsOrgId : String , authorization : String , xApiKey : String } -> { onSend : Result Http.Error Pipeline -> msg , programId : String , pipelineId : String } -> Cmd msg getPipeline headers params = Http.request { method = "GET" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipeline", identity params.pipelineId] (List.filterMap identity []) , body = Http.emptyBody , expect = Http.expectJson params.onSend Pipeline.decoder , timeout = Just 30000 , tracker = Nothing } {-| Returns all the pipelines that the requesting user has access to in an program -} getPipelines : { xGwImsOrgId : String , authorization : String , xApiKey : String } -> { onSend : Result Http.Error PipelineList -> msg , programId : String } -> Cmd msg getPipelines headers params = Http.request { method = "GET" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipelines"] (List.filterMap identity []) , body = Http.emptyBody , expect = Http.expectJson params.onSend PipelineList.decoder , timeout = Just 30000 , tracker = Nothing } {-| Patches a pipeline within an program. -} patchPipeline : { xGwImsOrgId : String , authorization : String , xApiKey : String , contentType : String } -> { onSend : Result Http.Error Pipeline -> msg , body : Pipeline , programId : String , pipelineId : String } -> Cmd msg patchPipeline headers params = Http.request { method = "PATCH" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey, (Just << Http.header "Content-Type" << identity) headers.contentType] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipeline", identity params.pipelineId] (List.filterMap identity []) , body = Http.jsonBody <| Pipeline.encode params.body , expect = Http.expectJson params.onSend Pipeline.decoder , timeout = Just 30000 , tracker = Nothing }
true
{- Cloud Manager API This API allows access to Cloud Manager programs, pipelines, and environments by an authorized technical account created through the Adobe I/O Console. The base url for this API is https://cloudmanager.adobe.io, e.g. to get the list of programs for an organization, you would make a GET request to https://cloudmanager.adobe.io/api/programs (with the correct set of headers as described below). This swagger file can be downloaded from https://raw.githubusercontent.com/AdobeDocs/cloudmanager-api-docs/master/swagger-specs/api.yaml. The version of the OpenAPI document: 1.0.0 Contact: PI:EMAIL:<EMAIL>END_PI NOTE: This file is auto generated by the openapi-generator. https://github.com/openapitools/openapi-generator.git Do not edit this file manually. -} module Request.Pipelines exposing (deletePipeline, getPipeline, getPipelines, patchPipeline) import Data.PipelineList as PipelineList exposing (PipelineList) import Data.Pipeline as Pipeline exposing (Pipeline) import Dict import Http import Json.Decode as Decode import Url.Builder as Url basePath : String basePath = "https://cloudmanager.adobe.io" {-| Delete a pipeline. All the data is wiped. -} deletePipeline : { xGwImsOrgId : String , authorization : String , xApiKey : String } -> { onSend : Result Http.Error () -> msg , programId : String , pipelineId : String } -> Cmd msg deletePipeline headers params = Http.request { method = "DELETE" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipeline", identity params.pipelineId] (List.filterMap identity []) , body = Http.emptyBody , expect = Http.expectWhatever params.onSend , timeout = Just 30000 , tracker = Nothing } {-| Returns a pipeline by its id -} getPipeline : { xGwImsOrgId : String , authorization : String , xApiKey : String } -> { onSend : Result Http.Error Pipeline -> msg , programId : String , pipelineId : String } -> Cmd msg getPipeline headers params = Http.request { method = "GET" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipeline", identity params.pipelineId] (List.filterMap identity []) , body = Http.emptyBody , expect = Http.expectJson params.onSend Pipeline.decoder , timeout = Just 30000 , tracker = Nothing } {-| Returns all the pipelines that the requesting user has access to in an program -} getPipelines : { xGwImsOrgId : String , authorization : String , xApiKey : String } -> { onSend : Result Http.Error PipelineList -> msg , programId : String } -> Cmd msg getPipelines headers params = Http.request { method = "GET" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipelines"] (List.filterMap identity []) , body = Http.emptyBody , expect = Http.expectJson params.onSend PipelineList.decoder , timeout = Just 30000 , tracker = Nothing } {-| Patches a pipeline within an program. -} patchPipeline : { xGwImsOrgId : String , authorization : String , xApiKey : String , contentType : String } -> { onSend : Result Http.Error Pipeline -> msg , body : Pipeline , programId : String , pipelineId : String } -> Cmd msg patchPipeline headers params = Http.request { method = "PATCH" , headers = List.filterMap identity [(Just << Http.header "x-gw-ims-org-id" << identity) headers.xGwImsOrgId, (Just << Http.header "Authorization" << identity) headers.authorization, (Just << Http.header "x-api-key" << identity) headers.xApiKey, (Just << Http.header "Content-Type" << identity) headers.contentType] , url = Url.crossOrigin basePath ["api", "program", identity params.programId, "pipeline", identity params.pipelineId] (List.filterMap identity []) , body = Http.jsonBody <| Pipeline.encode params.body , expect = Http.expectJson params.onSend Pipeline.decoder , timeout = Just 30000 , tracker = Nothing }
elm
[ { "context": " SessionStartFirstClub\n { facilitatedBy = \"Katja & Rupert\"\n , miroLink = miroLink\n , annotati", "end": 2863, "score": 0.9939196706, "start": 2849, "tag": "NAME", "value": "Katja & Rupert" }, { "context": "Signal.\"\n , codeLink = \"https://github.com/signalapp/Signal-iOS/blob/b68d8a3c8147feb2b69e7421a625608c4", "end": 3274, "score": 0.9984843731, "start": 3265, "tag": "USERNAME", "value": "signalapp" } ]
src/Slides.elm
katjam/code-reading-runner
0
module Slides exposing (Message, Model, slides, subscriptions, update, view) import Exercises as Exercises exposing (Section(..)) import Html exposing (Html, a, button, div, h1, h2, hr, img, li, p, span, text, ul) import Html.Attributes exposing (class, href, src, style) import Html.Events exposing (onClick) import Markdown import SharedType exposing (CustomContent, CustomSlide, Message(..), Model) import SliceShow.Content exposing (..) import SliceShow.Slide exposing (..) import Time exposing (Posix) type alias Message = SharedType.Message type alias Model = SharedType.Model {-| Update function for the custom content -} update : Message -> Model -> ( Model, Cmd Message ) update msg model = case msg of Tick _ -> ( { model | displayTime = model.displayTime - 1000 }, Cmd.none ) AddStartMinute -> ( { model | startTime = model.startTime + 60 }, Cmd.none ) StartStopPressed state -> ( { model | displayTime = model.startTime * 1000 , timerStarted = not state } , Cmd.none ) {-| View function for the custom content that shows time remaining -} view : Model -> Html Message view model = div [ class "stopwatch" ] [ span [] [ if model.startTime /= 0 && model.timerStarted then if model.displayTime > 0 then text ((round model.displayTime // 1000 |> String.fromInt) ++ " seconds" ) else text "Time's up" else button [ onClick AddStartMinute ] [ text (String.fromFloat model.startTime) ] ] , button [ onClick (StartStopPressed model.timerStarted) ] [ if model.timerStarted then text "" else text "Go !" ] ] {-| Inputs for the custom content -} subscriptions : Model -> Sub Message subscriptions model = if model.timerStarted then Time.every 1000 Tick else Sub.none annotationLink : String annotationLink = "https://annotate.code-reading.org/#/file/M4Sw5gdghgNlAO8D0Blc0YFoQHkVICMYB7AwgNgA4ATSqAZgGNKBGAFgHYAzAUwICYC5AJw8Obfiyjl+AVnIAGSozZsCwyuVn9U6WEmAAnRkgCyxajxjAkABQAWxCDwByAVwC2BHoYBqsEGooABdiQwA6YAB3EC5goA" miroLink : String miroLink = "https://miro.com/welcomeonboard/VndMbGZvZlN2R3hVVzZwdXkyTEh6VkJUVHdQb0FXdnA3am11UmFybWFremtQT25sYVA3cUxpU2E4eDFocWF1ZXwzMDc0NDU3MzQ5MTgyMDYwNDgy?invite_link_id=5347545442" {-| The list of slides -} slides : List CustomSlide slides = [ SessionStartFirstClub { facilitatedBy = "Katja & Rupert" , miroLink = miroLink , annotationLink = annotationLink , pdfLink = "" } , FirstGlance , SecondThoughts , AnnotateStructure { annotationLink = annotationLink, pdfLink = "" } , ImportantLines , Summarise , SessionEnd { codeDescription = "PhoneNumberValidator.swift for the messaging app Signal." , codeLink = "https://github.com/signalapp/Signal-iOS/blob/b68d8a3c8147feb2b69e7421a625608c44b98652/Signal/src/Models/PhoneNumberValidator.swift" } ] |> List.map (\section -> Exercises.slideContent section) |> List.concat |> List.map Exercises.paddedSlide
12627
module Slides exposing (Message, Model, slides, subscriptions, update, view) import Exercises as Exercises exposing (Section(..)) import Html exposing (Html, a, button, div, h1, h2, hr, img, li, p, span, text, ul) import Html.Attributes exposing (class, href, src, style) import Html.Events exposing (onClick) import Markdown import SharedType exposing (CustomContent, CustomSlide, Message(..), Model) import SliceShow.Content exposing (..) import SliceShow.Slide exposing (..) import Time exposing (Posix) type alias Message = SharedType.Message type alias Model = SharedType.Model {-| Update function for the custom content -} update : Message -> Model -> ( Model, Cmd Message ) update msg model = case msg of Tick _ -> ( { model | displayTime = model.displayTime - 1000 }, Cmd.none ) AddStartMinute -> ( { model | startTime = model.startTime + 60 }, Cmd.none ) StartStopPressed state -> ( { model | displayTime = model.startTime * 1000 , timerStarted = not state } , Cmd.none ) {-| View function for the custom content that shows time remaining -} view : Model -> Html Message view model = div [ class "stopwatch" ] [ span [] [ if model.startTime /= 0 && model.timerStarted then if model.displayTime > 0 then text ((round model.displayTime // 1000 |> String.fromInt) ++ " seconds" ) else text "Time's up" else button [ onClick AddStartMinute ] [ text (String.fromFloat model.startTime) ] ] , button [ onClick (StartStopPressed model.timerStarted) ] [ if model.timerStarted then text "" else text "Go !" ] ] {-| Inputs for the custom content -} subscriptions : Model -> Sub Message subscriptions model = if model.timerStarted then Time.every 1000 Tick else Sub.none annotationLink : String annotationLink = "https://annotate.code-reading.org/#/file/M4Sw5gdghgNlAO8D0Blc0YFoQHkVICMYB7AwgNgA4ATSqAZgGNKBGAFgHYAzAUwICYC5AJw8Obfiyjl+AVnIAGSozZsCwyuVn9U6WEmAAnRkgCyxajxjAkABQAWxCDwByAVwC2BHoYBqsEGooABdiQwA6YAB3EC5goA" miroLink : String miroLink = "https://miro.com/welcomeonboard/VndMbGZvZlN2R3hVVzZwdXkyTEh6VkJUVHdQb0FXdnA3am11UmFybWFremtQT25sYVA3cUxpU2E4eDFocWF1ZXwzMDc0NDU3MzQ5MTgyMDYwNDgy?invite_link_id=5347545442" {-| The list of slides -} slides : List CustomSlide slides = [ SessionStartFirstClub { facilitatedBy = "<NAME>" , miroLink = miroLink , annotationLink = annotationLink , pdfLink = "" } , FirstGlance , SecondThoughts , AnnotateStructure { annotationLink = annotationLink, pdfLink = "" } , ImportantLines , Summarise , SessionEnd { codeDescription = "PhoneNumberValidator.swift for the messaging app Signal." , codeLink = "https://github.com/signalapp/Signal-iOS/blob/b68d8a3c8147feb2b69e7421a625608c44b98652/Signal/src/Models/PhoneNumberValidator.swift" } ] |> List.map (\section -> Exercises.slideContent section) |> List.concat |> List.map Exercises.paddedSlide
true
module Slides exposing (Message, Model, slides, subscriptions, update, view) import Exercises as Exercises exposing (Section(..)) import Html exposing (Html, a, button, div, h1, h2, hr, img, li, p, span, text, ul) import Html.Attributes exposing (class, href, src, style) import Html.Events exposing (onClick) import Markdown import SharedType exposing (CustomContent, CustomSlide, Message(..), Model) import SliceShow.Content exposing (..) import SliceShow.Slide exposing (..) import Time exposing (Posix) type alias Message = SharedType.Message type alias Model = SharedType.Model {-| Update function for the custom content -} update : Message -> Model -> ( Model, Cmd Message ) update msg model = case msg of Tick _ -> ( { model | displayTime = model.displayTime - 1000 }, Cmd.none ) AddStartMinute -> ( { model | startTime = model.startTime + 60 }, Cmd.none ) StartStopPressed state -> ( { model | displayTime = model.startTime * 1000 , timerStarted = not state } , Cmd.none ) {-| View function for the custom content that shows time remaining -} view : Model -> Html Message view model = div [ class "stopwatch" ] [ span [] [ if model.startTime /= 0 && model.timerStarted then if model.displayTime > 0 then text ((round model.displayTime // 1000 |> String.fromInt) ++ " seconds" ) else text "Time's up" else button [ onClick AddStartMinute ] [ text (String.fromFloat model.startTime) ] ] , button [ onClick (StartStopPressed model.timerStarted) ] [ if model.timerStarted then text "" else text "Go !" ] ] {-| Inputs for the custom content -} subscriptions : Model -> Sub Message subscriptions model = if model.timerStarted then Time.every 1000 Tick else Sub.none annotationLink : String annotationLink = "https://annotate.code-reading.org/#/file/M4Sw5gdghgNlAO8D0Blc0YFoQHkVICMYB7AwgNgA4ATSqAZgGNKBGAFgHYAzAUwICYC5AJw8Obfiyjl+AVnIAGSozZsCwyuVn9U6WEmAAnRkgCyxajxjAkABQAWxCDwByAVwC2BHoYBqsEGooABdiQwA6YAB3EC5goA" miroLink : String miroLink = "https://miro.com/welcomeonboard/VndMbGZvZlN2R3hVVzZwdXkyTEh6VkJUVHdQb0FXdnA3am11UmFybWFremtQT25sYVA3cUxpU2E4eDFocWF1ZXwzMDc0NDU3MzQ5MTgyMDYwNDgy?invite_link_id=5347545442" {-| The list of slides -} slides : List CustomSlide slides = [ SessionStartFirstClub { facilitatedBy = "PI:NAME:<NAME>END_PI" , miroLink = miroLink , annotationLink = annotationLink , pdfLink = "" } , FirstGlance , SecondThoughts , AnnotateStructure { annotationLink = annotationLink, pdfLink = "" } , ImportantLines , Summarise , SessionEnd { codeDescription = "PhoneNumberValidator.swift for the messaging app Signal." , codeLink = "https://github.com/signalapp/Signal-iOS/blob/b68d8a3c8147feb2b69e7421a625608c44b98652/Signal/src/Models/PhoneNumberValidator.swift" } ] |> List.map (\section -> Exercises.slideContent section) |> List.concat |> List.map Exercises.paddedSlide
elm
[ { "context": "assword pass ->\n ( { model | password = pass }, Cmd.none )\n\n SetUserName uName ->\n ", "end": 855, "score": 0.9952008128, "start": 851, "tag": "PASSWORD", "value": "pass" }, { "context": " , input [ onInput SetPassword, placeholder \"write your password\"\n ,style\n ", "end": 2344, "score": 0.7310079336, "start": 2334, "tag": "PASSWORD", "value": "write your" } ]
src/Adapter/FrontEnd/Login.elm
kwaleko/blog-post
0
module Login exposing (..) import Html exposing (..) import Html.Attributes exposing (placeholder, value,style) import Html.Events exposing (..) import Http import Navigation exposing (load) import Ports exposing (storeToken) import Types exposing (Auth, Session, encodeSession, postApiUsersLogin) type alias Model = { username : String , email : String , password : String , error : Maybe String , userid : Maybe Int } init : ( Model, Cmd Msg ) init = ( Model "" "" "" Nothing Nothing, Cmd.none ) type Msg = NoOp | SetUserName String | SetPassword String | Login | LoginAttempt (Result Http.Error Int) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NoOp -> ( model, Cmd.none ) SetPassword pass -> ( { model | password = pass }, Cmd.none ) SetUserName uName -> ( { model | username = uName }, Cmd.none ) LoginAttempt (Ok uId) -> ( { model | userid = Just uId }, Cmd.batch [ uId |> storeToken, load "http://localhost:8000/admin.html" ] ) LoginAttempt (Err message) -> ( { model | error = Just (toString message) }, Cmd.none ) Login -> ( model, registerCmd (Auth model.username model.password) ) view : Model -> Html Msg view model = let message = case model.error of Nothing -> "" Just error -> error in div [style [( "background-color", "#D55757" )]] [ h3 [] [ text "Register" ] , br [] [] , input [ onInput SetUserName, placeholder "write your username", style [ ( "background-color", "white" ) , ( "border", "none" ) , ( "color", " black" ) , ( "padding", "15px 32px" ) , ( "text-align", "center" ) , ( "text-decoration", "none" ) , ( "display", "inline-block" ) , ( "font-size", "16px" ) , ( "margin", "4px 2px" ) , ( "cursor", "pointer" ) , ( "width", "70%" ) , ( "height", "12px" ) ]] [] , br [] [] , input [ onInput SetPassword, placeholder "write your password" ,style [ ( "background-color", "white" ) , ( "border", "none" ) , ( "color", " black" ) , ( "padding", "15px 32px" ) , ( "text-align", "center" ) , ( "text-decoration", "none" ) , ( "display", "inline-block" ) , ( "font-size", "16px" ) , ( "margin", "4px 2px" ) , ( "cursor", "pointer" ) , ( "width", "70%" ) , ( "height", "12px" ) ]] [] , br [] [] , button [ onClick Login , style [ ( "background-color", "white" ) , ( "border", "none" ) , ( "color", " #D55757" ) , ( "padding", "15px 32px" ) , ( "text-align", "center" ) , ( "text-decoration", "none" ) , ( "display", "inline-block" ) , ( "font-size", "16px" ) , ( "margin", "4px 2px" ) , ( "cursor", "pointer" ) ]] [ text "Log In" ] , div [] [ text message ] ] registerCmd : Auth -> Cmd Msg registerCmd credential = Http.send LoginAttempt (postApiUsersLogin credential) subscriptions : Model -> Sub Msg subscriptions model = Sub.none main : Program Never Model Msg main = program { init = init , view = view , update = update , subscriptions = subscriptions }
22622
module Login exposing (..) import Html exposing (..) import Html.Attributes exposing (placeholder, value,style) import Html.Events exposing (..) import Http import Navigation exposing (load) import Ports exposing (storeToken) import Types exposing (Auth, Session, encodeSession, postApiUsersLogin) type alias Model = { username : String , email : String , password : String , error : Maybe String , userid : Maybe Int } init : ( Model, Cmd Msg ) init = ( Model "" "" "" Nothing Nothing, Cmd.none ) type Msg = NoOp | SetUserName String | SetPassword String | Login | LoginAttempt (Result Http.Error Int) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NoOp -> ( model, Cmd.none ) SetPassword pass -> ( { model | password = <PASSWORD> }, Cmd.none ) SetUserName uName -> ( { model | username = uName }, Cmd.none ) LoginAttempt (Ok uId) -> ( { model | userid = Just uId }, Cmd.batch [ uId |> storeToken, load "http://localhost:8000/admin.html" ] ) LoginAttempt (Err message) -> ( { model | error = Just (toString message) }, Cmd.none ) Login -> ( model, registerCmd (Auth model.username model.password) ) view : Model -> Html Msg view model = let message = case model.error of Nothing -> "" Just error -> error in div [style [( "background-color", "#D55757" )]] [ h3 [] [ text "Register" ] , br [] [] , input [ onInput SetUserName, placeholder "write your username", style [ ( "background-color", "white" ) , ( "border", "none" ) , ( "color", " black" ) , ( "padding", "15px 32px" ) , ( "text-align", "center" ) , ( "text-decoration", "none" ) , ( "display", "inline-block" ) , ( "font-size", "16px" ) , ( "margin", "4px 2px" ) , ( "cursor", "pointer" ) , ( "width", "70%" ) , ( "height", "12px" ) ]] [] , br [] [] , input [ onInput SetPassword, placeholder "<PASSWORD> password" ,style [ ( "background-color", "white" ) , ( "border", "none" ) , ( "color", " black" ) , ( "padding", "15px 32px" ) , ( "text-align", "center" ) , ( "text-decoration", "none" ) , ( "display", "inline-block" ) , ( "font-size", "16px" ) , ( "margin", "4px 2px" ) , ( "cursor", "pointer" ) , ( "width", "70%" ) , ( "height", "12px" ) ]] [] , br [] [] , button [ onClick Login , style [ ( "background-color", "white" ) , ( "border", "none" ) , ( "color", " #D55757" ) , ( "padding", "15px 32px" ) , ( "text-align", "center" ) , ( "text-decoration", "none" ) , ( "display", "inline-block" ) , ( "font-size", "16px" ) , ( "margin", "4px 2px" ) , ( "cursor", "pointer" ) ]] [ text "Log In" ] , div [] [ text message ] ] registerCmd : Auth -> Cmd Msg registerCmd credential = Http.send LoginAttempt (postApiUsersLogin credential) subscriptions : Model -> Sub Msg subscriptions model = Sub.none main : Program Never Model Msg main = program { init = init , view = view , update = update , subscriptions = subscriptions }
true
module Login exposing (..) import Html exposing (..) import Html.Attributes exposing (placeholder, value,style) import Html.Events exposing (..) import Http import Navigation exposing (load) import Ports exposing (storeToken) import Types exposing (Auth, Session, encodeSession, postApiUsersLogin) type alias Model = { username : String , email : String , password : String , error : Maybe String , userid : Maybe Int } init : ( Model, Cmd Msg ) init = ( Model "" "" "" Nothing Nothing, Cmd.none ) type Msg = NoOp | SetUserName String | SetPassword String | Login | LoginAttempt (Result Http.Error Int) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NoOp -> ( model, Cmd.none ) SetPassword pass -> ( { model | password = PI:PASSWORD:<PASSWORD>END_PI }, Cmd.none ) SetUserName uName -> ( { model | username = uName }, Cmd.none ) LoginAttempt (Ok uId) -> ( { model | userid = Just uId }, Cmd.batch [ uId |> storeToken, load "http://localhost:8000/admin.html" ] ) LoginAttempt (Err message) -> ( { model | error = Just (toString message) }, Cmd.none ) Login -> ( model, registerCmd (Auth model.username model.password) ) view : Model -> Html Msg view model = let message = case model.error of Nothing -> "" Just error -> error in div [style [( "background-color", "#D55757" )]] [ h3 [] [ text "Register" ] , br [] [] , input [ onInput SetUserName, placeholder "write your username", style [ ( "background-color", "white" ) , ( "border", "none" ) , ( "color", " black" ) , ( "padding", "15px 32px" ) , ( "text-align", "center" ) , ( "text-decoration", "none" ) , ( "display", "inline-block" ) , ( "font-size", "16px" ) , ( "margin", "4px 2px" ) , ( "cursor", "pointer" ) , ( "width", "70%" ) , ( "height", "12px" ) ]] [] , br [] [] , input [ onInput SetPassword, placeholder "PI:PASSWORD:<PASSWORD>END_PI password" ,style [ ( "background-color", "white" ) , ( "border", "none" ) , ( "color", " black" ) , ( "padding", "15px 32px" ) , ( "text-align", "center" ) , ( "text-decoration", "none" ) , ( "display", "inline-block" ) , ( "font-size", "16px" ) , ( "margin", "4px 2px" ) , ( "cursor", "pointer" ) , ( "width", "70%" ) , ( "height", "12px" ) ]] [] , br [] [] , button [ onClick Login , style [ ( "background-color", "white" ) , ( "border", "none" ) , ( "color", " #D55757" ) , ( "padding", "15px 32px" ) , ( "text-align", "center" ) , ( "text-decoration", "none" ) , ( "display", "inline-block" ) , ( "font-size", "16px" ) , ( "margin", "4px 2px" ) , ( "cursor", "pointer" ) ]] [ text "Log In" ] , div [] [ text message ] ] registerCmd : Auth -> Cmd Msg registerCmd credential = Http.send LoginAttempt (postApiUsersLogin credential) subscriptions : Model -> Sub Msg subscriptions model = Sub.none main : Program Never Model Msg main = program { init = init , view = view , update = update , subscriptions = subscriptions }
elm
[ { "context": "y_darker ] ]\n [ text \"-Stephen Hay\" ]\n ]\n ", "end": 12352, "score": 0.9971361756, "start": 12341, "tag": "NAME", "value": "Stephen Hay" } ]
src/UIExplorer.elm
lisardo/elm-ui-explorer
0
module UIExplorer exposing ( app , renderStories , UI , UICategory , Model , Msg , addUICategory , emptyUICategories , createUI , createUIWithDescription , fromUIList ) {-| # Anatomy of the UI Explorer - The Explorer is devided into a list of [UICategory](#UICategory) (ex: Buttons) - Each Category contains some [UI](#UI) items (ex: ToggleButton, ButtonWithImage, SubmitButton etc...) - Each [UI](#UI) item defines states (ex: Loaded, Disabled etc..) that we usually call [stories](https://storybook.js.org/basics/writing-stories/) # Main API @docs app @docs renderStories # Models @docs UI @docs UICategory # Helpers @docs addUICategory @docs emptyUICategories @docs createUI @docs createUIWithDescription @docs fromUIList -} import Array import Html exposing (Html, a, article, aside, div, h1, h2, img, li, node, section, span, text, ul) import Html.Attributes exposing (class, classList, href, rel, src, style) import Html.Events exposing (onClick) import Navigation import Tailwind.Classes as T {--Messages --} type Msg = Noop | SelectStory String | UrlChange Navigation.Location | NavigateToHome {--Model --} {-| A UI represents a view and lists a set of stories. For Example : A Button with following stories (Loading, Disabled) -} type UI = UIType { id : String , description : String , viewStories : UIViewConfig -> Html Msg } {-| Represents a familly of related views. For example using [Atomic Design](http://bradfrost.com/blog/post/atomic-web-design/), we can have the following categories : Atoms, Molecules etc.. -} type UICategory = UICategoryType InternalUICategory type alias InternalUICategory = ( String, List UI ) type alias UIViewConfig = { selectedUIId : Maybe String , selectedStoryId : Maybe String } {-| Model of the UI Explorer -} type alias Model = { categories : List UICategory , selectedUIId : Maybe String , selectedStoryId : Maybe String , selectedCategory : Maybe String , history : List Navigation.Location } getSelectedCategoryfromPath : Navigation.Location -> Maybe String getSelectedCategoryfromPath location = let removeHash = List.map (\s -> s |> String.slice 1 (s |> String.length)) in location.hash |> String.split "/" |> removeHash |> Array.fromList |> Array.get (0) getSelectedUIfromPath : Navigation.Location -> Maybe String getSelectedUIfromPath location = location.hash |> String.split "/" |> Array.fromList |> Array.get (1) getSelectedStoryfromPath : Navigation.Location -> Maybe String getSelectedStoryfromPath location = location.hash |> String.split "/" |> Array.fromList |> Array.get (2) makeStoryUrl : Model -> String -> Maybe String makeStoryUrl model storyId = Maybe.map2 (\selectedCategory selectedUIId -> [ selectedCategory, selectedUIId, storyId ] |> String.join "/" |> (++) "#" ) model.selectedCategory model.selectedUIId update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Noop -> ( model, Cmd.none ) SelectStory storyId -> case makeStoryUrl model storyId of Just url -> ( model, Navigation.newUrl url ) Nothing -> ( model, Cmd.none ) UrlChange location -> ( { model | history = location :: model.history , selectedUIId = getSelectedUIfromPath location , selectedStoryId = getSelectedStoryfromPath location , selectedCategory = getSelectedCategoryfromPath location } , Cmd.none ) NavigateToHome -> ( model, Navigation.newUrl "#" ) toCategories : List InternalUICategory -> List UICategory toCategories list = List.map UICategoryType list {-| Creates an empty list of UI Categories -} emptyUICategories : List UICategory emptyUICategories = [] {-| Create a UI given an ID and Story Views ``` stories : List ( String, ButtonModel ) stories = [ ( "LargePrimary", { label = "Primary", isLarge = True, isPrimary = True } ) , ( "TinyPrimary", { label = "Primary", isLarge = False, isPrimary = True } ) , ( "LargeSecondary", { label = "Secondary", isLarge = True, isPrimary = False } ) , ( "TinySecondary", { label = "Secondary", isLarge = False, isPrimary = False } ) ] viewStories = renderStories customButton stories createUI "Button" viewStories ``` -} createUI : String -> (UIViewConfig -> Html Msg) -> UI createUI id viewStories = createUIWithDescription id "" viewStories {-| Create a UI with a description ``` createUI "Button" "A Simple Button :-)" viewStories ``` -} createUIWithDescription : String -> String -> (UIViewConfig -> Html Msg) -> UI createUIWithDescription id description viewStories = UIType { id = id , description = description , viewStories = viewStories } {-| Create a list of [UICategories](#UICategories) from a list of [UI](#UI) and Add them in a Default Category. This is the simplest way to initialize the UI Explorer app. ``` main = app (fromUIList [ createUI "PlayPause" PlayPause.viewStories , createUI "Controls" Controls.viewStories , createUI "TrackList" TrackList.viewStories ] ) ``` -} fromUIList : List UI -> List UICategory fromUIList uiList = emptyUICategories |> List.append [ (UICategoryType ( "Default", uiList )) ] {-| Adds a UI Category to a list of categories Convenient for running a UI Explorer devided into categories ``` emptyUICategories |> addUICategory "A Great Category" [ createUI "My View" MyView.viewStories ] ``` -} addUICategory : String -> List UI -> List UICategory -> List UICategory addUICategory title uiList categories = let category = UICategoryType ( title , uiList ) in List.append categories [ category ] {-| Launches a UI Explorer Applicaton given a list of UI Categories ``` main = app (emptyUICategories |> addUICategory "Atoms" [ createUIWithDescription "Colors" "Global Color Schemes" Colors.viewStories ] |> addUICategory "Molecules" [ createUI "Card" Card.viewStories ] ) ``` -} app : List UICategory -> Program Never Model Msg app categories = Navigation.program UrlChange { init = (\location -> ( { categories = categories , selectedUIId = getSelectedUIfromPath location , selectedStoryId = getSelectedStoryfromPath location , selectedCategory = getSelectedCategoryfromPath location , history = [ location ] } , Cmd.none ) ) , view = view , update = update , subscriptions = (\_ -> Sub.none) } {--VIEW --} colors = { bg = { primary = T.bg_purple_dark } } toClassName list = class (list |> List.map (\c -> if (c |> String.contains "hover") then c else "uie-" ++ c ) |> String.join " " ) hover className = T.hover ++ ":uie-" ++ className viewSidebar : Model -> Html Msg viewSidebar model = let viewConfig = { selectedStoryId = model.selectedStoryId , selectedUIId = model.selectedUIId } in viewMenu model.categories viewConfig styleHeader = { logo = [ T.cursor_pointer ] , header = [ colors.bg.primary , T.p_0 , T.pb_2 , T.text_white , T.shadow_md ] , title = [ T.font_normal , T.text_3xl , T.text_black ] , subTitle = [ T.font_normal , T.text_3xl , T.text_grey ] } viewHeader : Html Msg viewHeader = section [ toClassName styleHeader.header ] [ div [ toClassName [ T.bg_cover, T.cursor_pointer, "logo" ] , onClick NavigateToHome ] [] ] styleMenuItem isSelected = let defaultClass = [ T.w_full , T.flex , T.pl_6 , T.pt_2 , T.pb_2 , hover T.bg_purple_darker , hover T.text_white ] in if isSelected then defaultClass |> List.append [ colors.bg.primary, T.text_white ] else defaultClass |> List.append [ T.text_grey_darker ] viewMenuItem : String -> Maybe String -> UI -> Html Msg viewMenuItem category selectedUIId (UIType ui) = let isSelected = selectedUIId |> Maybe.map ((==) ui.id) |> Maybe.withDefault False linkClass = styleMenuItem isSelected in li [ toClassName [] ] [ a [ toClassName linkClass , href ("#" ++ category ++ "/" ++ ui.id) , style [ ( "text-decoration", "none" ) ] ] [ text ui.id ] ] styleMenuCategoryLink = [ T.text_grey_darkest , T.uppercase , T.border_b , T.border_grey_light , T.w_full , T.flex , T.cursor_default , T.pl_4 , T.pb_2 , T.pt_2 , T.text_sm ] viewMenuCategory : UIViewConfig -> UICategory -> Html Msg viewMenuCategory { selectedUIId, selectedStoryId } (UICategoryType ( title, categories )) = div [ toClassName [ T.flex_col ] ] [ a [ toClassName styleMenuCategoryLink ] [ span [ toClassName [ T.font_bold, T.text_grey_darker ] ] [ text ("> " ++ title) ] ] , ul [ toClassName [ T.list_reset ] ] (List.map (viewMenuItem title selectedUIId) categories) ] viewMenu : List UICategory -> UIViewConfig -> Html Msg viewMenu categories config = aside [ toClassName [ T.mt_8 ] ] (List.map (viewMenuCategory config) categories) filterSelectedUI : UI -> Model -> Bool filterSelectedUI (UIType ui) model = Maybe.map (\id -> ui.id == id) model.selectedUIId |> Maybe.withDefault False getUIListFromCategories : UICategory -> List UI getUIListFromCategories (UICategoryType ( title, categories )) = categories viewContent : Model -> Html Msg viewContent model = let filteredUIs = model.categories |> List.map getUIListFromCategories |> List.foldr (++) [] |> List.filter (\ui -> filterSelectedUI ui model) viewConfig = { selectedStoryId = model.selectedStoryId , selectedUIId = model.selectedUIId } in div [ toClassName [ T.m_6 ] ] [ filteredUIs |> List.map (\(UIType s) -> s.viewStories viewConfig) |> List.head |> Maybe.withDefault (div [ toClassName [ T.m_6 ] ] [ span [ toClassName [ T.text_grey_darkest, T.text_xl, T.flex, T.mb_1 ] ] [ text "We’re not designing pages, we’re designing systems of components." ] , span [ toClassName [ T.text_lg, T.flex, T.text_grey_darker ] ] [ text "-Stephen Hay" ] ] ) , article [] (filteredUIs |> List.map (\(UIType s) -> div [] [ text s.description ]) ) ] oneThird = T.w_1 ++ "/3" oneQuarter = T.w_1 ++ "/4" view : Model -> Html Msg view model = div [ toClassName [ T.h_screen ] ] [ viewHeader , div [ toClassName [ T.flex ] ] [ div [ toClassName [ oneQuarter , T.bg_white , T.h_screen ] ] [ viewSidebar model ] , div [ toClassName [ T.p_4 , T.bg_white , T.w_screen , T.h_screen ] ] [ viewContent model ] ] ] renderStory : Int -> UIViewConfig -> ( String, a ) -> Html Msg renderStory index { selectedStoryId } ( id, state ) = let isActive = Maybe.map (\theId -> id == theId) selectedStoryId |> Maybe.withDefault (index == 0) buttonClass = classList [ ( "", True ), ( "", isActive ) ] defaultLiClass = [ T.mr_2 , T.mb_2 , T.rounded , T.p_2 , T.text_sm ] liClass = if isActive then [ colors.bg.primary , T.text_white , T.cursor_default ] |> List.append defaultLiClass else [ T.border , T.border_grey_light , T.bg_white , T.cursor_pointer , hover T.bg_purple_darker , hover T.text_white ] |> List.append defaultLiClass in li [ toClassName liClass , onClick <| SelectStory id , buttonClass ] [ text id ] {-| Renders Stories of a given UI. A story represents a state of a view such as (Loading, Error, Success, NoNetwork ...) ``` stories : List ( String, Model ) stories = [ ( "Loading", { isLoading = True } ), ( "Loaded", { isLoading = False } ) ] viewStories = renderStories (view model) stories ``` -} renderStories : (a -> Html msg) -> List ( String, a ) -> UIViewConfig -> Html Msg renderStories storyView stories config = let { selectedStoryId } = config menu = ul [ toClassName [ T.list_reset, T.flex, T.mb_4 ] ] (List.indexedMap (\index -> renderStory index config) stories) currentStories = case selectedStoryId of Just selectedId -> List.filter (\( id, state ) -> id == selectedId) stories Nothing -> stories content = case currentStories |> List.head of Just ( id, story ) -> storyView story |> Html.map (\_ -> Noop) Nothing -> text "Include somes states in your story..." in div [] [ menu , div [] [ content ] ]
57235
module UIExplorer exposing ( app , renderStories , UI , UICategory , Model , Msg , addUICategory , emptyUICategories , createUI , createUIWithDescription , fromUIList ) {-| # Anatomy of the UI Explorer - The Explorer is devided into a list of [UICategory](#UICategory) (ex: Buttons) - Each Category contains some [UI](#UI) items (ex: ToggleButton, ButtonWithImage, SubmitButton etc...) - Each [UI](#UI) item defines states (ex: Loaded, Disabled etc..) that we usually call [stories](https://storybook.js.org/basics/writing-stories/) # Main API @docs app @docs renderStories # Models @docs UI @docs UICategory # Helpers @docs addUICategory @docs emptyUICategories @docs createUI @docs createUIWithDescription @docs fromUIList -} import Array import Html exposing (Html, a, article, aside, div, h1, h2, img, li, node, section, span, text, ul) import Html.Attributes exposing (class, classList, href, rel, src, style) import Html.Events exposing (onClick) import Navigation import Tailwind.Classes as T {--Messages --} type Msg = Noop | SelectStory String | UrlChange Navigation.Location | NavigateToHome {--Model --} {-| A UI represents a view and lists a set of stories. For Example : A Button with following stories (Loading, Disabled) -} type UI = UIType { id : String , description : String , viewStories : UIViewConfig -> Html Msg } {-| Represents a familly of related views. For example using [Atomic Design](http://bradfrost.com/blog/post/atomic-web-design/), we can have the following categories : Atoms, Molecules etc.. -} type UICategory = UICategoryType InternalUICategory type alias InternalUICategory = ( String, List UI ) type alias UIViewConfig = { selectedUIId : Maybe String , selectedStoryId : Maybe String } {-| Model of the UI Explorer -} type alias Model = { categories : List UICategory , selectedUIId : Maybe String , selectedStoryId : Maybe String , selectedCategory : Maybe String , history : List Navigation.Location } getSelectedCategoryfromPath : Navigation.Location -> Maybe String getSelectedCategoryfromPath location = let removeHash = List.map (\s -> s |> String.slice 1 (s |> String.length)) in location.hash |> String.split "/" |> removeHash |> Array.fromList |> Array.get (0) getSelectedUIfromPath : Navigation.Location -> Maybe String getSelectedUIfromPath location = location.hash |> String.split "/" |> Array.fromList |> Array.get (1) getSelectedStoryfromPath : Navigation.Location -> Maybe String getSelectedStoryfromPath location = location.hash |> String.split "/" |> Array.fromList |> Array.get (2) makeStoryUrl : Model -> String -> Maybe String makeStoryUrl model storyId = Maybe.map2 (\selectedCategory selectedUIId -> [ selectedCategory, selectedUIId, storyId ] |> String.join "/" |> (++) "#" ) model.selectedCategory model.selectedUIId update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Noop -> ( model, Cmd.none ) SelectStory storyId -> case makeStoryUrl model storyId of Just url -> ( model, Navigation.newUrl url ) Nothing -> ( model, Cmd.none ) UrlChange location -> ( { model | history = location :: model.history , selectedUIId = getSelectedUIfromPath location , selectedStoryId = getSelectedStoryfromPath location , selectedCategory = getSelectedCategoryfromPath location } , Cmd.none ) NavigateToHome -> ( model, Navigation.newUrl "#" ) toCategories : List InternalUICategory -> List UICategory toCategories list = List.map UICategoryType list {-| Creates an empty list of UI Categories -} emptyUICategories : List UICategory emptyUICategories = [] {-| Create a UI given an ID and Story Views ``` stories : List ( String, ButtonModel ) stories = [ ( "LargePrimary", { label = "Primary", isLarge = True, isPrimary = True } ) , ( "TinyPrimary", { label = "Primary", isLarge = False, isPrimary = True } ) , ( "LargeSecondary", { label = "Secondary", isLarge = True, isPrimary = False } ) , ( "TinySecondary", { label = "Secondary", isLarge = False, isPrimary = False } ) ] viewStories = renderStories customButton stories createUI "Button" viewStories ``` -} createUI : String -> (UIViewConfig -> Html Msg) -> UI createUI id viewStories = createUIWithDescription id "" viewStories {-| Create a UI with a description ``` createUI "Button" "A Simple Button :-)" viewStories ``` -} createUIWithDescription : String -> String -> (UIViewConfig -> Html Msg) -> UI createUIWithDescription id description viewStories = UIType { id = id , description = description , viewStories = viewStories } {-| Create a list of [UICategories](#UICategories) from a list of [UI](#UI) and Add them in a Default Category. This is the simplest way to initialize the UI Explorer app. ``` main = app (fromUIList [ createUI "PlayPause" PlayPause.viewStories , createUI "Controls" Controls.viewStories , createUI "TrackList" TrackList.viewStories ] ) ``` -} fromUIList : List UI -> List UICategory fromUIList uiList = emptyUICategories |> List.append [ (UICategoryType ( "Default", uiList )) ] {-| Adds a UI Category to a list of categories Convenient for running a UI Explorer devided into categories ``` emptyUICategories |> addUICategory "A Great Category" [ createUI "My View" MyView.viewStories ] ``` -} addUICategory : String -> List UI -> List UICategory -> List UICategory addUICategory title uiList categories = let category = UICategoryType ( title , uiList ) in List.append categories [ category ] {-| Launches a UI Explorer Applicaton given a list of UI Categories ``` main = app (emptyUICategories |> addUICategory "Atoms" [ createUIWithDescription "Colors" "Global Color Schemes" Colors.viewStories ] |> addUICategory "Molecules" [ createUI "Card" Card.viewStories ] ) ``` -} app : List UICategory -> Program Never Model Msg app categories = Navigation.program UrlChange { init = (\location -> ( { categories = categories , selectedUIId = getSelectedUIfromPath location , selectedStoryId = getSelectedStoryfromPath location , selectedCategory = getSelectedCategoryfromPath location , history = [ location ] } , Cmd.none ) ) , view = view , update = update , subscriptions = (\_ -> Sub.none) } {--VIEW --} colors = { bg = { primary = T.bg_purple_dark } } toClassName list = class (list |> List.map (\c -> if (c |> String.contains "hover") then c else "uie-" ++ c ) |> String.join " " ) hover className = T.hover ++ ":uie-" ++ className viewSidebar : Model -> Html Msg viewSidebar model = let viewConfig = { selectedStoryId = model.selectedStoryId , selectedUIId = model.selectedUIId } in viewMenu model.categories viewConfig styleHeader = { logo = [ T.cursor_pointer ] , header = [ colors.bg.primary , T.p_0 , T.pb_2 , T.text_white , T.shadow_md ] , title = [ T.font_normal , T.text_3xl , T.text_black ] , subTitle = [ T.font_normal , T.text_3xl , T.text_grey ] } viewHeader : Html Msg viewHeader = section [ toClassName styleHeader.header ] [ div [ toClassName [ T.bg_cover, T.cursor_pointer, "logo" ] , onClick NavigateToHome ] [] ] styleMenuItem isSelected = let defaultClass = [ T.w_full , T.flex , T.pl_6 , T.pt_2 , T.pb_2 , hover T.bg_purple_darker , hover T.text_white ] in if isSelected then defaultClass |> List.append [ colors.bg.primary, T.text_white ] else defaultClass |> List.append [ T.text_grey_darker ] viewMenuItem : String -> Maybe String -> UI -> Html Msg viewMenuItem category selectedUIId (UIType ui) = let isSelected = selectedUIId |> Maybe.map ((==) ui.id) |> Maybe.withDefault False linkClass = styleMenuItem isSelected in li [ toClassName [] ] [ a [ toClassName linkClass , href ("#" ++ category ++ "/" ++ ui.id) , style [ ( "text-decoration", "none" ) ] ] [ text ui.id ] ] styleMenuCategoryLink = [ T.text_grey_darkest , T.uppercase , T.border_b , T.border_grey_light , T.w_full , T.flex , T.cursor_default , T.pl_4 , T.pb_2 , T.pt_2 , T.text_sm ] viewMenuCategory : UIViewConfig -> UICategory -> Html Msg viewMenuCategory { selectedUIId, selectedStoryId } (UICategoryType ( title, categories )) = div [ toClassName [ T.flex_col ] ] [ a [ toClassName styleMenuCategoryLink ] [ span [ toClassName [ T.font_bold, T.text_grey_darker ] ] [ text ("> " ++ title) ] ] , ul [ toClassName [ T.list_reset ] ] (List.map (viewMenuItem title selectedUIId) categories) ] viewMenu : List UICategory -> UIViewConfig -> Html Msg viewMenu categories config = aside [ toClassName [ T.mt_8 ] ] (List.map (viewMenuCategory config) categories) filterSelectedUI : UI -> Model -> Bool filterSelectedUI (UIType ui) model = Maybe.map (\id -> ui.id == id) model.selectedUIId |> Maybe.withDefault False getUIListFromCategories : UICategory -> List UI getUIListFromCategories (UICategoryType ( title, categories )) = categories viewContent : Model -> Html Msg viewContent model = let filteredUIs = model.categories |> List.map getUIListFromCategories |> List.foldr (++) [] |> List.filter (\ui -> filterSelectedUI ui model) viewConfig = { selectedStoryId = model.selectedStoryId , selectedUIId = model.selectedUIId } in div [ toClassName [ T.m_6 ] ] [ filteredUIs |> List.map (\(UIType s) -> s.viewStories viewConfig) |> List.head |> Maybe.withDefault (div [ toClassName [ T.m_6 ] ] [ span [ toClassName [ T.text_grey_darkest, T.text_xl, T.flex, T.mb_1 ] ] [ text "We’re not designing pages, we’re designing systems of components." ] , span [ toClassName [ T.text_lg, T.flex, T.text_grey_darker ] ] [ text "-<NAME>" ] ] ) , article [] (filteredUIs |> List.map (\(UIType s) -> div [] [ text s.description ]) ) ] oneThird = T.w_1 ++ "/3" oneQuarter = T.w_1 ++ "/4" view : Model -> Html Msg view model = div [ toClassName [ T.h_screen ] ] [ viewHeader , div [ toClassName [ T.flex ] ] [ div [ toClassName [ oneQuarter , T.bg_white , T.h_screen ] ] [ viewSidebar model ] , div [ toClassName [ T.p_4 , T.bg_white , T.w_screen , T.h_screen ] ] [ viewContent model ] ] ] renderStory : Int -> UIViewConfig -> ( String, a ) -> Html Msg renderStory index { selectedStoryId } ( id, state ) = let isActive = Maybe.map (\theId -> id == theId) selectedStoryId |> Maybe.withDefault (index == 0) buttonClass = classList [ ( "", True ), ( "", isActive ) ] defaultLiClass = [ T.mr_2 , T.mb_2 , T.rounded , T.p_2 , T.text_sm ] liClass = if isActive then [ colors.bg.primary , T.text_white , T.cursor_default ] |> List.append defaultLiClass else [ T.border , T.border_grey_light , T.bg_white , T.cursor_pointer , hover T.bg_purple_darker , hover T.text_white ] |> List.append defaultLiClass in li [ toClassName liClass , onClick <| SelectStory id , buttonClass ] [ text id ] {-| Renders Stories of a given UI. A story represents a state of a view such as (Loading, Error, Success, NoNetwork ...) ``` stories : List ( String, Model ) stories = [ ( "Loading", { isLoading = True } ), ( "Loaded", { isLoading = False } ) ] viewStories = renderStories (view model) stories ``` -} renderStories : (a -> Html msg) -> List ( String, a ) -> UIViewConfig -> Html Msg renderStories storyView stories config = let { selectedStoryId } = config menu = ul [ toClassName [ T.list_reset, T.flex, T.mb_4 ] ] (List.indexedMap (\index -> renderStory index config) stories) currentStories = case selectedStoryId of Just selectedId -> List.filter (\( id, state ) -> id == selectedId) stories Nothing -> stories content = case currentStories |> List.head of Just ( id, story ) -> storyView story |> Html.map (\_ -> Noop) Nothing -> text "Include somes states in your story..." in div [] [ menu , div [] [ content ] ]
true
module UIExplorer exposing ( app , renderStories , UI , UICategory , Model , Msg , addUICategory , emptyUICategories , createUI , createUIWithDescription , fromUIList ) {-| # Anatomy of the UI Explorer - The Explorer is devided into a list of [UICategory](#UICategory) (ex: Buttons) - Each Category contains some [UI](#UI) items (ex: ToggleButton, ButtonWithImage, SubmitButton etc...) - Each [UI](#UI) item defines states (ex: Loaded, Disabled etc..) that we usually call [stories](https://storybook.js.org/basics/writing-stories/) # Main API @docs app @docs renderStories # Models @docs UI @docs UICategory # Helpers @docs addUICategory @docs emptyUICategories @docs createUI @docs createUIWithDescription @docs fromUIList -} import Array import Html exposing (Html, a, article, aside, div, h1, h2, img, li, node, section, span, text, ul) import Html.Attributes exposing (class, classList, href, rel, src, style) import Html.Events exposing (onClick) import Navigation import Tailwind.Classes as T {--Messages --} type Msg = Noop | SelectStory String | UrlChange Navigation.Location | NavigateToHome {--Model --} {-| A UI represents a view and lists a set of stories. For Example : A Button with following stories (Loading, Disabled) -} type UI = UIType { id : String , description : String , viewStories : UIViewConfig -> Html Msg } {-| Represents a familly of related views. For example using [Atomic Design](http://bradfrost.com/blog/post/atomic-web-design/), we can have the following categories : Atoms, Molecules etc.. -} type UICategory = UICategoryType InternalUICategory type alias InternalUICategory = ( String, List UI ) type alias UIViewConfig = { selectedUIId : Maybe String , selectedStoryId : Maybe String } {-| Model of the UI Explorer -} type alias Model = { categories : List UICategory , selectedUIId : Maybe String , selectedStoryId : Maybe String , selectedCategory : Maybe String , history : List Navigation.Location } getSelectedCategoryfromPath : Navigation.Location -> Maybe String getSelectedCategoryfromPath location = let removeHash = List.map (\s -> s |> String.slice 1 (s |> String.length)) in location.hash |> String.split "/" |> removeHash |> Array.fromList |> Array.get (0) getSelectedUIfromPath : Navigation.Location -> Maybe String getSelectedUIfromPath location = location.hash |> String.split "/" |> Array.fromList |> Array.get (1) getSelectedStoryfromPath : Navigation.Location -> Maybe String getSelectedStoryfromPath location = location.hash |> String.split "/" |> Array.fromList |> Array.get (2) makeStoryUrl : Model -> String -> Maybe String makeStoryUrl model storyId = Maybe.map2 (\selectedCategory selectedUIId -> [ selectedCategory, selectedUIId, storyId ] |> String.join "/" |> (++) "#" ) model.selectedCategory model.selectedUIId update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Noop -> ( model, Cmd.none ) SelectStory storyId -> case makeStoryUrl model storyId of Just url -> ( model, Navigation.newUrl url ) Nothing -> ( model, Cmd.none ) UrlChange location -> ( { model | history = location :: model.history , selectedUIId = getSelectedUIfromPath location , selectedStoryId = getSelectedStoryfromPath location , selectedCategory = getSelectedCategoryfromPath location } , Cmd.none ) NavigateToHome -> ( model, Navigation.newUrl "#" ) toCategories : List InternalUICategory -> List UICategory toCategories list = List.map UICategoryType list {-| Creates an empty list of UI Categories -} emptyUICategories : List UICategory emptyUICategories = [] {-| Create a UI given an ID and Story Views ``` stories : List ( String, ButtonModel ) stories = [ ( "LargePrimary", { label = "Primary", isLarge = True, isPrimary = True } ) , ( "TinyPrimary", { label = "Primary", isLarge = False, isPrimary = True } ) , ( "LargeSecondary", { label = "Secondary", isLarge = True, isPrimary = False } ) , ( "TinySecondary", { label = "Secondary", isLarge = False, isPrimary = False } ) ] viewStories = renderStories customButton stories createUI "Button" viewStories ``` -} createUI : String -> (UIViewConfig -> Html Msg) -> UI createUI id viewStories = createUIWithDescription id "" viewStories {-| Create a UI with a description ``` createUI "Button" "A Simple Button :-)" viewStories ``` -} createUIWithDescription : String -> String -> (UIViewConfig -> Html Msg) -> UI createUIWithDescription id description viewStories = UIType { id = id , description = description , viewStories = viewStories } {-| Create a list of [UICategories](#UICategories) from a list of [UI](#UI) and Add them in a Default Category. This is the simplest way to initialize the UI Explorer app. ``` main = app (fromUIList [ createUI "PlayPause" PlayPause.viewStories , createUI "Controls" Controls.viewStories , createUI "TrackList" TrackList.viewStories ] ) ``` -} fromUIList : List UI -> List UICategory fromUIList uiList = emptyUICategories |> List.append [ (UICategoryType ( "Default", uiList )) ] {-| Adds a UI Category to a list of categories Convenient for running a UI Explorer devided into categories ``` emptyUICategories |> addUICategory "A Great Category" [ createUI "My View" MyView.viewStories ] ``` -} addUICategory : String -> List UI -> List UICategory -> List UICategory addUICategory title uiList categories = let category = UICategoryType ( title , uiList ) in List.append categories [ category ] {-| Launches a UI Explorer Applicaton given a list of UI Categories ``` main = app (emptyUICategories |> addUICategory "Atoms" [ createUIWithDescription "Colors" "Global Color Schemes" Colors.viewStories ] |> addUICategory "Molecules" [ createUI "Card" Card.viewStories ] ) ``` -} app : List UICategory -> Program Never Model Msg app categories = Navigation.program UrlChange { init = (\location -> ( { categories = categories , selectedUIId = getSelectedUIfromPath location , selectedStoryId = getSelectedStoryfromPath location , selectedCategory = getSelectedCategoryfromPath location , history = [ location ] } , Cmd.none ) ) , view = view , update = update , subscriptions = (\_ -> Sub.none) } {--VIEW --} colors = { bg = { primary = T.bg_purple_dark } } toClassName list = class (list |> List.map (\c -> if (c |> String.contains "hover") then c else "uie-" ++ c ) |> String.join " " ) hover className = T.hover ++ ":uie-" ++ className viewSidebar : Model -> Html Msg viewSidebar model = let viewConfig = { selectedStoryId = model.selectedStoryId , selectedUIId = model.selectedUIId } in viewMenu model.categories viewConfig styleHeader = { logo = [ T.cursor_pointer ] , header = [ colors.bg.primary , T.p_0 , T.pb_2 , T.text_white , T.shadow_md ] , title = [ T.font_normal , T.text_3xl , T.text_black ] , subTitle = [ T.font_normal , T.text_3xl , T.text_grey ] } viewHeader : Html Msg viewHeader = section [ toClassName styleHeader.header ] [ div [ toClassName [ T.bg_cover, T.cursor_pointer, "logo" ] , onClick NavigateToHome ] [] ] styleMenuItem isSelected = let defaultClass = [ T.w_full , T.flex , T.pl_6 , T.pt_2 , T.pb_2 , hover T.bg_purple_darker , hover T.text_white ] in if isSelected then defaultClass |> List.append [ colors.bg.primary, T.text_white ] else defaultClass |> List.append [ T.text_grey_darker ] viewMenuItem : String -> Maybe String -> UI -> Html Msg viewMenuItem category selectedUIId (UIType ui) = let isSelected = selectedUIId |> Maybe.map ((==) ui.id) |> Maybe.withDefault False linkClass = styleMenuItem isSelected in li [ toClassName [] ] [ a [ toClassName linkClass , href ("#" ++ category ++ "/" ++ ui.id) , style [ ( "text-decoration", "none" ) ] ] [ text ui.id ] ] styleMenuCategoryLink = [ T.text_grey_darkest , T.uppercase , T.border_b , T.border_grey_light , T.w_full , T.flex , T.cursor_default , T.pl_4 , T.pb_2 , T.pt_2 , T.text_sm ] viewMenuCategory : UIViewConfig -> UICategory -> Html Msg viewMenuCategory { selectedUIId, selectedStoryId } (UICategoryType ( title, categories )) = div [ toClassName [ T.flex_col ] ] [ a [ toClassName styleMenuCategoryLink ] [ span [ toClassName [ T.font_bold, T.text_grey_darker ] ] [ text ("> " ++ title) ] ] , ul [ toClassName [ T.list_reset ] ] (List.map (viewMenuItem title selectedUIId) categories) ] viewMenu : List UICategory -> UIViewConfig -> Html Msg viewMenu categories config = aside [ toClassName [ T.mt_8 ] ] (List.map (viewMenuCategory config) categories) filterSelectedUI : UI -> Model -> Bool filterSelectedUI (UIType ui) model = Maybe.map (\id -> ui.id == id) model.selectedUIId |> Maybe.withDefault False getUIListFromCategories : UICategory -> List UI getUIListFromCategories (UICategoryType ( title, categories )) = categories viewContent : Model -> Html Msg viewContent model = let filteredUIs = model.categories |> List.map getUIListFromCategories |> List.foldr (++) [] |> List.filter (\ui -> filterSelectedUI ui model) viewConfig = { selectedStoryId = model.selectedStoryId , selectedUIId = model.selectedUIId } in div [ toClassName [ T.m_6 ] ] [ filteredUIs |> List.map (\(UIType s) -> s.viewStories viewConfig) |> List.head |> Maybe.withDefault (div [ toClassName [ T.m_6 ] ] [ span [ toClassName [ T.text_grey_darkest, T.text_xl, T.flex, T.mb_1 ] ] [ text "We’re not designing pages, we’re designing systems of components." ] , span [ toClassName [ T.text_lg, T.flex, T.text_grey_darker ] ] [ text "-PI:NAME:<NAME>END_PI" ] ] ) , article [] (filteredUIs |> List.map (\(UIType s) -> div [] [ text s.description ]) ) ] oneThird = T.w_1 ++ "/3" oneQuarter = T.w_1 ++ "/4" view : Model -> Html Msg view model = div [ toClassName [ T.h_screen ] ] [ viewHeader , div [ toClassName [ T.flex ] ] [ div [ toClassName [ oneQuarter , T.bg_white , T.h_screen ] ] [ viewSidebar model ] , div [ toClassName [ T.p_4 , T.bg_white , T.w_screen , T.h_screen ] ] [ viewContent model ] ] ] renderStory : Int -> UIViewConfig -> ( String, a ) -> Html Msg renderStory index { selectedStoryId } ( id, state ) = let isActive = Maybe.map (\theId -> id == theId) selectedStoryId |> Maybe.withDefault (index == 0) buttonClass = classList [ ( "", True ), ( "", isActive ) ] defaultLiClass = [ T.mr_2 , T.mb_2 , T.rounded , T.p_2 , T.text_sm ] liClass = if isActive then [ colors.bg.primary , T.text_white , T.cursor_default ] |> List.append defaultLiClass else [ T.border , T.border_grey_light , T.bg_white , T.cursor_pointer , hover T.bg_purple_darker , hover T.text_white ] |> List.append defaultLiClass in li [ toClassName liClass , onClick <| SelectStory id , buttonClass ] [ text id ] {-| Renders Stories of a given UI. A story represents a state of a view such as (Loading, Error, Success, NoNetwork ...) ``` stories : List ( String, Model ) stories = [ ( "Loading", { isLoading = True } ), ( "Loaded", { isLoading = False } ) ] viewStories = renderStories (view model) stories ``` -} renderStories : (a -> Html msg) -> List ( String, a ) -> UIViewConfig -> Html Msg renderStories storyView stories config = let { selectedStoryId } = config menu = ul [ toClassName [ T.list_reset, T.flex, T.mb_4 ] ] (List.indexedMap (\index -> renderStory index config) stories) currentStories = case selectedStoryId of Just selectedId -> List.filter (\( id, state ) -> id == selectedId) stories Nothing -> stories content = case currentStories |> List.head of Just ( id, story ) -> storyView story |> Html.map (\_ -> Noop) Nothing -> text "Include somes states in your story..." in div [] [ menu , div [] [ content ] ]
elm
[ { "context": "cter : Character\ndefaultCharacter =\n { name = \"Default Name\"\n , level = defaultLevel\n , abilities = Abi", "end": 434, "score": 0.9929752946, "start": 422, "tag": "NAME", "value": "Default Name" } ]
apps/web/src/Character.elm
lynlevenick/elm-dnd
0
module Character exposing (Character, Message(..), abilityModifier, defaultCharacter, defaultLevel, hasSkill, proficiencyModifier, skillModifier, update) import Ability import Skill type alias Character = { name : String , level : Int , abilities : Ability.Abilities , skills : Skill.Skills } defaultLevel : Int defaultLevel = 1 defaultCharacter : Character defaultCharacter = { name = "Default Name" , level = defaultLevel , abilities = Ability.defaultAbilities , skills = Skill.defaultSkills } type Message = Name String | Level Int | Ability Ability.Message | Skill Skill.Message proficiencyModifier : Character -> Int proficiencyModifier character = (7 + character.level) // 4 abilityModifier : Character -> Ability.Ability -> Int abilityModifier character ability = let getter = Ability.getter ability in getter character.abilities // 2 - 5 hasSkill : Character -> Skill.Skill -> Bool hasSkill character skill = Skill.getter skill character.skills skillModifier : Character -> Skill.Skill -> Int skillModifier character skill = let appliedProficiency = if Skill.getter skill <| character.skills then proficiencyModifier character else 0 ability = Skill.ability skill in appliedProficiency + abilityModifier character ability update : Character -> Message -> Character update character msg = case msg of Name val -> { character | name = val } Level val -> { character | level = val } Ability ability_msg -> { character | abilities = Ability.update character.abilities ability_msg } Skill skill_msg -> { character | skills = Skill.update character.skills skill_msg }
61659
module Character exposing (Character, Message(..), abilityModifier, defaultCharacter, defaultLevel, hasSkill, proficiencyModifier, skillModifier, update) import Ability import Skill type alias Character = { name : String , level : Int , abilities : Ability.Abilities , skills : Skill.Skills } defaultLevel : Int defaultLevel = 1 defaultCharacter : Character defaultCharacter = { name = "<NAME>" , level = defaultLevel , abilities = Ability.defaultAbilities , skills = Skill.defaultSkills } type Message = Name String | Level Int | Ability Ability.Message | Skill Skill.Message proficiencyModifier : Character -> Int proficiencyModifier character = (7 + character.level) // 4 abilityModifier : Character -> Ability.Ability -> Int abilityModifier character ability = let getter = Ability.getter ability in getter character.abilities // 2 - 5 hasSkill : Character -> Skill.Skill -> Bool hasSkill character skill = Skill.getter skill character.skills skillModifier : Character -> Skill.Skill -> Int skillModifier character skill = let appliedProficiency = if Skill.getter skill <| character.skills then proficiencyModifier character else 0 ability = Skill.ability skill in appliedProficiency + abilityModifier character ability update : Character -> Message -> Character update character msg = case msg of Name val -> { character | name = val } Level val -> { character | level = val } Ability ability_msg -> { character | abilities = Ability.update character.abilities ability_msg } Skill skill_msg -> { character | skills = Skill.update character.skills skill_msg }
true
module Character exposing (Character, Message(..), abilityModifier, defaultCharacter, defaultLevel, hasSkill, proficiencyModifier, skillModifier, update) import Ability import Skill type alias Character = { name : String , level : Int , abilities : Ability.Abilities , skills : Skill.Skills } defaultLevel : Int defaultLevel = 1 defaultCharacter : Character defaultCharacter = { name = "PI:NAME:<NAME>END_PI" , level = defaultLevel , abilities = Ability.defaultAbilities , skills = Skill.defaultSkills } type Message = Name String | Level Int | Ability Ability.Message | Skill Skill.Message proficiencyModifier : Character -> Int proficiencyModifier character = (7 + character.level) // 4 abilityModifier : Character -> Ability.Ability -> Int abilityModifier character ability = let getter = Ability.getter ability in getter character.abilities // 2 - 5 hasSkill : Character -> Skill.Skill -> Bool hasSkill character skill = Skill.getter skill character.skills skillModifier : Character -> Skill.Skill -> Int skillModifier character skill = let appliedProficiency = if Skill.getter skill <| character.skills then proficiencyModifier character else 0 ability = Skill.ability skill in appliedProficiency + abilityModifier character ability update : Character -> Message -> Character update character msg = case msg of Name val -> { character | name = val } Level val -> { character | level = val } Ability ability_msg -> { character | abilities = Ability.update character.abilities ability_msg } Skill skill_msg -> { character | skills = Skill.update character.skills skill_msg }
elm
[ { "context": "{-\n Swaggy Jenkins\n Jenkins API clients generated from Swagger / O", "end": 20, "score": 0.9996118546, "start": 6, "tag": "NAME", "value": "Swaggy Jenkins" }, { "context": "cation\n\n OpenAPI spec version: 1.1.1\n Contact: blah@cliffano.com\n\n NOTE: This file is auto generated by the open", "end": 153, "score": 0.9999173284, "start": 136, "tag": "EMAIL", "value": "blah@cliffano.com" }, { "context": "d by the openapi-generator.\n https://github.com/openapitools/openapi-generator.git\n Do not edit this file ma", "end": 252, "score": 0.9996315241, "start": 240, "tag": "USERNAME", "value": "openapitools" } ]
clients/elm/generated/src/Request/BlueOcean.elm
PankTrue/swaggy-jenkins
23
{- Swaggy Jenkins Jenkins API clients generated from Swagger / Open API specification OpenAPI spec version: 1.1.1 Contact: blah@cliffano.com NOTE: This file is auto generated by the openapi-generator. https://github.com/openapitools/openapi-generator.git Do not edit this file manually. -} module Request.BlueOcean exposing (deletePipelineQueueItem, getAuthenticatedUser, getClasses, getJsonWebKey, getJsonWebToken, getOrganisation, getOrganisations, getPipeline, getPipelineActivities, getPipelineBranch, getPipelineBranchRun, getPipelineBranches, getPipelineFolder, getPipelineFolderPipeline, getPipelineQueue, getPipelineRun, getPipelineRunLog, getPipelineRunNode, getPipelineRunNodeStep, getPipelineRunNodeStepLog, getPipelineRunNodeSteps, getPipelineRunNodes, getPipelineRuns, getPipelines, getSCM, getSCMOrganisationRepositories, getSCMOrganisationRepository, getSCMOrganisations, getUser, getUserFavorites, getUsers, postPipelineRun, postPipelineRuns, putPipelineFavorite, putPipelineRun, search, searchClasses) import Data.PipelineRun exposing (PipelineRun, pipelineRunDecoder) import Data.PipelineRunNodes exposing (PipelineRunNodes, pipelineRunNodesDecoder) import Data.PipelineRuns exposing (PipelineRuns, pipelineRunsDecoder) import Data.User exposing (User, userDecoder) import Data.Organisation exposing (Organisation, organisationDecoder) import Data.PipelineFolderImpl exposing (PipelineFolderImpl, pipelineFolderImplDecoder) import Data.PipelineImpl exposing (PipelineImpl, pipelineImplDecoder) import Data.Pipelines exposing (Pipelines, pipelinesDecoder) import Data.GithubScm exposing (GithubScm, githubScmDecoder) import Data.FavoriteImpl exposing (FavoriteImpl, favoriteImplDecoder) import Data.PipelineRunNodeSteps exposing (PipelineRunNodeSteps, pipelineRunNodeStepsDecoder) import Data.UserFavorites exposing (UserFavorites, userFavoritesDecoder) import Data.PipelineQueue exposing (PipelineQueue, pipelineQueueDecoder) import Data.Pipeline exposing (Pipeline, pipelineDecoder) import Data.PipelineRunNode exposing (PipelineRunNode, pipelineRunNodeDecoder) import Data.QueueItemImpl exposing (QueueItemImpl, queueItemImplDecoder) import Data.Organisations exposing (Organisations, organisationsDecoder) import Data.BranchImpl exposing (BranchImpl, branchImplDecoder) import Data.PipelineStepImpl exposing (PipelineStepImpl, pipelineStepImplDecoder) import Data.MultibranchPipeline exposing (MultibranchPipeline, multibranchPipelineDecoder) import Data.ScmOrganisations exposing (ScmOrganisations, scmOrganisationsDecoder) import Data.Body exposing (Body, bodyEncoder) import Data.PipelineActivities exposing (PipelineActivities, pipelineActivitiesDecoder) import Dict import Http import Json.Decode as Decode basePath : String basePath = "http://localhost" {-| Delete queue item from an organization pipeline queue -} deletePipelineQueueItem : String -> String -> String -> Http.Request () deletePipelineQueueItem organization pipeline queue = { method = "DELETE" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/queue/" ++ queue , headers = [] , body = Http.emptyBody , expect = Http.expectStringResponse (\_ -> Ok ()) , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve authenticated user details for an organization -} getAuthenticatedUser : String -> Http.Request User getAuthenticatedUser organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/user/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson userDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get a list of class names supported by a given class -} getClasses : String -> Http.Request String getClasses class = { method = "GET" , url = basePath ++ "/blue/rest/classes/" ++ class , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve JSON Web Key -} getJsonWebKey : Int -> Http.Request String getJsonWebKey key = { method = "GET" , url = basePath ++ "/jwt-auth/jwks/" ++ toString key , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve JSON Web Token -} getJsonWebToken : Http.Request String getJsonWebToken = { method = "GET" , url = basePath ++ "/jwt-auth/token" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve organization details -} getOrganisation : String -> Http.Request Organisation getOrganisation organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization , headers = [] , body = Http.emptyBody , expect = Http.expectJson organisationDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all organizations details -} getOrganisations : Http.Request Organisations getOrganisations = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson organisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve pipeline details for an organization -} getPipeline : String -> String -> Http.Request Pipeline getPipeline organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all activities details for an organization pipeline -} getPipelineActivities : String -> String -> Http.Request PipelineActivities getPipelineActivities organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/activities" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineActivitiesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve branch details for an organization pipeline -} getPipelineBranch : String -> String -> String -> Http.Request BranchImpl getPipelineBranch organization pipeline branch = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/branches/" ++ branch ++ "/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson branchImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve branch run details for an organization pipeline -} getPipelineBranchRun : String -> String -> String -> String -> Http.Request PipelineRun getPipelineBranchRun organization pipeline branch run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/branches/" ++ branch ++ "/runs/" ++ run , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all branches details for an organization pipeline -} getPipelineBranches : String -> String -> Http.Request MultibranchPipeline getPipelineBranches organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/branches" , headers = [] , body = Http.emptyBody , expect = Http.expectJson multibranchPipelineDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve pipeline folder for an organization -} getPipelineFolder : String -> String -> Http.Request PipelineFolderImpl getPipelineFolder organization folder = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ folder ++ "/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineFolderImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve pipeline details for an organization folder -} getPipelineFolderPipeline : String -> String -> String -> Http.Request PipelineImpl getPipelineFolderPipeline organization pipeline folder = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ folder ++ "/pipelines/" ++ pipeline , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve queue details for an organization pipeline -} getPipelineQueue : String -> String -> Http.Request PipelineQueue getPipelineQueue organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/queue" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineQueueDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run details for an organization pipeline -} getPipelineRun : String -> String -> String -> Http.Request PipelineRun getPipelineRun organization pipeline run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get log for a pipeline run -} getPipelineRunLog : String -> String -> String -> Http.Request String getPipelineRunLog organization pipeline run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/log" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run node details for an organization pipeline -} getPipelineRunNode : String -> String -> String -> String -> Http.Request PipelineRunNode getPipelineRunNode organization pipeline run node = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunNodeDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run node details for an organization pipeline -} getPipelineRunNodeStep : String -> String -> String -> String -> String -> Http.Request PipelineStepImpl getPipelineRunNodeStep organization pipeline run node step = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node ++ "/steps/" ++ step , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineStepImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get log for a pipeline run node step -} getPipelineRunNodeStepLog : String -> String -> String -> String -> String -> Http.Request String getPipelineRunNodeStepLog organization pipeline run node step = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node ++ "/steps/" ++ step ++ "/log" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run node steps details for an organization pipeline -} getPipelineRunNodeSteps : String -> String -> String -> String -> Http.Request PipelineRunNodeSteps getPipelineRunNodeSteps organization pipeline run node = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node ++ "/steps" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunNodeStepsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run nodes details for an organization pipeline -} getPipelineRunNodes : String -> String -> String -> Http.Request PipelineRunNodes getPipelineRunNodes organization pipeline run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunNodesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all runs details for an organization pipeline -} getPipelineRuns : String -> String -> Http.Request PipelineRuns getPipelineRuns organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all pipelines details for an organization -} getPipelines : String -> Http.Request Pipelines getPipelines organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelinesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM details for an organization -} getSCM : String -> String -> Http.Request GithubScm getSCM organization scm = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm , headers = [] , body = Http.emptyBody , expect = Http.expectJson githubScmDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM organization repositories details for an organization -} getSCMOrganisationRepositories : String -> String -> String -> Http.Request ScmOrganisations getSCMOrganisationRepositories organization scm scmOrganisation = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm ++ "/organizations/" ++ scmOrganisation ++ "/repositories" , headers = [] , body = Http.emptyBody , expect = Http.expectJson scmOrganisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM organization repository details for an organization -} getSCMOrganisationRepository : String -> String -> String -> String -> Http.Request ScmOrganisations getSCMOrganisationRepository organization scm scmOrganisation repository = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm ++ "/organizations/" ++ scmOrganisation ++ "/repositories/" ++ repository , headers = [] , body = Http.emptyBody , expect = Http.expectJson scmOrganisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM organizations details for an organization -} getSCMOrganisations : String -> String -> Http.Request ScmOrganisations getSCMOrganisations organization scm = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm ++ "/organizations" , headers = [] , body = Http.emptyBody , expect = Http.expectJson scmOrganisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve user details for an organization -} getUser : String -> String -> Http.Request User getUser organization user = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/users/" ++ user , headers = [] , body = Http.emptyBody , expect = Http.expectJson userDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve user favorites details for an organization -} getUserFavorites : String -> Http.Request UserFavorites getUserFavorites user = { method = "GET" , url = basePath ++ "/blue/rest/users/" ++ user ++ "/favorites" , headers = [] , body = Http.emptyBody , expect = Http.expectJson userFavoritesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve users details for an organization -} getUsers : String -> Http.Request User getUsers organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/users/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson userDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Replay an organization pipeline run -} postPipelineRun : String -> String -> String -> Http.Request QueueItemImpl postPipelineRun organization pipeline run = { method = "POST" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/replay" , headers = [] , body = Http.emptyBody , expect = Http.expectJson queueItemImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Start a build for an organization pipeline -} postPipelineRuns : String -> String -> Http.Request QueueItemImpl postPipelineRuns organization pipeline = { method = "POST" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs" , headers = [] , body = Http.emptyBody , expect = Http.expectJson queueItemImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Favorite/unfavorite a pipeline -} putPipelineFavorite : String -> String -> Body -> Http.Request FavoriteImpl putPipelineFavorite organization pipeline model = { method = "PUT" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/favorite" , headers = [] , body = Http.jsonBody <| bodyEncoder model , expect = Http.expectJson favoriteImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Stop a build of an organization pipeline -} putPipelineRun : String -> String -> String -> Http.Request PipelineRun putPipelineRun organization pipeline run = { method = "PUT" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/stop" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Search for any resource details -} search : Http.Request String search = { method = "GET" , url = basePath ++ "/blue/rest/search/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get classes details -} searchClasses : Http.Request String searchClasses = { method = "GET" , url = basePath ++ "/blue/rest/classes/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request
10315
{- <NAME> Jenkins API clients generated from Swagger / Open API specification OpenAPI spec version: 1.1.1 Contact: <EMAIL> NOTE: This file is auto generated by the openapi-generator. https://github.com/openapitools/openapi-generator.git Do not edit this file manually. -} module Request.BlueOcean exposing (deletePipelineQueueItem, getAuthenticatedUser, getClasses, getJsonWebKey, getJsonWebToken, getOrganisation, getOrganisations, getPipeline, getPipelineActivities, getPipelineBranch, getPipelineBranchRun, getPipelineBranches, getPipelineFolder, getPipelineFolderPipeline, getPipelineQueue, getPipelineRun, getPipelineRunLog, getPipelineRunNode, getPipelineRunNodeStep, getPipelineRunNodeStepLog, getPipelineRunNodeSteps, getPipelineRunNodes, getPipelineRuns, getPipelines, getSCM, getSCMOrganisationRepositories, getSCMOrganisationRepository, getSCMOrganisations, getUser, getUserFavorites, getUsers, postPipelineRun, postPipelineRuns, putPipelineFavorite, putPipelineRun, search, searchClasses) import Data.PipelineRun exposing (PipelineRun, pipelineRunDecoder) import Data.PipelineRunNodes exposing (PipelineRunNodes, pipelineRunNodesDecoder) import Data.PipelineRuns exposing (PipelineRuns, pipelineRunsDecoder) import Data.User exposing (User, userDecoder) import Data.Organisation exposing (Organisation, organisationDecoder) import Data.PipelineFolderImpl exposing (PipelineFolderImpl, pipelineFolderImplDecoder) import Data.PipelineImpl exposing (PipelineImpl, pipelineImplDecoder) import Data.Pipelines exposing (Pipelines, pipelinesDecoder) import Data.GithubScm exposing (GithubScm, githubScmDecoder) import Data.FavoriteImpl exposing (FavoriteImpl, favoriteImplDecoder) import Data.PipelineRunNodeSteps exposing (PipelineRunNodeSteps, pipelineRunNodeStepsDecoder) import Data.UserFavorites exposing (UserFavorites, userFavoritesDecoder) import Data.PipelineQueue exposing (PipelineQueue, pipelineQueueDecoder) import Data.Pipeline exposing (Pipeline, pipelineDecoder) import Data.PipelineRunNode exposing (PipelineRunNode, pipelineRunNodeDecoder) import Data.QueueItemImpl exposing (QueueItemImpl, queueItemImplDecoder) import Data.Organisations exposing (Organisations, organisationsDecoder) import Data.BranchImpl exposing (BranchImpl, branchImplDecoder) import Data.PipelineStepImpl exposing (PipelineStepImpl, pipelineStepImplDecoder) import Data.MultibranchPipeline exposing (MultibranchPipeline, multibranchPipelineDecoder) import Data.ScmOrganisations exposing (ScmOrganisations, scmOrganisationsDecoder) import Data.Body exposing (Body, bodyEncoder) import Data.PipelineActivities exposing (PipelineActivities, pipelineActivitiesDecoder) import Dict import Http import Json.Decode as Decode basePath : String basePath = "http://localhost" {-| Delete queue item from an organization pipeline queue -} deletePipelineQueueItem : String -> String -> String -> Http.Request () deletePipelineQueueItem organization pipeline queue = { method = "DELETE" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/queue/" ++ queue , headers = [] , body = Http.emptyBody , expect = Http.expectStringResponse (\_ -> Ok ()) , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve authenticated user details for an organization -} getAuthenticatedUser : String -> Http.Request User getAuthenticatedUser organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/user/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson userDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get a list of class names supported by a given class -} getClasses : String -> Http.Request String getClasses class = { method = "GET" , url = basePath ++ "/blue/rest/classes/" ++ class , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve JSON Web Key -} getJsonWebKey : Int -> Http.Request String getJsonWebKey key = { method = "GET" , url = basePath ++ "/jwt-auth/jwks/" ++ toString key , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve JSON Web Token -} getJsonWebToken : Http.Request String getJsonWebToken = { method = "GET" , url = basePath ++ "/jwt-auth/token" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve organization details -} getOrganisation : String -> Http.Request Organisation getOrganisation organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization , headers = [] , body = Http.emptyBody , expect = Http.expectJson organisationDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all organizations details -} getOrganisations : Http.Request Organisations getOrganisations = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson organisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve pipeline details for an organization -} getPipeline : String -> String -> Http.Request Pipeline getPipeline organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all activities details for an organization pipeline -} getPipelineActivities : String -> String -> Http.Request PipelineActivities getPipelineActivities organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/activities" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineActivitiesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve branch details for an organization pipeline -} getPipelineBranch : String -> String -> String -> Http.Request BranchImpl getPipelineBranch organization pipeline branch = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/branches/" ++ branch ++ "/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson branchImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve branch run details for an organization pipeline -} getPipelineBranchRun : String -> String -> String -> String -> Http.Request PipelineRun getPipelineBranchRun organization pipeline branch run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/branches/" ++ branch ++ "/runs/" ++ run , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all branches details for an organization pipeline -} getPipelineBranches : String -> String -> Http.Request MultibranchPipeline getPipelineBranches organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/branches" , headers = [] , body = Http.emptyBody , expect = Http.expectJson multibranchPipelineDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve pipeline folder for an organization -} getPipelineFolder : String -> String -> Http.Request PipelineFolderImpl getPipelineFolder organization folder = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ folder ++ "/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineFolderImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve pipeline details for an organization folder -} getPipelineFolderPipeline : String -> String -> String -> Http.Request PipelineImpl getPipelineFolderPipeline organization pipeline folder = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ folder ++ "/pipelines/" ++ pipeline , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve queue details for an organization pipeline -} getPipelineQueue : String -> String -> Http.Request PipelineQueue getPipelineQueue organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/queue" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineQueueDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run details for an organization pipeline -} getPipelineRun : String -> String -> String -> Http.Request PipelineRun getPipelineRun organization pipeline run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get log for a pipeline run -} getPipelineRunLog : String -> String -> String -> Http.Request String getPipelineRunLog organization pipeline run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/log" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run node details for an organization pipeline -} getPipelineRunNode : String -> String -> String -> String -> Http.Request PipelineRunNode getPipelineRunNode organization pipeline run node = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunNodeDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run node details for an organization pipeline -} getPipelineRunNodeStep : String -> String -> String -> String -> String -> Http.Request PipelineStepImpl getPipelineRunNodeStep organization pipeline run node step = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node ++ "/steps/" ++ step , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineStepImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get log for a pipeline run node step -} getPipelineRunNodeStepLog : String -> String -> String -> String -> String -> Http.Request String getPipelineRunNodeStepLog organization pipeline run node step = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node ++ "/steps/" ++ step ++ "/log" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run node steps details for an organization pipeline -} getPipelineRunNodeSteps : String -> String -> String -> String -> Http.Request PipelineRunNodeSteps getPipelineRunNodeSteps organization pipeline run node = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node ++ "/steps" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunNodeStepsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run nodes details for an organization pipeline -} getPipelineRunNodes : String -> String -> String -> Http.Request PipelineRunNodes getPipelineRunNodes organization pipeline run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunNodesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all runs details for an organization pipeline -} getPipelineRuns : String -> String -> Http.Request PipelineRuns getPipelineRuns organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all pipelines details for an organization -} getPipelines : String -> Http.Request Pipelines getPipelines organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelinesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM details for an organization -} getSCM : String -> String -> Http.Request GithubScm getSCM organization scm = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm , headers = [] , body = Http.emptyBody , expect = Http.expectJson githubScmDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM organization repositories details for an organization -} getSCMOrganisationRepositories : String -> String -> String -> Http.Request ScmOrganisations getSCMOrganisationRepositories organization scm scmOrganisation = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm ++ "/organizations/" ++ scmOrganisation ++ "/repositories" , headers = [] , body = Http.emptyBody , expect = Http.expectJson scmOrganisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM organization repository details for an organization -} getSCMOrganisationRepository : String -> String -> String -> String -> Http.Request ScmOrganisations getSCMOrganisationRepository organization scm scmOrganisation repository = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm ++ "/organizations/" ++ scmOrganisation ++ "/repositories/" ++ repository , headers = [] , body = Http.emptyBody , expect = Http.expectJson scmOrganisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM organizations details for an organization -} getSCMOrganisations : String -> String -> Http.Request ScmOrganisations getSCMOrganisations organization scm = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm ++ "/organizations" , headers = [] , body = Http.emptyBody , expect = Http.expectJson scmOrganisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve user details for an organization -} getUser : String -> String -> Http.Request User getUser organization user = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/users/" ++ user , headers = [] , body = Http.emptyBody , expect = Http.expectJson userDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve user favorites details for an organization -} getUserFavorites : String -> Http.Request UserFavorites getUserFavorites user = { method = "GET" , url = basePath ++ "/blue/rest/users/" ++ user ++ "/favorites" , headers = [] , body = Http.emptyBody , expect = Http.expectJson userFavoritesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve users details for an organization -} getUsers : String -> Http.Request User getUsers organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/users/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson userDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Replay an organization pipeline run -} postPipelineRun : String -> String -> String -> Http.Request QueueItemImpl postPipelineRun organization pipeline run = { method = "POST" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/replay" , headers = [] , body = Http.emptyBody , expect = Http.expectJson queueItemImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Start a build for an organization pipeline -} postPipelineRuns : String -> String -> Http.Request QueueItemImpl postPipelineRuns organization pipeline = { method = "POST" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs" , headers = [] , body = Http.emptyBody , expect = Http.expectJson queueItemImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Favorite/unfavorite a pipeline -} putPipelineFavorite : String -> String -> Body -> Http.Request FavoriteImpl putPipelineFavorite organization pipeline model = { method = "PUT" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/favorite" , headers = [] , body = Http.jsonBody <| bodyEncoder model , expect = Http.expectJson favoriteImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Stop a build of an organization pipeline -} putPipelineRun : String -> String -> String -> Http.Request PipelineRun putPipelineRun organization pipeline run = { method = "PUT" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/stop" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Search for any resource details -} search : Http.Request String search = { method = "GET" , url = basePath ++ "/blue/rest/search/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get classes details -} searchClasses : Http.Request String searchClasses = { method = "GET" , url = basePath ++ "/blue/rest/classes/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request
true
{- PI:NAME:<NAME>END_PI Jenkins API clients generated from Swagger / Open API specification OpenAPI spec version: 1.1.1 Contact: PI:EMAIL:<EMAIL>END_PI NOTE: This file is auto generated by the openapi-generator. https://github.com/openapitools/openapi-generator.git Do not edit this file manually. -} module Request.BlueOcean exposing (deletePipelineQueueItem, getAuthenticatedUser, getClasses, getJsonWebKey, getJsonWebToken, getOrganisation, getOrganisations, getPipeline, getPipelineActivities, getPipelineBranch, getPipelineBranchRun, getPipelineBranches, getPipelineFolder, getPipelineFolderPipeline, getPipelineQueue, getPipelineRun, getPipelineRunLog, getPipelineRunNode, getPipelineRunNodeStep, getPipelineRunNodeStepLog, getPipelineRunNodeSteps, getPipelineRunNodes, getPipelineRuns, getPipelines, getSCM, getSCMOrganisationRepositories, getSCMOrganisationRepository, getSCMOrganisations, getUser, getUserFavorites, getUsers, postPipelineRun, postPipelineRuns, putPipelineFavorite, putPipelineRun, search, searchClasses) import Data.PipelineRun exposing (PipelineRun, pipelineRunDecoder) import Data.PipelineRunNodes exposing (PipelineRunNodes, pipelineRunNodesDecoder) import Data.PipelineRuns exposing (PipelineRuns, pipelineRunsDecoder) import Data.User exposing (User, userDecoder) import Data.Organisation exposing (Organisation, organisationDecoder) import Data.PipelineFolderImpl exposing (PipelineFolderImpl, pipelineFolderImplDecoder) import Data.PipelineImpl exposing (PipelineImpl, pipelineImplDecoder) import Data.Pipelines exposing (Pipelines, pipelinesDecoder) import Data.GithubScm exposing (GithubScm, githubScmDecoder) import Data.FavoriteImpl exposing (FavoriteImpl, favoriteImplDecoder) import Data.PipelineRunNodeSteps exposing (PipelineRunNodeSteps, pipelineRunNodeStepsDecoder) import Data.UserFavorites exposing (UserFavorites, userFavoritesDecoder) import Data.PipelineQueue exposing (PipelineQueue, pipelineQueueDecoder) import Data.Pipeline exposing (Pipeline, pipelineDecoder) import Data.PipelineRunNode exposing (PipelineRunNode, pipelineRunNodeDecoder) import Data.QueueItemImpl exposing (QueueItemImpl, queueItemImplDecoder) import Data.Organisations exposing (Organisations, organisationsDecoder) import Data.BranchImpl exposing (BranchImpl, branchImplDecoder) import Data.PipelineStepImpl exposing (PipelineStepImpl, pipelineStepImplDecoder) import Data.MultibranchPipeline exposing (MultibranchPipeline, multibranchPipelineDecoder) import Data.ScmOrganisations exposing (ScmOrganisations, scmOrganisationsDecoder) import Data.Body exposing (Body, bodyEncoder) import Data.PipelineActivities exposing (PipelineActivities, pipelineActivitiesDecoder) import Dict import Http import Json.Decode as Decode basePath : String basePath = "http://localhost" {-| Delete queue item from an organization pipeline queue -} deletePipelineQueueItem : String -> String -> String -> Http.Request () deletePipelineQueueItem organization pipeline queue = { method = "DELETE" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/queue/" ++ queue , headers = [] , body = Http.emptyBody , expect = Http.expectStringResponse (\_ -> Ok ()) , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve authenticated user details for an organization -} getAuthenticatedUser : String -> Http.Request User getAuthenticatedUser organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/user/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson userDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get a list of class names supported by a given class -} getClasses : String -> Http.Request String getClasses class = { method = "GET" , url = basePath ++ "/blue/rest/classes/" ++ class , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve JSON Web Key -} getJsonWebKey : Int -> Http.Request String getJsonWebKey key = { method = "GET" , url = basePath ++ "/jwt-auth/jwks/" ++ toString key , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve JSON Web Token -} getJsonWebToken : Http.Request String getJsonWebToken = { method = "GET" , url = basePath ++ "/jwt-auth/token" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve organization details -} getOrganisation : String -> Http.Request Organisation getOrganisation organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization , headers = [] , body = Http.emptyBody , expect = Http.expectJson organisationDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all organizations details -} getOrganisations : Http.Request Organisations getOrganisations = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson organisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve pipeline details for an organization -} getPipeline : String -> String -> Http.Request Pipeline getPipeline organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all activities details for an organization pipeline -} getPipelineActivities : String -> String -> Http.Request PipelineActivities getPipelineActivities organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/activities" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineActivitiesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve branch details for an organization pipeline -} getPipelineBranch : String -> String -> String -> Http.Request BranchImpl getPipelineBranch organization pipeline branch = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/branches/" ++ branch ++ "/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson branchImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve branch run details for an organization pipeline -} getPipelineBranchRun : String -> String -> String -> String -> Http.Request PipelineRun getPipelineBranchRun organization pipeline branch run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/branches/" ++ branch ++ "/runs/" ++ run , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all branches details for an organization pipeline -} getPipelineBranches : String -> String -> Http.Request MultibranchPipeline getPipelineBranches organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/branches" , headers = [] , body = Http.emptyBody , expect = Http.expectJson multibranchPipelineDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve pipeline folder for an organization -} getPipelineFolder : String -> String -> Http.Request PipelineFolderImpl getPipelineFolder organization folder = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ folder ++ "/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineFolderImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve pipeline details for an organization folder -} getPipelineFolderPipeline : String -> String -> String -> Http.Request PipelineImpl getPipelineFolderPipeline organization pipeline folder = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ folder ++ "/pipelines/" ++ pipeline , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve queue details for an organization pipeline -} getPipelineQueue : String -> String -> Http.Request PipelineQueue getPipelineQueue organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/queue" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineQueueDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run details for an organization pipeline -} getPipelineRun : String -> String -> String -> Http.Request PipelineRun getPipelineRun organization pipeline run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get log for a pipeline run -} getPipelineRunLog : String -> String -> String -> Http.Request String getPipelineRunLog organization pipeline run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/log" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run node details for an organization pipeline -} getPipelineRunNode : String -> String -> String -> String -> Http.Request PipelineRunNode getPipelineRunNode organization pipeline run node = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunNodeDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run node details for an organization pipeline -} getPipelineRunNodeStep : String -> String -> String -> String -> String -> Http.Request PipelineStepImpl getPipelineRunNodeStep organization pipeline run node step = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node ++ "/steps/" ++ step , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineStepImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get log for a pipeline run node step -} getPipelineRunNodeStepLog : String -> String -> String -> String -> String -> Http.Request String getPipelineRunNodeStepLog organization pipeline run node step = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node ++ "/steps/" ++ step ++ "/log" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run node steps details for an organization pipeline -} getPipelineRunNodeSteps : String -> String -> String -> String -> Http.Request PipelineRunNodeSteps getPipelineRunNodeSteps organization pipeline run node = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes/" ++ node ++ "/steps" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunNodeStepsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve run nodes details for an organization pipeline -} getPipelineRunNodes : String -> String -> String -> Http.Request PipelineRunNodes getPipelineRunNodes organization pipeline run = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/nodes" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunNodesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all runs details for an organization pipeline -} getPipelineRuns : String -> String -> Http.Request PipelineRuns getPipelineRuns organization pipeline = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve all pipelines details for an organization -} getPipelines : String -> Http.Request Pipelines getPipelines organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelinesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM details for an organization -} getSCM : String -> String -> Http.Request GithubScm getSCM organization scm = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm , headers = [] , body = Http.emptyBody , expect = Http.expectJson githubScmDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM organization repositories details for an organization -} getSCMOrganisationRepositories : String -> String -> String -> Http.Request ScmOrganisations getSCMOrganisationRepositories organization scm scmOrganisation = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm ++ "/organizations/" ++ scmOrganisation ++ "/repositories" , headers = [] , body = Http.emptyBody , expect = Http.expectJson scmOrganisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM organization repository details for an organization -} getSCMOrganisationRepository : String -> String -> String -> String -> Http.Request ScmOrganisations getSCMOrganisationRepository organization scm scmOrganisation repository = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm ++ "/organizations/" ++ scmOrganisation ++ "/repositories/" ++ repository , headers = [] , body = Http.emptyBody , expect = Http.expectJson scmOrganisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve SCM organizations details for an organization -} getSCMOrganisations : String -> String -> Http.Request ScmOrganisations getSCMOrganisations organization scm = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/scm/" ++ scm ++ "/organizations" , headers = [] , body = Http.emptyBody , expect = Http.expectJson scmOrganisationsDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve user details for an organization -} getUser : String -> String -> Http.Request User getUser organization user = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/users/" ++ user , headers = [] , body = Http.emptyBody , expect = Http.expectJson userDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve user favorites details for an organization -} getUserFavorites : String -> Http.Request UserFavorites getUserFavorites user = { method = "GET" , url = basePath ++ "/blue/rest/users/" ++ user ++ "/favorites" , headers = [] , body = Http.emptyBody , expect = Http.expectJson userFavoritesDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Retrieve users details for an organization -} getUsers : String -> Http.Request User getUsers organization = { method = "GET" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/users/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson userDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Replay an organization pipeline run -} postPipelineRun : String -> String -> String -> Http.Request QueueItemImpl postPipelineRun organization pipeline run = { method = "POST" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/replay" , headers = [] , body = Http.emptyBody , expect = Http.expectJson queueItemImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Start a build for an organization pipeline -} postPipelineRuns : String -> String -> Http.Request QueueItemImpl postPipelineRuns organization pipeline = { method = "POST" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs" , headers = [] , body = Http.emptyBody , expect = Http.expectJson queueItemImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Favorite/unfavorite a pipeline -} putPipelineFavorite : String -> String -> Body -> Http.Request FavoriteImpl putPipelineFavorite organization pipeline model = { method = "PUT" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/favorite" , headers = [] , body = Http.jsonBody <| bodyEncoder model , expect = Http.expectJson favoriteImplDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Stop a build of an organization pipeline -} putPipelineRun : String -> String -> String -> Http.Request PipelineRun putPipelineRun organization pipeline run = { method = "PUT" , url = basePath ++ "/blue/rest/organizations/" ++ organization ++ "/pipelines/" ++ pipeline ++ "/runs/" ++ run ++ "/stop" , headers = [] , body = Http.emptyBody , expect = Http.expectJson pipelineRunDecoder , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Search for any resource details -} search : Http.Request String search = { method = "GET" , url = basePath ++ "/blue/rest/search/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request {-| Get classes details -} searchClasses : Http.Request String searchClasses = { method = "GET" , url = basePath ++ "/blue/rest/classes/" , headers = [] , body = Http.emptyBody , expect = Http.expectJson Decode.string , timeout = Just 30000 , withCredentials = False } |> Http.request
elm
[ { "context": "tionSet.foldl (+)\n 0\n ([ { owner = \"dillonkearns\", name = \"mobster\" }\n , { owner = \"dillon", "end": 623, "score": 0.9982535839, "start": 611, "tag": "USERNAME", "value": "dillonkearns" }, { "context": " 0\n ([ { owner = \"dillonkearns\", name = \"mobster\" }\n , { owner = \"dillonkearns\", name = \"e", "end": 641, "score": 0.9942035675, "start": 634, "tag": "USERNAME", "value": "mobster" }, { "context": "kearns\", name = \"mobster\" }\n , { owner = \"dillonkearns\", name = \"elm-graphql\" }\n , { owner = \"di", "end": 679, "score": 0.9971275926, "start": 667, "tag": "USERNAME", "value": "dillonkearns" }, { "context": "ns\", name = \"elm-graphql\" }\n , { owner = \"dillonkearns\", name = \"elm-typescript-interop\" }\n ]\n ", "end": 739, "score": 0.9970126152, "start": 727, "tag": "USERNAME", "value": "dillonkearns" }, { "context": "|> Graphql.Http.withHeader \"authorization\" \"Bearer dbd4c239b0bbaa40ab0ea291fa811775da8f5b59\"\n |> Graphql.Http.send (RemoteData.fromRes", "end": 1295, "score": 0.7929984331, "start": 1255, "tag": "KEY", "value": "dbd4c239b0bbaa40ab0ea291fa811775da8f5b59" } ]
examples/src/Example08Foldr.elm
aptinio/elm-graphql
625
module Example08Foldr exposing (main) import Github.Object import Github.Object.Repository as Repository import Github.Object.StargazerConnection import Github.Query as Query import Graphql.Document as Document import Graphql.Http import Graphql.Operation exposing (RootQuery) import Graphql.OptionalArgument exposing (OptionalArgument(..)) import Graphql.SelectionSet as SelectionSet exposing (SelectionSet) import Helpers.Main import RemoteData exposing (RemoteData) type alias Response = Int query : SelectionSet Response RootQuery query = SelectionSet.foldl (+) 0 ([ { owner = "dillonkearns", name = "mobster" } , { owner = "dillonkearns", name = "elm-graphql" } , { owner = "dillonkearns", name = "elm-typescript-interop" } ] |> List.map (\args -> Query.repository args stargazerCount) |> List.map SelectionSet.nonNullOrFail ) stargazerCount : SelectionSet Int Github.Object.Repository stargazerCount = Repository.stargazers identity Github.Object.StargazerConnection.totalCount makeRequest : Cmd Msg makeRequest = query |> Graphql.Http.queryRequest "https://api.github.com/graphql" |> Graphql.Http.withHeader "authorization" "Bearer dbd4c239b0bbaa40ab0ea291fa811775da8f5b59" |> Graphql.Http.send (RemoteData.fromResult >> GotResponse) type Msg = GotResponse Model type alias Model = RemoteData (Graphql.Http.Error Response) Response init : () -> ( Model, Cmd Msg ) init _ = ( RemoteData.Loading , makeRequest ) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of GotResponse response -> ( response, Cmd.none ) type alias Flags = () main : Helpers.Main.Program Flags Model Msg main = Helpers.Main.document { init = init , update = update , queryString = Document.serializeQuery query }
12762
module Example08Foldr exposing (main) import Github.Object import Github.Object.Repository as Repository import Github.Object.StargazerConnection import Github.Query as Query import Graphql.Document as Document import Graphql.Http import Graphql.Operation exposing (RootQuery) import Graphql.OptionalArgument exposing (OptionalArgument(..)) import Graphql.SelectionSet as SelectionSet exposing (SelectionSet) import Helpers.Main import RemoteData exposing (RemoteData) type alias Response = Int query : SelectionSet Response RootQuery query = SelectionSet.foldl (+) 0 ([ { owner = "dillonkearns", name = "mobster" } , { owner = "dillonkearns", name = "elm-graphql" } , { owner = "dillonkearns", name = "elm-typescript-interop" } ] |> List.map (\args -> Query.repository args stargazerCount) |> List.map SelectionSet.nonNullOrFail ) stargazerCount : SelectionSet Int Github.Object.Repository stargazerCount = Repository.stargazers identity Github.Object.StargazerConnection.totalCount makeRequest : Cmd Msg makeRequest = query |> Graphql.Http.queryRequest "https://api.github.com/graphql" |> Graphql.Http.withHeader "authorization" "Bearer <KEY>" |> Graphql.Http.send (RemoteData.fromResult >> GotResponse) type Msg = GotResponse Model type alias Model = RemoteData (Graphql.Http.Error Response) Response init : () -> ( Model, Cmd Msg ) init _ = ( RemoteData.Loading , makeRequest ) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of GotResponse response -> ( response, Cmd.none ) type alias Flags = () main : Helpers.Main.Program Flags Model Msg main = Helpers.Main.document { init = init , update = update , queryString = Document.serializeQuery query }
true
module Example08Foldr exposing (main) import Github.Object import Github.Object.Repository as Repository import Github.Object.StargazerConnection import Github.Query as Query import Graphql.Document as Document import Graphql.Http import Graphql.Operation exposing (RootQuery) import Graphql.OptionalArgument exposing (OptionalArgument(..)) import Graphql.SelectionSet as SelectionSet exposing (SelectionSet) import Helpers.Main import RemoteData exposing (RemoteData) type alias Response = Int query : SelectionSet Response RootQuery query = SelectionSet.foldl (+) 0 ([ { owner = "dillonkearns", name = "mobster" } , { owner = "dillonkearns", name = "elm-graphql" } , { owner = "dillonkearns", name = "elm-typescript-interop" } ] |> List.map (\args -> Query.repository args stargazerCount) |> List.map SelectionSet.nonNullOrFail ) stargazerCount : SelectionSet Int Github.Object.Repository stargazerCount = Repository.stargazers identity Github.Object.StargazerConnection.totalCount makeRequest : Cmd Msg makeRequest = query |> Graphql.Http.queryRequest "https://api.github.com/graphql" |> Graphql.Http.withHeader "authorization" "Bearer PI:KEY:<KEY>END_PI" |> Graphql.Http.send (RemoteData.fromResult >> GotResponse) type Msg = GotResponse Model type alias Model = RemoteData (Graphql.Http.Error Response) Response init : () -> ( Model, Cmd Msg ) init _ = ( RemoteData.Loading , makeRequest ) update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of GotResponse response -> ( response, Cmd.none ) type alias Flags = () main : Helpers.Main.Program Flags Model Msg main = Helpers.Main.document { init = init , update = update , queryString = Document.serializeQuery query }
elm
[ { "context": "10px; margin-left: -10px\" src=\"https://github.com/terezka/line-charts/blob/master/images/shapes.png?raw=tru", "end": 416, "score": 0.9994040132, "start": 409, "tag": "USERNAME", "value": "terezka" }, { "context": " [ LineChart.line Colors.gold Dots.circle \"Alice\" alice\n\n -- ", "end": 1012, "score": 0.8917350173, "start": 1007, "tag": "NAME", "value": "Alice" }, { "context": " [ LineChart.line Colors.gold Dots.circle \"Alice\" alice\n\n -- ^^^^^^^", "end": 1019, "score": 0.5453820825, "start": 1014, "tag": "NAME", "value": "alice" }, { "context": " , LineChart.line Colors.blue Dots.square \"Bobby\" bobby\n\n -- ", "end": 1133, "score": 0.736997962, "start": 1128, "tag": "NAME", "value": "Bobby" }, { "context": "\n\n_See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Exampl", "end": 1388, "score": 0.9995871186, "start": 1381, "tag": "USERNAME", "value": "terezka" }, { "context": "\n\n_See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Exampl", "end": 2717, "score": 0.9997367859, "start": 2710, "tag": "USERNAME", "value": "terezka" }, { "context": "\n\n_See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Exampl", "end": 3480, "score": 0.9996048808, "start": 3473, "tag": "USERNAME", "value": "terezka" }, { "context": "\n\n_See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Exampl", "end": 4105, "score": 0.9997112751, "start": 4098, "tag": "USERNAME", "value": "terezka" }, { "context": "\n\n_See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Exampl", "end": 4508, "score": 0.9997298121, "start": 4501, "tag": "USERNAME", "value": "terezka" }, { "context": "\n\n_See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Exampl", "end": 5171, "score": 0.9997237325, "start": 5164, "tag": "USERNAME", "value": "terezka" }, { "context": "alt=\"Legends\" width=\"540\" src=\"https://github.com/terezka/line-charts/blob/master/images/dots1.png?raw=true", "end": 5795, "score": 0.9975765347, "start": 5788, "tag": "USERNAME", "value": "terezka" }, { "context": "alt=\"Legends\" width=\"540\" src=\"https://github.com/terezka/line-charts/blob/master/images/dots3.png?raw=true", "end": 6067, "score": 0.9955406189, "start": 6060, "tag": "USERNAME", "value": "terezka" }, { "context": "alt=\"Legends\" width=\"540\" src=\"https://github.com/terezka/line-charts/blob/master/images/dots4.png?raw=true", "end": 6349, "score": 0.9960470796, "start": 6342, "tag": "USERNAME", "value": "terezka" }, { "context": "alt=\"Legends\" width=\"540\" src=\"https://github.com/terezka/line-charts/blob/master/images/dots2.png?raw=true", "end": 6723, "score": 0.9974346161, "start": 6716, "tag": "USERNAME", "value": "terezka" } ]
src/LineChart/Dots.elm
truqu/line-charts
1
module LineChart.Dots exposing ( Shape , none, circle, triangle, square, diamond, plus, cross , Config, default , hoverOne, hoverMany , custom, customAny , Style, full, empty, disconnected, aura ) {-| # Shapes @docs Shape ## Selection Hopefully, these are self-explanatory. <img alt="Legends" width="610" style="margin-top: 10px; margin-left: -10px" src="https://github.com/terezka/line-charts/blob/master/images/shapes.png?raw=true"></src> @docs none, circle, triangle, square, diamond, plus, cross # Styles @docs Config, default ## Hover styles @docs hoverOne, hoverMany ## Customization @docs custom, customAny ### Selection @docs Style, full, empty, disconnected, aura -} import Internal.Dots as Dots -- QUICK START {-| **Change the shape of your dots** The shape type changes the shape of your dots. humanChart : Html msg humanChart = LineChart.view .age .income [ LineChart.line Colors.gold Dots.circle "Alice" alice -- ^^^^^^^^^^^ , LineChart.line Colors.blue Dots.square "Bobby" bobby -- ^^^^^^^^^^^ , LineChart.line Colors.pink Dots.diamond "Chuck" chuck -- ^^^^^^^^^^^^ ] _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example1.elm)._ **What is a dot?** Dots denote where your data points are on your line. They can be different shapes (circle, square, etc.) for each line. -} type alias Shape = Dots.Shape {-| -} none : Shape none = Dots.None {-| -} circle : Shape circle = Dots.Circle {-| -} triangle : Shape triangle = Dots.Triangle {-| -} square : Shape square = Dots.Square {-| -} diamond : Shape diamond = Dots.Diamond {-| -} plus : Shape plus = Dots.Plus {-| -} cross : Shape cross = Dots.Cross {-| **Change the style of your dots** Use in the `LineChart.Config` passed to `LineChart.viewCustom`. chartConfig : LineChart.Config Data Msg chartConfig = { ... , dots = Dots.default , ... } **What is a dot style?** The style of the dot includes the size of the dot and various other qualities like whether it has a border or not. See your options under _Styles_. -} type alias Config data = Dots.Config data {-| Draws a white outline around all your dots. -} default : Config data default = Dots.default -- CONFIG {-| Change the style of _all_ your dots. dotsConfig : Dots.Config Data dotsConfig = Dots.custom (Dots.full 5) _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example2.elm)._ -} custom : Style -> Config data custom = Dots.custom {-| Change the style of _any_ of your dots. Particularly useful for hover states, but it can also be used for creating another dimension for your chart by varying the size of your dots based on some property. **Extra dimension example** customDotsConfig : Dots.Config Data customDotsConfig = let styleLegend _ = Dots.full 7 styleIndividual datum = Dots.full <| (datum.height - 1) * 12 in Dots.customAny { legend = styleLegend , individual = styleIndividual } _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example4.elm)._ **Hover state example** customDotsConfig : Maybe Data -> Dots.Config Data customDotsConfig maybeHovered = let styleLegend _ = Dots.disconnected 10 2 styleIndividual datum = if Just datum == maybeHovered then Dots.empty 8 2 else Dots.disconnected 10 2 in Dots.customAny { legend = styleLegend , individual = styleIndividual } _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example6.elm)._ -} customAny : { legend : List data -> Style , individual : data -> Style } -> Config data customAny = Dots.customAny {-| Adds a hover effect on the given dot! dotsConfig : Maybe Data -> Dots.Config Data dotsConfig hovered = Dots.hoverOne hovered _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example3.elm)._ -} hoverOne : Maybe data -> Config data hoverOne maybeHovered = let styleLegend _ = disconnected 10 2 styleIndividual datum = if Just datum == maybeHovered then aura 7 6 0.3 else disconnected 10 2 in Dots.customAny { legend = styleLegend , individual = styleIndividual } {-| Adds a hover effect on several given dots! dotsConfig : List Data -> Dots.Config Data dotsConfig hovered = Dots.hoverMany hovered _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example5.elm)._ -} hoverMany : List data -> Config data hoverMany hovered = let styleLegend _ = disconnected 10 2 styleIndividual datum = if List.any ((==) datum) hovered then aura 7 6 0.3 else disconnected 10 2 in Dots.customAny { legend = styleLegend , individual = styleIndividual } -- STYLES {-| -} type alias Style = Dots.Style {-| Makes dots plain and solid. Pass the radius. <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots1.png?raw=true"></src> -} full : Float -> Style full = Dots.full {-| Makes dots with a white core and a colored border. Pass the radius and the width of the border. <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots3.png?raw=true"></src> -} empty : Float -> Int -> Style empty = Dots.empty {-| Makes dots with a colored core and a white border. Pass the radius and the width of the border. <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots4.png?raw=true"></src> -} disconnected : Float -> Int -> Style disconnected = Dots.disconnected {-| Makes dots with a colored core and a less colored, transparent "aura". Pass the radius, the width of the aura, and the opacity of the aura (A number between 0 and 1). <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots2.png?raw=true"></src> -} aura : Float -> Int -> Float -> Style aura = Dots.aura
59379
module LineChart.Dots exposing ( Shape , none, circle, triangle, square, diamond, plus, cross , Config, default , hoverOne, hoverMany , custom, customAny , Style, full, empty, disconnected, aura ) {-| # Shapes @docs Shape ## Selection Hopefully, these are self-explanatory. <img alt="Legends" width="610" style="margin-top: 10px; margin-left: -10px" src="https://github.com/terezka/line-charts/blob/master/images/shapes.png?raw=true"></src> @docs none, circle, triangle, square, diamond, plus, cross # Styles @docs Config, default ## Hover styles @docs hoverOne, hoverMany ## Customization @docs custom, customAny ### Selection @docs Style, full, empty, disconnected, aura -} import Internal.Dots as Dots -- QUICK START {-| **Change the shape of your dots** The shape type changes the shape of your dots. humanChart : Html msg humanChart = LineChart.view .age .income [ LineChart.line Colors.gold Dots.circle "<NAME>" <NAME> -- ^^^^^^^^^^^ , LineChart.line Colors.blue Dots.square "<NAME>" bobby -- ^^^^^^^^^^^ , LineChart.line Colors.pink Dots.diamond "Chuck" chuck -- ^^^^^^^^^^^^ ] _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example1.elm)._ **What is a dot?** Dots denote where your data points are on your line. They can be different shapes (circle, square, etc.) for each line. -} type alias Shape = Dots.Shape {-| -} none : Shape none = Dots.None {-| -} circle : Shape circle = Dots.Circle {-| -} triangle : Shape triangle = Dots.Triangle {-| -} square : Shape square = Dots.Square {-| -} diamond : Shape diamond = Dots.Diamond {-| -} plus : Shape plus = Dots.Plus {-| -} cross : Shape cross = Dots.Cross {-| **Change the style of your dots** Use in the `LineChart.Config` passed to `LineChart.viewCustom`. chartConfig : LineChart.Config Data Msg chartConfig = { ... , dots = Dots.default , ... } **What is a dot style?** The style of the dot includes the size of the dot and various other qualities like whether it has a border or not. See your options under _Styles_. -} type alias Config data = Dots.Config data {-| Draws a white outline around all your dots. -} default : Config data default = Dots.default -- CONFIG {-| Change the style of _all_ your dots. dotsConfig : Dots.Config Data dotsConfig = Dots.custom (Dots.full 5) _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example2.elm)._ -} custom : Style -> Config data custom = Dots.custom {-| Change the style of _any_ of your dots. Particularly useful for hover states, but it can also be used for creating another dimension for your chart by varying the size of your dots based on some property. **Extra dimension example** customDotsConfig : Dots.Config Data customDotsConfig = let styleLegend _ = Dots.full 7 styleIndividual datum = Dots.full <| (datum.height - 1) * 12 in Dots.customAny { legend = styleLegend , individual = styleIndividual } _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example4.elm)._ **Hover state example** customDotsConfig : Maybe Data -> Dots.Config Data customDotsConfig maybeHovered = let styleLegend _ = Dots.disconnected 10 2 styleIndividual datum = if Just datum == maybeHovered then Dots.empty 8 2 else Dots.disconnected 10 2 in Dots.customAny { legend = styleLegend , individual = styleIndividual } _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example6.elm)._ -} customAny : { legend : List data -> Style , individual : data -> Style } -> Config data customAny = Dots.customAny {-| Adds a hover effect on the given dot! dotsConfig : Maybe Data -> Dots.Config Data dotsConfig hovered = Dots.hoverOne hovered _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example3.elm)._ -} hoverOne : Maybe data -> Config data hoverOne maybeHovered = let styleLegend _ = disconnected 10 2 styleIndividual datum = if Just datum == maybeHovered then aura 7 6 0.3 else disconnected 10 2 in Dots.customAny { legend = styleLegend , individual = styleIndividual } {-| Adds a hover effect on several given dots! dotsConfig : List Data -> Dots.Config Data dotsConfig hovered = Dots.hoverMany hovered _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example5.elm)._ -} hoverMany : List data -> Config data hoverMany hovered = let styleLegend _ = disconnected 10 2 styleIndividual datum = if List.any ((==) datum) hovered then aura 7 6 0.3 else disconnected 10 2 in Dots.customAny { legend = styleLegend , individual = styleIndividual } -- STYLES {-| -} type alias Style = Dots.Style {-| Makes dots plain and solid. Pass the radius. <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots1.png?raw=true"></src> -} full : Float -> Style full = Dots.full {-| Makes dots with a white core and a colored border. Pass the radius and the width of the border. <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots3.png?raw=true"></src> -} empty : Float -> Int -> Style empty = Dots.empty {-| Makes dots with a colored core and a white border. Pass the radius and the width of the border. <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots4.png?raw=true"></src> -} disconnected : Float -> Int -> Style disconnected = Dots.disconnected {-| Makes dots with a colored core and a less colored, transparent "aura". Pass the radius, the width of the aura, and the opacity of the aura (A number between 0 and 1). <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots2.png?raw=true"></src> -} aura : Float -> Int -> Float -> Style aura = Dots.aura
true
module LineChart.Dots exposing ( Shape , none, circle, triangle, square, diamond, plus, cross , Config, default , hoverOne, hoverMany , custom, customAny , Style, full, empty, disconnected, aura ) {-| # Shapes @docs Shape ## Selection Hopefully, these are self-explanatory. <img alt="Legends" width="610" style="margin-top: 10px; margin-left: -10px" src="https://github.com/terezka/line-charts/blob/master/images/shapes.png?raw=true"></src> @docs none, circle, triangle, square, diamond, plus, cross # Styles @docs Config, default ## Hover styles @docs hoverOne, hoverMany ## Customization @docs custom, customAny ### Selection @docs Style, full, empty, disconnected, aura -} import Internal.Dots as Dots -- QUICK START {-| **Change the shape of your dots** The shape type changes the shape of your dots. humanChart : Html msg humanChart = LineChart.view .age .income [ LineChart.line Colors.gold Dots.circle "PI:NAME:<NAME>END_PI" PI:NAME:<NAME>END_PI -- ^^^^^^^^^^^ , LineChart.line Colors.blue Dots.square "PI:NAME:<NAME>END_PI" bobby -- ^^^^^^^^^^^ , LineChart.line Colors.pink Dots.diamond "Chuck" chuck -- ^^^^^^^^^^^^ ] _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example1.elm)._ **What is a dot?** Dots denote where your data points are on your line. They can be different shapes (circle, square, etc.) for each line. -} type alias Shape = Dots.Shape {-| -} none : Shape none = Dots.None {-| -} circle : Shape circle = Dots.Circle {-| -} triangle : Shape triangle = Dots.Triangle {-| -} square : Shape square = Dots.Square {-| -} diamond : Shape diamond = Dots.Diamond {-| -} plus : Shape plus = Dots.Plus {-| -} cross : Shape cross = Dots.Cross {-| **Change the style of your dots** Use in the `LineChart.Config` passed to `LineChart.viewCustom`. chartConfig : LineChart.Config Data Msg chartConfig = { ... , dots = Dots.default , ... } **What is a dot style?** The style of the dot includes the size of the dot and various other qualities like whether it has a border or not. See your options under _Styles_. -} type alias Config data = Dots.Config data {-| Draws a white outline around all your dots. -} default : Config data default = Dots.default -- CONFIG {-| Change the style of _all_ your dots. dotsConfig : Dots.Config Data dotsConfig = Dots.custom (Dots.full 5) _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example2.elm)._ -} custom : Style -> Config data custom = Dots.custom {-| Change the style of _any_ of your dots. Particularly useful for hover states, but it can also be used for creating another dimension for your chart by varying the size of your dots based on some property. **Extra dimension example** customDotsConfig : Dots.Config Data customDotsConfig = let styleLegend _ = Dots.full 7 styleIndividual datum = Dots.full <| (datum.height - 1) * 12 in Dots.customAny { legend = styleLegend , individual = styleIndividual } _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example4.elm)._ **Hover state example** customDotsConfig : Maybe Data -> Dots.Config Data customDotsConfig maybeHovered = let styleLegend _ = Dots.disconnected 10 2 styleIndividual datum = if Just datum == maybeHovered then Dots.empty 8 2 else Dots.disconnected 10 2 in Dots.customAny { legend = styleLegend , individual = styleIndividual } _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example6.elm)._ -} customAny : { legend : List data -> Style , individual : data -> Style } -> Config data customAny = Dots.customAny {-| Adds a hover effect on the given dot! dotsConfig : Maybe Data -> Dots.Config Data dotsConfig hovered = Dots.hoverOne hovered _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example3.elm)._ -} hoverOne : Maybe data -> Config data hoverOne maybeHovered = let styleLegend _ = disconnected 10 2 styleIndividual datum = if Just datum == maybeHovered then aura 7 6 0.3 else disconnected 10 2 in Dots.customAny { legend = styleLegend , individual = styleIndividual } {-| Adds a hover effect on several given dots! dotsConfig : List Data -> Dots.Config Data dotsConfig hovered = Dots.hoverMany hovered _See the full example [here](https://github.com/terezka/line-charts/blob/master/examples/Docs/Dots/Example5.elm)._ -} hoverMany : List data -> Config data hoverMany hovered = let styleLegend _ = disconnected 10 2 styleIndividual datum = if List.any ((==) datum) hovered then aura 7 6 0.3 else disconnected 10 2 in Dots.customAny { legend = styleLegend , individual = styleIndividual } -- STYLES {-| -} type alias Style = Dots.Style {-| Makes dots plain and solid. Pass the radius. <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots1.png?raw=true"></src> -} full : Float -> Style full = Dots.full {-| Makes dots with a white core and a colored border. Pass the radius and the width of the border. <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots3.png?raw=true"></src> -} empty : Float -> Int -> Style empty = Dots.empty {-| Makes dots with a colored core and a white border. Pass the radius and the width of the border. <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots4.png?raw=true"></src> -} disconnected : Float -> Int -> Style disconnected = Dots.disconnected {-| Makes dots with a colored core and a less colored, transparent "aura". Pass the radius, the width of the aura, and the opacity of the aura (A number between 0 and 1). <img alt="Legends" width="540" src="https://github.com/terezka/line-charts/blob/master/images/dots2.png?raw=true"></src> -} aura : Float -> Int -> Float -> Style aura = Dots.aura
elm
[ { "context": " \"active\": true,\n \"first_name\": \"System\",\n \"id\": -1,\n \"last_name\": \"Use", "end": 735, "score": 0.9919292331, "start": 729, "tag": "NAME", "value": "System" }, { "context": "tem\",\n \"id\": -1,\n \"last_name\": \"User\",\n \"name\": \"System User\",\n \"pre", "end": 786, "score": 0.9976353049, "start": 782, "tag": "NAME", "value": "User" }, { "context": " \"last_name\": \"User\",\n \"name\": \"System User\",\n \"preferred_navigation\": \"REMAIN\",\n ", "end": 819, "score": 0.9658101797, "start": 808, "tag": "NAME", "value": "System User" }, { "context": " \"active\": true,\n \"first_name\": \"System\",\n \"id\": -1,\n \"last_name\": \"Use", "end": 2614, "score": 0.9982039928, "start": 2608, "tag": "NAME", "value": "System" }, { "context": "tem\",\n \"id\": -1,\n \"last_name\": \"User\",\n \"name\": \"System User\",\n \"pre", "end": 2665, "score": 0.9986584187, "start": 2661, "tag": "NAME", "value": "User" }, { "context": " \"last_name\": \"User\",\n \"name\": \"System User\",\n \"preferred_navigation\": \"REMAIN\",\n ", "end": 2698, "score": 0.9896793365, "start": 2687, "tag": "NAME", "value": "System User" }, { "context": ".\",\n \"id\": 1,\n \"name\": \"Superuser\"\n }\n ]\n },\n ", "end": 2909, "score": 0.7686120868, "start": 2904, "tag": "USERNAME", "value": "Super" } ]
pages/tests/TestDetainerWarrant.elm
gregziegan/eviction-tracker
5
module TestDetainerWarrant exposing (..) import DetainerWarrant exposing (DetainerWarrant, Status(..)) import Expect import Json.Decode as Decode import PleadingDocument exposing (PleadingDocument) import Test exposing (..) import Time import Url import Url.Builder minimalJson = """ { "address": "123 Some Street, Nashville, TN 37010", "amount_claimed": null, "claims_possession": null, "created_at": 1633382326000, "defendants": [], "docket_id": "21GC11668", "document": null, "file_date": null, "hearings": [], "is_cares": null, "is_legacy": null, "last_edited_by": { "active": true, "first_name": "System", "id": -1, "last_name": "User", "name": "System User", "preferred_navigation": "REMAIN", "roles": [ { "description": "A user with complete access to all resources.", "id": 1, "name": "Superuser" } ] }, "nonpayment": null, "notes": null, "order_number": 21011668, "plaintiff": null, "plaintiff_attorney": null, "status": null, "updated_at": 1634569282000, "zip_code": null } """ minimalDetainer : DetainerWarrant minimalDetainer = { docketId = "21GC11668" , address = Just "123 Some Street, Nashville, TN 37010" , amountClaimed = Nothing , claimsPossession = Nothing , hearings = [] , defendants = [] , fileDate = Nothing , isCares = Nothing , isLegacy = Nothing , nonpayment = Nothing , plaintiff = Nothing , plaintiffAttorney = Nothing , status = Nothing , notes = Nothing , document = Nothing } maximumJson = """ { "address": "123 Some Street, Nashville, TN 37010", "amount_claimed": 123.45, "claims_possession": true, "created_at": 1633382326000, "defendants": [], "docket_id": "21GT11668", "document": { "created_at": 1637071221000, "docket_id": "21GT1234", "kind": "DETAINER_WARRANT", "text": "COPY EFILED 07/20/21 07:28 AM CASE NO. 21GT1234 ...", "updated_at": 1642214383000, "url": "https://caselinkimages.nashville.gov/PublicSessions/21/21GT1234/2197025.pdf" }, "file_date": 1635901200000, "hearings": [], "is_cares": true, "is_legacy": false, "last_edited_by": { "active": true, "first_name": "System", "id": -1, "last_name": "User", "name": "System User", "preferred_navigation": "REMAIN", "roles": [ { "description": "A user with complete access to all resources.", "id": 1, "name": "Superuser" } ] }, "nonpayment": true, "notes": "some notes", "order_number": 21011668, "plaintiff": null, "plaintiff_attorney": null, "status": "PENDING", "updated_at": 1634569282000, "zip_code": null } """ maximumDetainer : DetainerWarrant maximumDetainer = { docketId = "21GT11668" , address = Just "123 Some Street, Nashville, TN 37010" , amountClaimed = Just 123.45 , claimsPossession = Just True , fileDate = Just (Time.millisToPosix 1635901200000) , hearings = [] , isCares = Just True , isLegacy = Just False , nonpayment = Just True , status = Just Pending , notes = Just "some notes" , plaintiff = Nothing , plaintiffAttorney = Nothing , defendants = [] , document = Just { createdAt = Time.millisToPosix 1637071221000 , kind = Just PleadingDocument.DetainerWarrantDocument , text = Just "COPY EFILED 07/20/21 07:28 AM CASE NO. 21GT1234 ..." , updatedAt = Time.millisToPosix 1642214383000 , url = { protocol = Url.Https , host = "caselinkimages.nashville.gov" , port_ = Nothing , path = "/PublicSessions/21/21GT1234/2197025.pdf" , query = Nothing , fragment = Nothing } } } all : Test all = describe "Creation" [ test "decodes with nulls" <| \() -> Expect.equal (Result.Ok minimalDetainer) (Decode.decodeString DetainerWarrant.decoder minimalJson) , test "decodes with all values" <| \() -> Expect.equal (Result.Ok maximumDetainer) (Decode.decodeString DetainerWarrant.decoder maximumJson) ]
46379
module TestDetainerWarrant exposing (..) import DetainerWarrant exposing (DetainerWarrant, Status(..)) import Expect import Json.Decode as Decode import PleadingDocument exposing (PleadingDocument) import Test exposing (..) import Time import Url import Url.Builder minimalJson = """ { "address": "123 Some Street, Nashville, TN 37010", "amount_claimed": null, "claims_possession": null, "created_at": 1633382326000, "defendants": [], "docket_id": "21GC11668", "document": null, "file_date": null, "hearings": [], "is_cares": null, "is_legacy": null, "last_edited_by": { "active": true, "first_name": "<NAME>", "id": -1, "last_name": "<NAME>", "name": "<NAME>", "preferred_navigation": "REMAIN", "roles": [ { "description": "A user with complete access to all resources.", "id": 1, "name": "Superuser" } ] }, "nonpayment": null, "notes": null, "order_number": 21011668, "plaintiff": null, "plaintiff_attorney": null, "status": null, "updated_at": 1634569282000, "zip_code": null } """ minimalDetainer : DetainerWarrant minimalDetainer = { docketId = "21GC11668" , address = Just "123 Some Street, Nashville, TN 37010" , amountClaimed = Nothing , claimsPossession = Nothing , hearings = [] , defendants = [] , fileDate = Nothing , isCares = Nothing , isLegacy = Nothing , nonpayment = Nothing , plaintiff = Nothing , plaintiffAttorney = Nothing , status = Nothing , notes = Nothing , document = Nothing } maximumJson = """ { "address": "123 Some Street, Nashville, TN 37010", "amount_claimed": 123.45, "claims_possession": true, "created_at": 1633382326000, "defendants": [], "docket_id": "21GT11668", "document": { "created_at": 1637071221000, "docket_id": "21GT1234", "kind": "DETAINER_WARRANT", "text": "COPY EFILED 07/20/21 07:28 AM CASE NO. 21GT1234 ...", "updated_at": 1642214383000, "url": "https://caselinkimages.nashville.gov/PublicSessions/21/21GT1234/2197025.pdf" }, "file_date": 1635901200000, "hearings": [], "is_cares": true, "is_legacy": false, "last_edited_by": { "active": true, "first_name": "<NAME>", "id": -1, "last_name": "<NAME>", "name": "<NAME>", "preferred_navigation": "REMAIN", "roles": [ { "description": "A user with complete access to all resources.", "id": 1, "name": "Superuser" } ] }, "nonpayment": true, "notes": "some notes", "order_number": 21011668, "plaintiff": null, "plaintiff_attorney": null, "status": "PENDING", "updated_at": 1634569282000, "zip_code": null } """ maximumDetainer : DetainerWarrant maximumDetainer = { docketId = "21GT11668" , address = Just "123 Some Street, Nashville, TN 37010" , amountClaimed = Just 123.45 , claimsPossession = Just True , fileDate = Just (Time.millisToPosix 1635901200000) , hearings = [] , isCares = Just True , isLegacy = Just False , nonpayment = Just True , status = Just Pending , notes = Just "some notes" , plaintiff = Nothing , plaintiffAttorney = Nothing , defendants = [] , document = Just { createdAt = Time.millisToPosix 1637071221000 , kind = Just PleadingDocument.DetainerWarrantDocument , text = Just "COPY EFILED 07/20/21 07:28 AM CASE NO. 21GT1234 ..." , updatedAt = Time.millisToPosix 1642214383000 , url = { protocol = Url.Https , host = "caselinkimages.nashville.gov" , port_ = Nothing , path = "/PublicSessions/21/21GT1234/2197025.pdf" , query = Nothing , fragment = Nothing } } } all : Test all = describe "Creation" [ test "decodes with nulls" <| \() -> Expect.equal (Result.Ok minimalDetainer) (Decode.decodeString DetainerWarrant.decoder minimalJson) , test "decodes with all values" <| \() -> Expect.equal (Result.Ok maximumDetainer) (Decode.decodeString DetainerWarrant.decoder maximumJson) ]
true
module TestDetainerWarrant exposing (..) import DetainerWarrant exposing (DetainerWarrant, Status(..)) import Expect import Json.Decode as Decode import PleadingDocument exposing (PleadingDocument) import Test exposing (..) import Time import Url import Url.Builder minimalJson = """ { "address": "123 Some Street, Nashville, TN 37010", "amount_claimed": null, "claims_possession": null, "created_at": 1633382326000, "defendants": [], "docket_id": "21GC11668", "document": null, "file_date": null, "hearings": [], "is_cares": null, "is_legacy": null, "last_edited_by": { "active": true, "first_name": "PI:NAME:<NAME>END_PI", "id": -1, "last_name": "PI:NAME:<NAME>END_PI", "name": "PI:NAME:<NAME>END_PI", "preferred_navigation": "REMAIN", "roles": [ { "description": "A user with complete access to all resources.", "id": 1, "name": "Superuser" } ] }, "nonpayment": null, "notes": null, "order_number": 21011668, "plaintiff": null, "plaintiff_attorney": null, "status": null, "updated_at": 1634569282000, "zip_code": null } """ minimalDetainer : DetainerWarrant minimalDetainer = { docketId = "21GC11668" , address = Just "123 Some Street, Nashville, TN 37010" , amountClaimed = Nothing , claimsPossession = Nothing , hearings = [] , defendants = [] , fileDate = Nothing , isCares = Nothing , isLegacy = Nothing , nonpayment = Nothing , plaintiff = Nothing , plaintiffAttorney = Nothing , status = Nothing , notes = Nothing , document = Nothing } maximumJson = """ { "address": "123 Some Street, Nashville, TN 37010", "amount_claimed": 123.45, "claims_possession": true, "created_at": 1633382326000, "defendants": [], "docket_id": "21GT11668", "document": { "created_at": 1637071221000, "docket_id": "21GT1234", "kind": "DETAINER_WARRANT", "text": "COPY EFILED 07/20/21 07:28 AM CASE NO. 21GT1234 ...", "updated_at": 1642214383000, "url": "https://caselinkimages.nashville.gov/PublicSessions/21/21GT1234/2197025.pdf" }, "file_date": 1635901200000, "hearings": [], "is_cares": true, "is_legacy": false, "last_edited_by": { "active": true, "first_name": "PI:NAME:<NAME>END_PI", "id": -1, "last_name": "PI:NAME:<NAME>END_PI", "name": "PI:NAME:<NAME>END_PI", "preferred_navigation": "REMAIN", "roles": [ { "description": "A user with complete access to all resources.", "id": 1, "name": "Superuser" } ] }, "nonpayment": true, "notes": "some notes", "order_number": 21011668, "plaintiff": null, "plaintiff_attorney": null, "status": "PENDING", "updated_at": 1634569282000, "zip_code": null } """ maximumDetainer : DetainerWarrant maximumDetainer = { docketId = "21GT11668" , address = Just "123 Some Street, Nashville, TN 37010" , amountClaimed = Just 123.45 , claimsPossession = Just True , fileDate = Just (Time.millisToPosix 1635901200000) , hearings = [] , isCares = Just True , isLegacy = Just False , nonpayment = Just True , status = Just Pending , notes = Just "some notes" , plaintiff = Nothing , plaintiffAttorney = Nothing , defendants = [] , document = Just { createdAt = Time.millisToPosix 1637071221000 , kind = Just PleadingDocument.DetainerWarrantDocument , text = Just "COPY EFILED 07/20/21 07:28 AM CASE NO. 21GT1234 ..." , updatedAt = Time.millisToPosix 1642214383000 , url = { protocol = Url.Https , host = "caselinkimages.nashville.gov" , port_ = Nothing , path = "/PublicSessions/21/21GT1234/2197025.pdf" , query = Nothing , fragment = Nothing } } } all : Test all = describe "Creation" [ test "decodes with nulls" <| \() -> Expect.equal (Result.Ok minimalDetainer) (Decode.decodeString DetainerWarrant.decoder minimalJson) , test "decodes with all values" <| \() -> Expect.equal (Result.Ok maximumDetainer) (Decode.decodeString DetainerWarrant.decoder maximumJson) ]
elm
[ { "context": " maps the key to a list of matching elements.\n\n mary = {id=1, name=\"Mary\"}\n jack = {id=2, name=\"Jac", "end": 19869, "score": 0.8913345933, "start": 19865, "tag": "NAME", "value": "mary" }, { "context": "st of matching elements.\n\n mary = {id=1, name=\"Mary\"}\n jack = {id=2, name=\"Jack\"}\n jill = {id=1", "end": 19889, "score": 0.999551177, "start": 19885, "tag": "NAME", "value": "Mary" }, { "context": "ng elements.\n\n mary = {id=1, name=\"Mary\"}\n jack = {id=2, name=\"Jack\"}\n jill = {id=1, name=\"Jil", "end": 19900, "score": 0.5410950184, "start": 19897, "tag": "NAME", "value": "ack" }, { "context": "ary = {id=1, name=\"Mary\"}\n jack = {id=2, name=\"Jack\"}\n jill = {id=1, name=\"Jill\"}\n\n groupBy .id", "end": 19920, "score": 0.9995519519, "start": 19916, "tag": "NAME", "value": "Jack" }, { "context": "ack = {id=2, name=\"Jack\"}\n jill = {id=1, name=\"Jill\"}\n\n groupBy .id [mary, jack, jill] == DictList", "end": 19951, "score": 0.9961876869, "start": 19947, "tag": "NAME", "value": "Jill" }, { "context": ".id [mary, jack, jill] == DictList.fromList [(1, [mary, jill]), (2, [jack])]\n-}\ngroupBy : (a -> comparab", "end": 20021, "score": 0.5686397552, "start": 20017, "tag": "NAME", "value": "mary" }, { "context": "nary from a List of\nrecords with `id` fields:\n\n mary = {id=1, name=\"Mary\"}\n jack = {id=2, name=\"Jac", "end": 20462, "score": 0.9478064775, "start": 20458, "tag": "NAME", "value": "mary" }, { "context": "ecords with `id` fields:\n\n mary = {id=1, name=\"Mary\"}\n jack = {id=2, name=\"Jack\"}\n jill = {id=1", "end": 20482, "score": 0.9995857477, "start": 20478, "tag": "NAME", "value": "Mary" }, { "context": "h `id` fields:\n\n mary = {id=1, name=\"Mary\"}\n jack = {id=2, name=\"Jack\"}\n jill = {id=1, name=\"Jil", "end": 20493, "score": 0.9606413245, "start": 20489, "tag": "NAME", "value": "jack" }, { "context": "ary = {id=1, name=\"Mary\"}\n jack = {id=2, name=\"Jack\"}\n jill = {id=1, name=\"Jill\"}\n\n fromListBy ", "end": 20513, "score": 0.9996376038, "start": 20509, "tag": "NAME", "value": "Jack" }, { "context": "ack = {id=2, name=\"Jack\"}\n jill = {id=1, name=\"Jill\"}\n\n fromListBy .id [mary, jack, jill] == DictL", "end": 20544, "score": 0.9994068146, "start": 20540, "tag": "NAME", "value": "Jill" }, { "context": " jill = {id=1, name=\"Jill\"}\n\n fromListBy .id [mary, jack, jill] == DictList.fromList [(1, jack), (2,", "end": 20572, "score": 0.7860944271, "start": 20568, "tag": "NAME", "value": "mary" }, { "context": "removeWhen (\\_ v -> v == 1) (DictList.fromList [(\"Mary\", 1), (\"Jack\", 2), (\"Jill\", 1)]) == DictList.from", "end": 20860, "score": 0.9994949698, "start": 20856, "tag": "NAME", "value": "Mary" }, { "context": "_ v -> v == 1) (DictList.fromList [(\"Mary\", 1), (\"Jack\", 2), (\"Jill\", 1)]) == DictList.fromList [(\"Jack\"", "end": 20873, "score": 0.9989717007, "start": 20869, "tag": "NAME", "value": "Jack" }, { "context": ") (DictList.fromList [(\"Mary\", 1), (\"Jack\", 2), (\"Jill\", 1)]) == DictList.fromList [(\"Jack\", 2)]\n-}\nremo", "end": 20886, "score": 0.9970063567, "start": 20882, "tag": "NAME", "value": "Jill" }, { "context": "\"Jack\", 2), (\"Jill\", 1)]) == DictList.fromList [(\"Jack\", 2)]\n-}\nremoveWhen : (comparable -> v -> Bool) -", "end": 20922, "score": 0.9984517097, "start": 20918, "tag": "NAME", "value": "Jack" } ]
elm-stuff/packages/Gizra/elm-dictlist/2.0.0/src/DictList.elm
jigargosar/elm-simple-gtd
24
module DictList exposing ( DictList -- originally from `Dict` , empty , eq , singleton , insert , update , isEmpty , get , remove , member , size , filter , partition , foldl , foldr , map , union , intersect , diff , merge , keys , values , toList , fromList -- core `List` , cons , head , tail , indexedMap , filterMap , length , reverse , all , any , append , concat , sum , product , maximum , minimum , take , drop , sort , sortBy , sortWith -- list-oriented , getAt , getKeyAt , indexOfKey , insertAfter , insertBefore , next , previous , relativePosition , insertRelativeTo , atRelativePosition -- JSON , decodeObject , decodeWithKeys , decodeKeysAndValues , decodeArray , decodeArray2 -- Conversion , toDict , toAllDictList , fromDict , fromAllDictList -- Dict.Extra , groupBy , fromListBy , removeWhen , removeMany , keepOnly , mapKeys ) {-| Have you ever wanted a `Dict`, but you need to maintain an arbitrary ordering of keys? Or, a `List`, but you want to efficiently lookup values by a key? With `DictList`, now you can! `DictList` implements the full API for `Dict` (and should be a drop-in replacement for it). However, instead of ordering things from lowest key to highest key, it allows for an arbitrary ordering. We also implement most of the API for `List`. However, the API is not identical, since we need to account for both keys and values. An alternative would be to maintain your own "association list" -- that is, a `List (k, v)` instead of a `DictList k v`. You can move back and forth between an association list and a `DictList` via `toList` and `fromList`. # DictList @docs DictList, eq # Build Functions which create or update a dictionary. @docs empty, singleton, insert, update, remove @docs take, drop @docs removeWhen, removeMany, keepOnly @docs cons, insertAfter, insertBefore, insertRelativeTo # Combine Functions which combine two dictionaries. @docs append, concat @docs union, intersect, diff, merge # Query Functions which get information about a dictionary. @docs isEmpty, size, length @docs all, any @docs sum, product, maximum, minimum # Elements Functions that pick out an element of a dictionary, or provide information about an element. @docs member, get, getAt, getKeyAt @docs indexOfKey, relativePosition, atRelativePosition @docs head, tail @docs next, previous # Transform Functions that transform a dictionary @docs map, mapKeys, foldl, foldr, filter, partition @docs indexedMap, filterMap, reverse @docs sort, sortBy, sortWith # Convert Functions that convert between a dictionary and a related type. @docs keys, values, toList, fromList, fromListBy, groupBy @docs toDict, fromDict @docs toAllDictList, fromAllDictList # JSON Functions that help to decode a dictionary. @docs decodeObject, decodeArray, decodeArray2, decodeWithKeys, decodeKeysAndValues -} import AllDictList exposing (AllDictList, RelativePosition(..)) import Dict exposing (Dict) import Json.Decode exposing (Decoder, keyValuePairs, value, decodeValue) import Json.Decode as Json18 import List.Extra import Maybe as Maybe18 import Set exposing (Set) import Tuple exposing (first, second) {-| A `Dict` that maintains an arbitrary ordering of keys (rather than sorting them, as a normal `Dict` does. Or, a `List` that permits efficient lookup of values by a key. You can look at it either way. -} type alias DictList k v = AllDictList k v k ------- -- JSON ------- {-| Turn any object into a dictionary of key-value pairs, including inherited enumerable properties. Fails if _any_ value can't be decoded with the given decoder. Unfortunately, it is not possible to preserve the apparent order of the keys in the JSON, because the keys in Javascript objects are fundamentally un-ordered. Thus, you will typically need to have at least your keys in an array in the JSON, and use `decodeWithKeys`, `decodeArray` or `decodeArray2`. -} decodeObject : Decoder a -> Decoder (DictList String a) decodeObject = AllDictList.decodeObject {-| This function produces a decoder you can use if you can decode a list of your keys, and given a key, you can produce a decoder for the corresponding value. The order within the dictionary will be the order of your list of keys. -} decodeWithKeys : List comparable -> (comparable -> Decoder value) -> Decoder (DictList comparable value) decodeWithKeys = AllDictList.decodeWithKeys identity {-| Like `decodeWithKeys`, but you supply a decoder for the keys, rather than the keys themselves. Note that the starting point for all decoders will be the same place, so you need to construct your decoders in a way that makes that work. -} decodeKeysAndValues : Decoder (List comparable) -> (comparable -> Decoder value) -> Decoder (DictList comparable value) decodeKeysAndValues = AllDictList.decodeKeysAndValues identity {-| Given a decoder for the value, and a way of turning the value into a key, decode an array of values into a dictionary. The order within the dictionary will be the order of the JSON array. -} decodeArray : (value -> comparable) -> Decoder value -> Decoder (DictList comparable value) decodeArray = AllDictList.decodeArray identity {-| Decodes a JSON array into the DictList. You supply two decoders. Given an element of your JSON array, the first decoder should decode the key, and the second decoder should decode the value. -} decodeArray2 : Decoder comparable -> Decoder value -> Decoder (DictList comparable value) decodeArray2 = AllDictList.decodeArray2 identity ---------------------- -- From `List` in core ---------------------- {-| Insert a key-value pair at the front. Moves the key to the front if it already exists. -} cons : comparable -> value -> DictList comparable value -> DictList comparable value cons = AllDictList.cons {-| Gets the first key with its value. -} head : DictList comparable value -> Maybe ( comparable, value ) head = AllDictList.head {-| Extract the rest of the dictionary, without the first key/value pair. -} tail : DictList comparable value -> Maybe (DictList comparable value) tail = AllDictList.tail {-| Like `map` but the function is also given the index of each element (starting at zero). -} indexedMap : (Int -> comparable -> a -> b) -> DictList comparable a -> DictList comparable b indexedMap = AllDictList.indexedMap {-| Apply a function that may succeed to all key-value pairs, but only keep the successes. -} filterMap : (comparable -> a -> Maybe b) -> DictList comparable a -> DictList comparable b filterMap = AllDictList.filterMap {-| The number of key-value pairs in the dictionary. -} length : DictList comparable value -> Int length = AllDictList.length {-| Reverse the order of the key-value pairs. -} reverse : DictList comparable value -> DictList comparable value reverse = AllDictList.reverse {-| Determine if all elements satisfy the predicate. -} all : (comparable -> value -> Bool) -> DictList comparable value -> Bool all = AllDictList.all {-| Determine if any elements satisfy the predicate. -} any : (comparable -> value -> Bool) -> DictList comparable value -> Bool any = AllDictList.any {-| Put two dictionaries together. If keys collide, preference is given to the value from the second dictionary. Also, the order of the keys in the second dictionary will be preserved at the end of the result. So, you could think of `append` as biased towards the second argument. The end of the result should be equal to the second argument, both in value and key-order. The front of the result will then be whatever is left from the first argument -- that is, those keys (and their values) that were not in the second argument. For a similar function that is biased towards the first argument, see `union`. -} append : DictList comparable value -> DictList comparable value -> DictList comparable value append = AllDictList.append {-| Concatenate a bunch of dictionaries into a single dictionary. Works from left to right, applying `append` as it goes. -} concat : List (DictList comparable value) -> DictList comparable value concat = AllDictList.concat identity {-| Get the sum of the values. -} sum : DictList comparable number -> number sum = AllDictList.sum {-| Get the product of the values. -} product : DictList comparable number -> number product = AllDictList.product {-| Find the maximum value. Returns `Nothing` if empty. -} maximum : DictList comparable1 comparable2 -> Maybe comparable2 maximum = AllDictList.maximum {-| Find the minimum value. Returns `Nothing` if empty. -} minimum : DictList comparable1 comparable2 -> Maybe comparable2 minimum = AllDictList.minimum {-| Take the first *n* values. -} take : Int -> DictList comparable value -> DictList comparable value take = AllDictList.take {-| Drop the first *n* values. -} drop : Int -> DictList comparable value -> DictList comparable value drop = AllDictList.drop {-| Sort values from lowest to highest -} sort : DictList comparable1 comparable2 -> DictList comparable1 comparable2 sort = AllDictList.sort {-| Sort values by a derived property. -} sortBy : (value -> comparable) -> DictList comparable2 value -> DictList comparable2 value sortBy = AllDictList.sortBy {-| Sort values with a custom comparison function. -} sortWith : (value -> value -> Order) -> DictList comparable value -> DictList comparable value sortWith = AllDictList.sortWith ---------------- -- List-oriented ---------------- {-| Given a key, what index does that key occupy (0-based) in the order maintained by the dictionary? -} indexOfKey : comparable -> DictList comparable value -> Maybe Int indexOfKey = AllDictList.indexOfKey {-| Given a key, get the key and value at the next position. -} next : comparable -> DictList comparable value -> Maybe ( comparable, value ) next = AllDictList.next {-| Given a key, get the key and value at the previous position. -} previous : comparable -> DictList comparable value -> Maybe ( comparable, value ) previous = AllDictList.previous {-| Gets the key at the specified index (0-based). -} getKeyAt : Int -> DictList comparable value -> Maybe comparable getKeyAt = AllDictList.getKeyAt {-| Gets the key and value at the specified index (0-based). -} getAt : Int -> DictList comparable value -> Maybe ( comparable, value ) getAt = AllDictList.getAt {-| Insert a key-value pair into a dictionary, replacing an existing value if the keys collide. The first parameter represents an existing key, while the second parameter is the new key. The new key and value will be inserted after the existing key (even if the new key already exists). If the existing key cannot be found, the new key/value pair will be inserted at the end. -} insertAfter : comparable -> comparable -> v -> DictList comparable v -> DictList comparable v insertAfter = AllDictList.insertAfter {-| Insert a key-value pair into a dictionary, replacing an existing value if the keys collide. The first parameter represents an existing key, while the second parameter is the new key. The new key and value will be inserted before the existing key (even if the new key already exists). If the existing key cannot be found, the new key/value pair will be inserted at the beginning. -} insertBefore : comparable -> comparable -> v -> DictList comparable v -> DictList comparable v insertBefore = AllDictList.insertBefore {-| Get the position of a key relative to the previous key (or next, if the first key). Returns `Nothing` if the key was not found. -} relativePosition : comparable -> DictList comparable v -> Maybe (RelativePosition comparable) relativePosition = AllDictList.relativePosition {-| Gets the key-value pair currently at the indicated relative position. -} atRelativePosition : RelativePosition comparable -> DictList comparable value -> Maybe ( comparable, value ) atRelativePosition = AllDictList.atRelativePosition {-| Insert a key-value pair into a dictionary, replacing an existing value if the keys collide. The first parameter represents an existing key, while the second parameter is the new key. The new key and value will be inserted relative to the existing key (even if the new key already exists). If the existing key cannot be found, the new key/value pair will be inserted at the beginning (if the new key was to be before the existing key) or the end (if the new key was to be after). -} insertRelativeTo : RelativePosition comparable -> comparable -> v -> DictList comparable v -> DictList comparable v insertRelativeTo = AllDictList.insertRelativeTo -------------- -- From `Dict` -------------- {-| Create an empty dictionary. -} empty : DictList comparable v empty = AllDictList.empty identity {-| Element equality. -} eq : DictList comparable v -> DictList comparable v -> Bool eq = AllDictList.eq {-| Get the value associated with a key. If the key is not found, return `Nothing`. -} get : comparable -> DictList comparable v -> Maybe v get = AllDictList.get {-| Determine whether a key is in the dictionary. -} member : comparable -> DictList comparable v -> Bool member = AllDictList.member {-| Determine the number of key-value pairs in the dictionary. -} size : DictList comparable v -> Int size = AllDictList.size {-| Determine whether a dictionary is empty. -} isEmpty : DictList comparable v -> Bool isEmpty = AllDictList.isEmpty {-| Insert a key-value pair into a dictionary. Replaces the value when the keys collide, leaving the keys in the same order as they had been in. If the key did not previously exist, it is added to the end of the list. -} insert : comparable -> v -> DictList comparable v -> DictList comparable v insert = AllDictList.insert {-| Remove a key-value pair from a dictionary. If the key is not found, no changes are made. -} remove : comparable -> DictList comparable v -> DictList comparable v remove = AllDictList.remove {-| Update the value for a specific key with a given function. Maintains the order of the key, or inserts it at the end if it is new. -} update : comparable -> (Maybe v -> Maybe v) -> DictList comparable v -> DictList comparable v update = AllDictList.update {-| Create a dictionary with one key-value pair. -} singleton : comparable -> v -> DictList comparable v singleton = AllDictList.singleton identity -- COMBINE {-| Combine two dictionaries. If keys collide, preference is given to the value from the first dictionary. Keys already in the first dictionary will remain in their original order. Keys newly added from the second dictionary will be added at the end. So, you might think of `union` as being biased towards the first argument, since it preserves both key-order and values from the first argument, only adding things on the right (from the second argument) for keys that were not present in the first. This seems to correspond best to the logic of `Dict.union`. For a similar function that is biased towards the second argument, see `append`. -} union : DictList comparable v -> DictList comparable v -> DictList comparable v union = AllDictList.union {-| Keep a key-value pair when its key appears in the second dictionary. Preference is given to values in the first dictionary. The resulting order of keys will be as it was in the first dictionary. -} intersect : DictList comparable v -> DictList comparable v -> DictList comparable v intersect = AllDictList.intersect {-| Keep a key-value pair when its key does not appear in the second dictionary. -} diff : DictList comparable v -> DictList comparable v -> DictList comparable v diff = AllDictList.diff {-| The most general way of combining two dictionaries. You provide three accumulators for when a given key appears: 1. Only in the left dictionary. 2. In both dictionaries. 3. Only in the right dictionary. You then traverse all the keys and values, building up whatever you want. The keys and values from the first dictionary will be provided first, in the order maintained by the first dictionary. Then, any keys which are only in the second dictionary will be provided, in the order maintained by the second dictionary. -} merge : (comparable -> a -> result -> result) -> (comparable -> a -> b -> result -> result) -> (comparable -> b -> result -> result) -> DictList comparable a -> DictList comparable b -> result -> result merge = AllDictList.merge -- TRANSFORM {-| Apply a function to all values in a dictionary. -} map : (comparable -> a -> b) -> DictList comparable a -> DictList comparable b map = AllDictList.map {-| Fold over the key-value pairs in a dictionary, in order from the first key to the last key (given the arbitrary order maintained by the dictionary). -} foldl : (comparable -> v -> b -> b) -> b -> DictList comparable v -> b foldl = AllDictList.foldl {-| Fold over the key-value pairs in a dictionary, in order from the last key to the first key (given the arbitrary order maintained by the dictionary. -} foldr : (comparable -> v -> b -> b) -> b -> DictList comparable v -> b foldr = AllDictList.foldr {-| Keep a key-value pair when it satisfies a predicate. -} filter : (comparable -> v -> Bool) -> DictList comparable v -> DictList comparable v filter = AllDictList.filter {-| Partition a dictionary according to a predicate. The first dictionary contains all key-value pairs which satisfy the predicate, and the second contains the rest. -} partition : (comparable -> v -> Bool) -> DictList comparable v -> ( DictList comparable v, DictList comparable v ) partition = AllDictList.partition -- LISTS {-| Get all of the keys in a dictionary, in the order maintained by the dictionary. -} keys : DictList comparable v -> List comparable keys = AllDictList.keys {-| Get all of the values in a dictionary, in the order maintained by the dictionary. -} values : DictList comparable v -> List v values = AllDictList.values {-| Convert a dictionary into an association list of key-value pairs, in the order maintained by the dictionary. -} toList : DictList comparable v -> List ( comparable, v ) toList = AllDictList.toList {-| Convert an association list into a dictionary, maintaining the order of the list. -} fromList : List ( comparable, v ) -> DictList comparable v fromList = AllDictList.fromList identity {-| Extract a `Dict` from a `DictList` -} toDict : DictList comparable v -> Dict comparable v toDict = AllDictList.toDict {-| Given a `Dict`, create a `DictList`. The keys will initially be in the order that the `Dict` provides. -} fromDict : Dict comparable v -> DictList comparable v fromDict = AllDictList.fromDict {-| Convert a `DictList` to an `AllDictList` -} toAllDictList : DictList comparable v -> AllDictList comparable v comparable toAllDictList = identity {-| Given an `AllDictList`, create a `DictList`. -} fromAllDictList : AllDictList comparable v comparable -> DictList comparable v fromAllDictList = identity ------------- -- Dict.Extra ------------- {-| Takes a key-fn and a list. Creates a dictionary which maps the key to a list of matching elements. mary = {id=1, name="Mary"} jack = {id=2, name="Jack"} jill = {id=1, name="Jill"} groupBy .id [mary, jack, jill] == DictList.fromList [(1, [mary, jill]), (2, [jack])] -} groupBy : (a -> comparable) -> List a -> DictList comparable (List a) groupBy = AllDictList.groupBy identity {-| Create a dictionary from a list of values, by passing a function that can get a key from any such value. If the function does not return unique keys, earlier values are discarded. This can, for instance, be useful when constructing a dictionary from a List of records with `id` fields: mary = {id=1, name="Mary"} jack = {id=2, name="Jack"} jill = {id=1, name="Jill"} fromListBy .id [mary, jack, jill] == DictList.fromList [(1, jack), (2, jill)] -} fromListBy : (a -> comparable) -> List a -> DictList comparable a fromListBy = AllDictList.fromListBy identity {-| Remove elements which satisfies the predicate. removeWhen (\_ v -> v == 1) (DictList.fromList [("Mary", 1), ("Jack", 2), ("Jill", 1)]) == DictList.fromList [("Jack", 2)] -} removeWhen : (comparable -> v -> Bool) -> DictList comparable v -> DictList comparable v removeWhen = AllDictList.removeWhen {-| Remove a key-value pair if its key appears in the set. -} removeMany : Set comparable -> DictList comparable v -> DictList comparable v removeMany = AllDictList.removeMany {-| Keep a key-value pair if its key appears in the set. -} keepOnly : Set comparable -> DictList comparable v -> DictList comparable v keepOnly = AllDictList.keepOnly {-| Apply a function to all keys in a dictionary. -} mapKeys : (comparable1 -> comparable2) -> DictList comparable1 v -> DictList comparable2 v mapKeys = AllDictList.mapKeys identity
60915
module DictList exposing ( DictList -- originally from `Dict` , empty , eq , singleton , insert , update , isEmpty , get , remove , member , size , filter , partition , foldl , foldr , map , union , intersect , diff , merge , keys , values , toList , fromList -- core `List` , cons , head , tail , indexedMap , filterMap , length , reverse , all , any , append , concat , sum , product , maximum , minimum , take , drop , sort , sortBy , sortWith -- list-oriented , getAt , getKeyAt , indexOfKey , insertAfter , insertBefore , next , previous , relativePosition , insertRelativeTo , atRelativePosition -- JSON , decodeObject , decodeWithKeys , decodeKeysAndValues , decodeArray , decodeArray2 -- Conversion , toDict , toAllDictList , fromDict , fromAllDictList -- Dict.Extra , groupBy , fromListBy , removeWhen , removeMany , keepOnly , mapKeys ) {-| Have you ever wanted a `Dict`, but you need to maintain an arbitrary ordering of keys? Or, a `List`, but you want to efficiently lookup values by a key? With `DictList`, now you can! `DictList` implements the full API for `Dict` (and should be a drop-in replacement for it). However, instead of ordering things from lowest key to highest key, it allows for an arbitrary ordering. We also implement most of the API for `List`. However, the API is not identical, since we need to account for both keys and values. An alternative would be to maintain your own "association list" -- that is, a `List (k, v)` instead of a `DictList k v`. You can move back and forth between an association list and a `DictList` via `toList` and `fromList`. # DictList @docs DictList, eq # Build Functions which create or update a dictionary. @docs empty, singleton, insert, update, remove @docs take, drop @docs removeWhen, removeMany, keepOnly @docs cons, insertAfter, insertBefore, insertRelativeTo # Combine Functions which combine two dictionaries. @docs append, concat @docs union, intersect, diff, merge # Query Functions which get information about a dictionary. @docs isEmpty, size, length @docs all, any @docs sum, product, maximum, minimum # Elements Functions that pick out an element of a dictionary, or provide information about an element. @docs member, get, getAt, getKeyAt @docs indexOfKey, relativePosition, atRelativePosition @docs head, tail @docs next, previous # Transform Functions that transform a dictionary @docs map, mapKeys, foldl, foldr, filter, partition @docs indexedMap, filterMap, reverse @docs sort, sortBy, sortWith # Convert Functions that convert between a dictionary and a related type. @docs keys, values, toList, fromList, fromListBy, groupBy @docs toDict, fromDict @docs toAllDictList, fromAllDictList # JSON Functions that help to decode a dictionary. @docs decodeObject, decodeArray, decodeArray2, decodeWithKeys, decodeKeysAndValues -} import AllDictList exposing (AllDictList, RelativePosition(..)) import Dict exposing (Dict) import Json.Decode exposing (Decoder, keyValuePairs, value, decodeValue) import Json.Decode as Json18 import List.Extra import Maybe as Maybe18 import Set exposing (Set) import Tuple exposing (first, second) {-| A `Dict` that maintains an arbitrary ordering of keys (rather than sorting them, as a normal `Dict` does. Or, a `List` that permits efficient lookup of values by a key. You can look at it either way. -} type alias DictList k v = AllDictList k v k ------- -- JSON ------- {-| Turn any object into a dictionary of key-value pairs, including inherited enumerable properties. Fails if _any_ value can't be decoded with the given decoder. Unfortunately, it is not possible to preserve the apparent order of the keys in the JSON, because the keys in Javascript objects are fundamentally un-ordered. Thus, you will typically need to have at least your keys in an array in the JSON, and use `decodeWithKeys`, `decodeArray` or `decodeArray2`. -} decodeObject : Decoder a -> Decoder (DictList String a) decodeObject = AllDictList.decodeObject {-| This function produces a decoder you can use if you can decode a list of your keys, and given a key, you can produce a decoder for the corresponding value. The order within the dictionary will be the order of your list of keys. -} decodeWithKeys : List comparable -> (comparable -> Decoder value) -> Decoder (DictList comparable value) decodeWithKeys = AllDictList.decodeWithKeys identity {-| Like `decodeWithKeys`, but you supply a decoder for the keys, rather than the keys themselves. Note that the starting point for all decoders will be the same place, so you need to construct your decoders in a way that makes that work. -} decodeKeysAndValues : Decoder (List comparable) -> (comparable -> Decoder value) -> Decoder (DictList comparable value) decodeKeysAndValues = AllDictList.decodeKeysAndValues identity {-| Given a decoder for the value, and a way of turning the value into a key, decode an array of values into a dictionary. The order within the dictionary will be the order of the JSON array. -} decodeArray : (value -> comparable) -> Decoder value -> Decoder (DictList comparable value) decodeArray = AllDictList.decodeArray identity {-| Decodes a JSON array into the DictList. You supply two decoders. Given an element of your JSON array, the first decoder should decode the key, and the second decoder should decode the value. -} decodeArray2 : Decoder comparable -> Decoder value -> Decoder (DictList comparable value) decodeArray2 = AllDictList.decodeArray2 identity ---------------------- -- From `List` in core ---------------------- {-| Insert a key-value pair at the front. Moves the key to the front if it already exists. -} cons : comparable -> value -> DictList comparable value -> DictList comparable value cons = AllDictList.cons {-| Gets the first key with its value. -} head : DictList comparable value -> Maybe ( comparable, value ) head = AllDictList.head {-| Extract the rest of the dictionary, without the first key/value pair. -} tail : DictList comparable value -> Maybe (DictList comparable value) tail = AllDictList.tail {-| Like `map` but the function is also given the index of each element (starting at zero). -} indexedMap : (Int -> comparable -> a -> b) -> DictList comparable a -> DictList comparable b indexedMap = AllDictList.indexedMap {-| Apply a function that may succeed to all key-value pairs, but only keep the successes. -} filterMap : (comparable -> a -> Maybe b) -> DictList comparable a -> DictList comparable b filterMap = AllDictList.filterMap {-| The number of key-value pairs in the dictionary. -} length : DictList comparable value -> Int length = AllDictList.length {-| Reverse the order of the key-value pairs. -} reverse : DictList comparable value -> DictList comparable value reverse = AllDictList.reverse {-| Determine if all elements satisfy the predicate. -} all : (comparable -> value -> Bool) -> DictList comparable value -> Bool all = AllDictList.all {-| Determine if any elements satisfy the predicate. -} any : (comparable -> value -> Bool) -> DictList comparable value -> Bool any = AllDictList.any {-| Put two dictionaries together. If keys collide, preference is given to the value from the second dictionary. Also, the order of the keys in the second dictionary will be preserved at the end of the result. So, you could think of `append` as biased towards the second argument. The end of the result should be equal to the second argument, both in value and key-order. The front of the result will then be whatever is left from the first argument -- that is, those keys (and their values) that were not in the second argument. For a similar function that is biased towards the first argument, see `union`. -} append : DictList comparable value -> DictList comparable value -> DictList comparable value append = AllDictList.append {-| Concatenate a bunch of dictionaries into a single dictionary. Works from left to right, applying `append` as it goes. -} concat : List (DictList comparable value) -> DictList comparable value concat = AllDictList.concat identity {-| Get the sum of the values. -} sum : DictList comparable number -> number sum = AllDictList.sum {-| Get the product of the values. -} product : DictList comparable number -> number product = AllDictList.product {-| Find the maximum value. Returns `Nothing` if empty. -} maximum : DictList comparable1 comparable2 -> Maybe comparable2 maximum = AllDictList.maximum {-| Find the minimum value. Returns `Nothing` if empty. -} minimum : DictList comparable1 comparable2 -> Maybe comparable2 minimum = AllDictList.minimum {-| Take the first *n* values. -} take : Int -> DictList comparable value -> DictList comparable value take = AllDictList.take {-| Drop the first *n* values. -} drop : Int -> DictList comparable value -> DictList comparable value drop = AllDictList.drop {-| Sort values from lowest to highest -} sort : DictList comparable1 comparable2 -> DictList comparable1 comparable2 sort = AllDictList.sort {-| Sort values by a derived property. -} sortBy : (value -> comparable) -> DictList comparable2 value -> DictList comparable2 value sortBy = AllDictList.sortBy {-| Sort values with a custom comparison function. -} sortWith : (value -> value -> Order) -> DictList comparable value -> DictList comparable value sortWith = AllDictList.sortWith ---------------- -- List-oriented ---------------- {-| Given a key, what index does that key occupy (0-based) in the order maintained by the dictionary? -} indexOfKey : comparable -> DictList comparable value -> Maybe Int indexOfKey = AllDictList.indexOfKey {-| Given a key, get the key and value at the next position. -} next : comparable -> DictList comparable value -> Maybe ( comparable, value ) next = AllDictList.next {-| Given a key, get the key and value at the previous position. -} previous : comparable -> DictList comparable value -> Maybe ( comparable, value ) previous = AllDictList.previous {-| Gets the key at the specified index (0-based). -} getKeyAt : Int -> DictList comparable value -> Maybe comparable getKeyAt = AllDictList.getKeyAt {-| Gets the key and value at the specified index (0-based). -} getAt : Int -> DictList comparable value -> Maybe ( comparable, value ) getAt = AllDictList.getAt {-| Insert a key-value pair into a dictionary, replacing an existing value if the keys collide. The first parameter represents an existing key, while the second parameter is the new key. The new key and value will be inserted after the existing key (even if the new key already exists). If the existing key cannot be found, the new key/value pair will be inserted at the end. -} insertAfter : comparable -> comparable -> v -> DictList comparable v -> DictList comparable v insertAfter = AllDictList.insertAfter {-| Insert a key-value pair into a dictionary, replacing an existing value if the keys collide. The first parameter represents an existing key, while the second parameter is the new key. The new key and value will be inserted before the existing key (even if the new key already exists). If the existing key cannot be found, the new key/value pair will be inserted at the beginning. -} insertBefore : comparable -> comparable -> v -> DictList comparable v -> DictList comparable v insertBefore = AllDictList.insertBefore {-| Get the position of a key relative to the previous key (or next, if the first key). Returns `Nothing` if the key was not found. -} relativePosition : comparable -> DictList comparable v -> Maybe (RelativePosition comparable) relativePosition = AllDictList.relativePosition {-| Gets the key-value pair currently at the indicated relative position. -} atRelativePosition : RelativePosition comparable -> DictList comparable value -> Maybe ( comparable, value ) atRelativePosition = AllDictList.atRelativePosition {-| Insert a key-value pair into a dictionary, replacing an existing value if the keys collide. The first parameter represents an existing key, while the second parameter is the new key. The new key and value will be inserted relative to the existing key (even if the new key already exists). If the existing key cannot be found, the new key/value pair will be inserted at the beginning (if the new key was to be before the existing key) or the end (if the new key was to be after). -} insertRelativeTo : RelativePosition comparable -> comparable -> v -> DictList comparable v -> DictList comparable v insertRelativeTo = AllDictList.insertRelativeTo -------------- -- From `Dict` -------------- {-| Create an empty dictionary. -} empty : DictList comparable v empty = AllDictList.empty identity {-| Element equality. -} eq : DictList comparable v -> DictList comparable v -> Bool eq = AllDictList.eq {-| Get the value associated with a key. If the key is not found, return `Nothing`. -} get : comparable -> DictList comparable v -> Maybe v get = AllDictList.get {-| Determine whether a key is in the dictionary. -} member : comparable -> DictList comparable v -> Bool member = AllDictList.member {-| Determine the number of key-value pairs in the dictionary. -} size : DictList comparable v -> Int size = AllDictList.size {-| Determine whether a dictionary is empty. -} isEmpty : DictList comparable v -> Bool isEmpty = AllDictList.isEmpty {-| Insert a key-value pair into a dictionary. Replaces the value when the keys collide, leaving the keys in the same order as they had been in. If the key did not previously exist, it is added to the end of the list. -} insert : comparable -> v -> DictList comparable v -> DictList comparable v insert = AllDictList.insert {-| Remove a key-value pair from a dictionary. If the key is not found, no changes are made. -} remove : comparable -> DictList comparable v -> DictList comparable v remove = AllDictList.remove {-| Update the value for a specific key with a given function. Maintains the order of the key, or inserts it at the end if it is new. -} update : comparable -> (Maybe v -> Maybe v) -> DictList comparable v -> DictList comparable v update = AllDictList.update {-| Create a dictionary with one key-value pair. -} singleton : comparable -> v -> DictList comparable v singleton = AllDictList.singleton identity -- COMBINE {-| Combine two dictionaries. If keys collide, preference is given to the value from the first dictionary. Keys already in the first dictionary will remain in their original order. Keys newly added from the second dictionary will be added at the end. So, you might think of `union` as being biased towards the first argument, since it preserves both key-order and values from the first argument, only adding things on the right (from the second argument) for keys that were not present in the first. This seems to correspond best to the logic of `Dict.union`. For a similar function that is biased towards the second argument, see `append`. -} union : DictList comparable v -> DictList comparable v -> DictList comparable v union = AllDictList.union {-| Keep a key-value pair when its key appears in the second dictionary. Preference is given to values in the first dictionary. The resulting order of keys will be as it was in the first dictionary. -} intersect : DictList comparable v -> DictList comparable v -> DictList comparable v intersect = AllDictList.intersect {-| Keep a key-value pair when its key does not appear in the second dictionary. -} diff : DictList comparable v -> DictList comparable v -> DictList comparable v diff = AllDictList.diff {-| The most general way of combining two dictionaries. You provide three accumulators for when a given key appears: 1. Only in the left dictionary. 2. In both dictionaries. 3. Only in the right dictionary. You then traverse all the keys and values, building up whatever you want. The keys and values from the first dictionary will be provided first, in the order maintained by the first dictionary. Then, any keys which are only in the second dictionary will be provided, in the order maintained by the second dictionary. -} merge : (comparable -> a -> result -> result) -> (comparable -> a -> b -> result -> result) -> (comparable -> b -> result -> result) -> DictList comparable a -> DictList comparable b -> result -> result merge = AllDictList.merge -- TRANSFORM {-| Apply a function to all values in a dictionary. -} map : (comparable -> a -> b) -> DictList comparable a -> DictList comparable b map = AllDictList.map {-| Fold over the key-value pairs in a dictionary, in order from the first key to the last key (given the arbitrary order maintained by the dictionary). -} foldl : (comparable -> v -> b -> b) -> b -> DictList comparable v -> b foldl = AllDictList.foldl {-| Fold over the key-value pairs in a dictionary, in order from the last key to the first key (given the arbitrary order maintained by the dictionary. -} foldr : (comparable -> v -> b -> b) -> b -> DictList comparable v -> b foldr = AllDictList.foldr {-| Keep a key-value pair when it satisfies a predicate. -} filter : (comparable -> v -> Bool) -> DictList comparable v -> DictList comparable v filter = AllDictList.filter {-| Partition a dictionary according to a predicate. The first dictionary contains all key-value pairs which satisfy the predicate, and the second contains the rest. -} partition : (comparable -> v -> Bool) -> DictList comparable v -> ( DictList comparable v, DictList comparable v ) partition = AllDictList.partition -- LISTS {-| Get all of the keys in a dictionary, in the order maintained by the dictionary. -} keys : DictList comparable v -> List comparable keys = AllDictList.keys {-| Get all of the values in a dictionary, in the order maintained by the dictionary. -} values : DictList comparable v -> List v values = AllDictList.values {-| Convert a dictionary into an association list of key-value pairs, in the order maintained by the dictionary. -} toList : DictList comparable v -> List ( comparable, v ) toList = AllDictList.toList {-| Convert an association list into a dictionary, maintaining the order of the list. -} fromList : List ( comparable, v ) -> DictList comparable v fromList = AllDictList.fromList identity {-| Extract a `Dict` from a `DictList` -} toDict : DictList comparable v -> Dict comparable v toDict = AllDictList.toDict {-| Given a `Dict`, create a `DictList`. The keys will initially be in the order that the `Dict` provides. -} fromDict : Dict comparable v -> DictList comparable v fromDict = AllDictList.fromDict {-| Convert a `DictList` to an `AllDictList` -} toAllDictList : DictList comparable v -> AllDictList comparable v comparable toAllDictList = identity {-| Given an `AllDictList`, create a `DictList`. -} fromAllDictList : AllDictList comparable v comparable -> DictList comparable v fromAllDictList = identity ------------- -- Dict.Extra ------------- {-| Takes a key-fn and a list. Creates a dictionary which maps the key to a list of matching elements. <NAME> = {id=1, name="<NAME>"} j<NAME> = {id=2, name="<NAME>"} jill = {id=1, name="<NAME>"} groupBy .id [mary, jack, jill] == DictList.fromList [(1, [<NAME>, jill]), (2, [jack])] -} groupBy : (a -> comparable) -> List a -> DictList comparable (List a) groupBy = AllDictList.groupBy identity {-| Create a dictionary from a list of values, by passing a function that can get a key from any such value. If the function does not return unique keys, earlier values are discarded. This can, for instance, be useful when constructing a dictionary from a List of records with `id` fields: <NAME> = {id=1, name="<NAME>"} <NAME> = {id=2, name="<NAME>"} jill = {id=1, name="<NAME>"} fromListBy .id [<NAME>, jack, jill] == DictList.fromList [(1, jack), (2, jill)] -} fromListBy : (a -> comparable) -> List a -> DictList comparable a fromListBy = AllDictList.fromListBy identity {-| Remove elements which satisfies the predicate. removeWhen (\_ v -> v == 1) (DictList.fromList [("<NAME>", 1), ("<NAME>", 2), ("<NAME>", 1)]) == DictList.fromList [("<NAME>", 2)] -} removeWhen : (comparable -> v -> Bool) -> DictList comparable v -> DictList comparable v removeWhen = AllDictList.removeWhen {-| Remove a key-value pair if its key appears in the set. -} removeMany : Set comparable -> DictList comparable v -> DictList comparable v removeMany = AllDictList.removeMany {-| Keep a key-value pair if its key appears in the set. -} keepOnly : Set comparable -> DictList comparable v -> DictList comparable v keepOnly = AllDictList.keepOnly {-| Apply a function to all keys in a dictionary. -} mapKeys : (comparable1 -> comparable2) -> DictList comparable1 v -> DictList comparable2 v mapKeys = AllDictList.mapKeys identity
true
module DictList exposing ( DictList -- originally from `Dict` , empty , eq , singleton , insert , update , isEmpty , get , remove , member , size , filter , partition , foldl , foldr , map , union , intersect , diff , merge , keys , values , toList , fromList -- core `List` , cons , head , tail , indexedMap , filterMap , length , reverse , all , any , append , concat , sum , product , maximum , minimum , take , drop , sort , sortBy , sortWith -- list-oriented , getAt , getKeyAt , indexOfKey , insertAfter , insertBefore , next , previous , relativePosition , insertRelativeTo , atRelativePosition -- JSON , decodeObject , decodeWithKeys , decodeKeysAndValues , decodeArray , decodeArray2 -- Conversion , toDict , toAllDictList , fromDict , fromAllDictList -- Dict.Extra , groupBy , fromListBy , removeWhen , removeMany , keepOnly , mapKeys ) {-| Have you ever wanted a `Dict`, but you need to maintain an arbitrary ordering of keys? Or, a `List`, but you want to efficiently lookup values by a key? With `DictList`, now you can! `DictList` implements the full API for `Dict` (and should be a drop-in replacement for it). However, instead of ordering things from lowest key to highest key, it allows for an arbitrary ordering. We also implement most of the API for `List`. However, the API is not identical, since we need to account for both keys and values. An alternative would be to maintain your own "association list" -- that is, a `List (k, v)` instead of a `DictList k v`. You can move back and forth between an association list and a `DictList` via `toList` and `fromList`. # DictList @docs DictList, eq # Build Functions which create or update a dictionary. @docs empty, singleton, insert, update, remove @docs take, drop @docs removeWhen, removeMany, keepOnly @docs cons, insertAfter, insertBefore, insertRelativeTo # Combine Functions which combine two dictionaries. @docs append, concat @docs union, intersect, diff, merge # Query Functions which get information about a dictionary. @docs isEmpty, size, length @docs all, any @docs sum, product, maximum, minimum # Elements Functions that pick out an element of a dictionary, or provide information about an element. @docs member, get, getAt, getKeyAt @docs indexOfKey, relativePosition, atRelativePosition @docs head, tail @docs next, previous # Transform Functions that transform a dictionary @docs map, mapKeys, foldl, foldr, filter, partition @docs indexedMap, filterMap, reverse @docs sort, sortBy, sortWith # Convert Functions that convert between a dictionary and a related type. @docs keys, values, toList, fromList, fromListBy, groupBy @docs toDict, fromDict @docs toAllDictList, fromAllDictList # JSON Functions that help to decode a dictionary. @docs decodeObject, decodeArray, decodeArray2, decodeWithKeys, decodeKeysAndValues -} import AllDictList exposing (AllDictList, RelativePosition(..)) import Dict exposing (Dict) import Json.Decode exposing (Decoder, keyValuePairs, value, decodeValue) import Json.Decode as Json18 import List.Extra import Maybe as Maybe18 import Set exposing (Set) import Tuple exposing (first, second) {-| A `Dict` that maintains an arbitrary ordering of keys (rather than sorting them, as a normal `Dict` does. Or, a `List` that permits efficient lookup of values by a key. You can look at it either way. -} type alias DictList k v = AllDictList k v k ------- -- JSON ------- {-| Turn any object into a dictionary of key-value pairs, including inherited enumerable properties. Fails if _any_ value can't be decoded with the given decoder. Unfortunately, it is not possible to preserve the apparent order of the keys in the JSON, because the keys in Javascript objects are fundamentally un-ordered. Thus, you will typically need to have at least your keys in an array in the JSON, and use `decodeWithKeys`, `decodeArray` or `decodeArray2`. -} decodeObject : Decoder a -> Decoder (DictList String a) decodeObject = AllDictList.decodeObject {-| This function produces a decoder you can use if you can decode a list of your keys, and given a key, you can produce a decoder for the corresponding value. The order within the dictionary will be the order of your list of keys. -} decodeWithKeys : List comparable -> (comparable -> Decoder value) -> Decoder (DictList comparable value) decodeWithKeys = AllDictList.decodeWithKeys identity {-| Like `decodeWithKeys`, but you supply a decoder for the keys, rather than the keys themselves. Note that the starting point for all decoders will be the same place, so you need to construct your decoders in a way that makes that work. -} decodeKeysAndValues : Decoder (List comparable) -> (comparable -> Decoder value) -> Decoder (DictList comparable value) decodeKeysAndValues = AllDictList.decodeKeysAndValues identity {-| Given a decoder for the value, and a way of turning the value into a key, decode an array of values into a dictionary. The order within the dictionary will be the order of the JSON array. -} decodeArray : (value -> comparable) -> Decoder value -> Decoder (DictList comparable value) decodeArray = AllDictList.decodeArray identity {-| Decodes a JSON array into the DictList. You supply two decoders. Given an element of your JSON array, the first decoder should decode the key, and the second decoder should decode the value. -} decodeArray2 : Decoder comparable -> Decoder value -> Decoder (DictList comparable value) decodeArray2 = AllDictList.decodeArray2 identity ---------------------- -- From `List` in core ---------------------- {-| Insert a key-value pair at the front. Moves the key to the front if it already exists. -} cons : comparable -> value -> DictList comparable value -> DictList comparable value cons = AllDictList.cons {-| Gets the first key with its value. -} head : DictList comparable value -> Maybe ( comparable, value ) head = AllDictList.head {-| Extract the rest of the dictionary, without the first key/value pair. -} tail : DictList comparable value -> Maybe (DictList comparable value) tail = AllDictList.tail {-| Like `map` but the function is also given the index of each element (starting at zero). -} indexedMap : (Int -> comparable -> a -> b) -> DictList comparable a -> DictList comparable b indexedMap = AllDictList.indexedMap {-| Apply a function that may succeed to all key-value pairs, but only keep the successes. -} filterMap : (comparable -> a -> Maybe b) -> DictList comparable a -> DictList comparable b filterMap = AllDictList.filterMap {-| The number of key-value pairs in the dictionary. -} length : DictList comparable value -> Int length = AllDictList.length {-| Reverse the order of the key-value pairs. -} reverse : DictList comparable value -> DictList comparable value reverse = AllDictList.reverse {-| Determine if all elements satisfy the predicate. -} all : (comparable -> value -> Bool) -> DictList comparable value -> Bool all = AllDictList.all {-| Determine if any elements satisfy the predicate. -} any : (comparable -> value -> Bool) -> DictList comparable value -> Bool any = AllDictList.any {-| Put two dictionaries together. If keys collide, preference is given to the value from the second dictionary. Also, the order of the keys in the second dictionary will be preserved at the end of the result. So, you could think of `append` as biased towards the second argument. The end of the result should be equal to the second argument, both in value and key-order. The front of the result will then be whatever is left from the first argument -- that is, those keys (and their values) that were not in the second argument. For a similar function that is biased towards the first argument, see `union`. -} append : DictList comparable value -> DictList comparable value -> DictList comparable value append = AllDictList.append {-| Concatenate a bunch of dictionaries into a single dictionary. Works from left to right, applying `append` as it goes. -} concat : List (DictList comparable value) -> DictList comparable value concat = AllDictList.concat identity {-| Get the sum of the values. -} sum : DictList comparable number -> number sum = AllDictList.sum {-| Get the product of the values. -} product : DictList comparable number -> number product = AllDictList.product {-| Find the maximum value. Returns `Nothing` if empty. -} maximum : DictList comparable1 comparable2 -> Maybe comparable2 maximum = AllDictList.maximum {-| Find the minimum value. Returns `Nothing` if empty. -} minimum : DictList comparable1 comparable2 -> Maybe comparable2 minimum = AllDictList.minimum {-| Take the first *n* values. -} take : Int -> DictList comparable value -> DictList comparable value take = AllDictList.take {-| Drop the first *n* values. -} drop : Int -> DictList comparable value -> DictList comparable value drop = AllDictList.drop {-| Sort values from lowest to highest -} sort : DictList comparable1 comparable2 -> DictList comparable1 comparable2 sort = AllDictList.sort {-| Sort values by a derived property. -} sortBy : (value -> comparable) -> DictList comparable2 value -> DictList comparable2 value sortBy = AllDictList.sortBy {-| Sort values with a custom comparison function. -} sortWith : (value -> value -> Order) -> DictList comparable value -> DictList comparable value sortWith = AllDictList.sortWith ---------------- -- List-oriented ---------------- {-| Given a key, what index does that key occupy (0-based) in the order maintained by the dictionary? -} indexOfKey : comparable -> DictList comparable value -> Maybe Int indexOfKey = AllDictList.indexOfKey {-| Given a key, get the key and value at the next position. -} next : comparable -> DictList comparable value -> Maybe ( comparable, value ) next = AllDictList.next {-| Given a key, get the key and value at the previous position. -} previous : comparable -> DictList comparable value -> Maybe ( comparable, value ) previous = AllDictList.previous {-| Gets the key at the specified index (0-based). -} getKeyAt : Int -> DictList comparable value -> Maybe comparable getKeyAt = AllDictList.getKeyAt {-| Gets the key and value at the specified index (0-based). -} getAt : Int -> DictList comparable value -> Maybe ( comparable, value ) getAt = AllDictList.getAt {-| Insert a key-value pair into a dictionary, replacing an existing value if the keys collide. The first parameter represents an existing key, while the second parameter is the new key. The new key and value will be inserted after the existing key (even if the new key already exists). If the existing key cannot be found, the new key/value pair will be inserted at the end. -} insertAfter : comparable -> comparable -> v -> DictList comparable v -> DictList comparable v insertAfter = AllDictList.insertAfter {-| Insert a key-value pair into a dictionary, replacing an existing value if the keys collide. The first parameter represents an existing key, while the second parameter is the new key. The new key and value will be inserted before the existing key (even if the new key already exists). If the existing key cannot be found, the new key/value pair will be inserted at the beginning. -} insertBefore : comparable -> comparable -> v -> DictList comparable v -> DictList comparable v insertBefore = AllDictList.insertBefore {-| Get the position of a key relative to the previous key (or next, if the first key). Returns `Nothing` if the key was not found. -} relativePosition : comparable -> DictList comparable v -> Maybe (RelativePosition comparable) relativePosition = AllDictList.relativePosition {-| Gets the key-value pair currently at the indicated relative position. -} atRelativePosition : RelativePosition comparable -> DictList comparable value -> Maybe ( comparable, value ) atRelativePosition = AllDictList.atRelativePosition {-| Insert a key-value pair into a dictionary, replacing an existing value if the keys collide. The first parameter represents an existing key, while the second parameter is the new key. The new key and value will be inserted relative to the existing key (even if the new key already exists). If the existing key cannot be found, the new key/value pair will be inserted at the beginning (if the new key was to be before the existing key) or the end (if the new key was to be after). -} insertRelativeTo : RelativePosition comparable -> comparable -> v -> DictList comparable v -> DictList comparable v insertRelativeTo = AllDictList.insertRelativeTo -------------- -- From `Dict` -------------- {-| Create an empty dictionary. -} empty : DictList comparable v empty = AllDictList.empty identity {-| Element equality. -} eq : DictList comparable v -> DictList comparable v -> Bool eq = AllDictList.eq {-| Get the value associated with a key. If the key is not found, return `Nothing`. -} get : comparable -> DictList comparable v -> Maybe v get = AllDictList.get {-| Determine whether a key is in the dictionary. -} member : comparable -> DictList comparable v -> Bool member = AllDictList.member {-| Determine the number of key-value pairs in the dictionary. -} size : DictList comparable v -> Int size = AllDictList.size {-| Determine whether a dictionary is empty. -} isEmpty : DictList comparable v -> Bool isEmpty = AllDictList.isEmpty {-| Insert a key-value pair into a dictionary. Replaces the value when the keys collide, leaving the keys in the same order as they had been in. If the key did not previously exist, it is added to the end of the list. -} insert : comparable -> v -> DictList comparable v -> DictList comparable v insert = AllDictList.insert {-| Remove a key-value pair from a dictionary. If the key is not found, no changes are made. -} remove : comparable -> DictList comparable v -> DictList comparable v remove = AllDictList.remove {-| Update the value for a specific key with a given function. Maintains the order of the key, or inserts it at the end if it is new. -} update : comparable -> (Maybe v -> Maybe v) -> DictList comparable v -> DictList comparable v update = AllDictList.update {-| Create a dictionary with one key-value pair. -} singleton : comparable -> v -> DictList comparable v singleton = AllDictList.singleton identity -- COMBINE {-| Combine two dictionaries. If keys collide, preference is given to the value from the first dictionary. Keys already in the first dictionary will remain in their original order. Keys newly added from the second dictionary will be added at the end. So, you might think of `union` as being biased towards the first argument, since it preserves both key-order and values from the first argument, only adding things on the right (from the second argument) for keys that were not present in the first. This seems to correspond best to the logic of `Dict.union`. For a similar function that is biased towards the second argument, see `append`. -} union : DictList comparable v -> DictList comparable v -> DictList comparable v union = AllDictList.union {-| Keep a key-value pair when its key appears in the second dictionary. Preference is given to values in the first dictionary. The resulting order of keys will be as it was in the first dictionary. -} intersect : DictList comparable v -> DictList comparable v -> DictList comparable v intersect = AllDictList.intersect {-| Keep a key-value pair when its key does not appear in the second dictionary. -} diff : DictList comparable v -> DictList comparable v -> DictList comparable v diff = AllDictList.diff {-| The most general way of combining two dictionaries. You provide three accumulators for when a given key appears: 1. Only in the left dictionary. 2. In both dictionaries. 3. Only in the right dictionary. You then traverse all the keys and values, building up whatever you want. The keys and values from the first dictionary will be provided first, in the order maintained by the first dictionary. Then, any keys which are only in the second dictionary will be provided, in the order maintained by the second dictionary. -} merge : (comparable -> a -> result -> result) -> (comparable -> a -> b -> result -> result) -> (comparable -> b -> result -> result) -> DictList comparable a -> DictList comparable b -> result -> result merge = AllDictList.merge -- TRANSFORM {-| Apply a function to all values in a dictionary. -} map : (comparable -> a -> b) -> DictList comparable a -> DictList comparable b map = AllDictList.map {-| Fold over the key-value pairs in a dictionary, in order from the first key to the last key (given the arbitrary order maintained by the dictionary). -} foldl : (comparable -> v -> b -> b) -> b -> DictList comparable v -> b foldl = AllDictList.foldl {-| Fold over the key-value pairs in a dictionary, in order from the last key to the first key (given the arbitrary order maintained by the dictionary. -} foldr : (comparable -> v -> b -> b) -> b -> DictList comparable v -> b foldr = AllDictList.foldr {-| Keep a key-value pair when it satisfies a predicate. -} filter : (comparable -> v -> Bool) -> DictList comparable v -> DictList comparable v filter = AllDictList.filter {-| Partition a dictionary according to a predicate. The first dictionary contains all key-value pairs which satisfy the predicate, and the second contains the rest. -} partition : (comparable -> v -> Bool) -> DictList comparable v -> ( DictList comparable v, DictList comparable v ) partition = AllDictList.partition -- LISTS {-| Get all of the keys in a dictionary, in the order maintained by the dictionary. -} keys : DictList comparable v -> List comparable keys = AllDictList.keys {-| Get all of the values in a dictionary, in the order maintained by the dictionary. -} values : DictList comparable v -> List v values = AllDictList.values {-| Convert a dictionary into an association list of key-value pairs, in the order maintained by the dictionary. -} toList : DictList comparable v -> List ( comparable, v ) toList = AllDictList.toList {-| Convert an association list into a dictionary, maintaining the order of the list. -} fromList : List ( comparable, v ) -> DictList comparable v fromList = AllDictList.fromList identity {-| Extract a `Dict` from a `DictList` -} toDict : DictList comparable v -> Dict comparable v toDict = AllDictList.toDict {-| Given a `Dict`, create a `DictList`. The keys will initially be in the order that the `Dict` provides. -} fromDict : Dict comparable v -> DictList comparable v fromDict = AllDictList.fromDict {-| Convert a `DictList` to an `AllDictList` -} toAllDictList : DictList comparable v -> AllDictList comparable v comparable toAllDictList = identity {-| Given an `AllDictList`, create a `DictList`. -} fromAllDictList : AllDictList comparable v comparable -> DictList comparable v fromAllDictList = identity ------------- -- Dict.Extra ------------- {-| Takes a key-fn and a list. Creates a dictionary which maps the key to a list of matching elements. PI:NAME:<NAME>END_PI = {id=1, name="PI:NAME:<NAME>END_PI"} jPI:NAME:<NAME>END_PI = {id=2, name="PI:NAME:<NAME>END_PI"} jill = {id=1, name="PI:NAME:<NAME>END_PI"} groupBy .id [mary, jack, jill] == DictList.fromList [(1, [PI:NAME:<NAME>END_PI, jill]), (2, [jack])] -} groupBy : (a -> comparable) -> List a -> DictList comparable (List a) groupBy = AllDictList.groupBy identity {-| Create a dictionary from a list of values, by passing a function that can get a key from any such value. If the function does not return unique keys, earlier values are discarded. This can, for instance, be useful when constructing a dictionary from a List of records with `id` fields: PI:NAME:<NAME>END_PI = {id=1, name="PI:NAME:<NAME>END_PI"} PI:NAME:<NAME>END_PI = {id=2, name="PI:NAME:<NAME>END_PI"} jill = {id=1, name="PI:NAME:<NAME>END_PI"} fromListBy .id [PI:NAME:<NAME>END_PI, jack, jill] == DictList.fromList [(1, jack), (2, jill)] -} fromListBy : (a -> comparable) -> List a -> DictList comparable a fromListBy = AllDictList.fromListBy identity {-| Remove elements which satisfies the predicate. removeWhen (\_ v -> v == 1) (DictList.fromList [("PI:NAME:<NAME>END_PI", 1), ("PI:NAME:<NAME>END_PI", 2), ("PI:NAME:<NAME>END_PI", 1)]) == DictList.fromList [("PI:NAME:<NAME>END_PI", 2)] -} removeWhen : (comparable -> v -> Bool) -> DictList comparable v -> DictList comparable v removeWhen = AllDictList.removeWhen {-| Remove a key-value pair if its key appears in the set. -} removeMany : Set comparable -> DictList comparable v -> DictList comparable v removeMany = AllDictList.removeMany {-| Keep a key-value pair if its key appears in the set. -} keepOnly : Set comparable -> DictList comparable v -> DictList comparable v keepOnly = AllDictList.keepOnly {-| Apply a function to all keys in a dictionary. -} mapKeys : (comparable1 -> comparable2) -> DictList comparable1 v -> DictList comparable2 v mapKeys = AllDictList.mapKeys identity
elm
[ { "context": "]\n ]\n\n\nfullName : User -> String\nfullName { firstName, lastName } =\n firstName ++ \" \" ++ lastName\n\n\n", "end": 3400, "score": 0.9579488039, "start": 3391, "tag": "NAME", "value": "firstName" }, { "context": "\n\n\nfullName : User -> String\nfullName { firstName, lastName } =\n firstName ++ \" \" ++ lastName\n\n\nupdate : M", "end": 3410, "score": 0.9726552963, "start": 3402, "tag": "NAME", "value": "lastName" }, { "context": "r -> String\nfullName { firstName, lastName } =\n firstName ++ \" \" ++ lastName\n\n\nupdate : Msg -> Model -> ( M", "end": 3428, "score": 0.8241793513, "start": 3419, "tag": "NAME", "value": "firstName" }, { "context": " { firstName, lastName } =\n firstName ++ \" \" ++ lastName\n\n\nupdate : Msg -> Model -> ( Model, Cmd Msg )\nupd", "end": 3447, "score": 0.8798360825, "start": 3439, "tag": "NAME", "value": "lastName" } ]
src/CurrentMandates.elm
oskstr/dfunc
0
port module CurrentMandates exposing (..) import Browser import Html exposing (..) import Html.Attributes as Attr exposing (class, classList, href, id, name, src, title, type_) import Html.Events exposing (on, onClick) import Http import Json.Decode as Decode exposing (Decoder, at, bool, int, list, string, succeed) import Json.Decode.Pipeline exposing (optional, required) port setMethoneConfig : MethoneConfig -> Cmd msg type alias Model = { status : Status , admin : Bool } type Status = Loading | Loaded (List Role) | Errored String type alias MethoneConfig = { login_text : String , login_href : String } -- TODO reduce fields? -- TODO toggle active -- TODO add fuzzyfile type alias Role = { title : String , identifier : String , email : String , active : Bool , id : Int , mandates : List Mandate , group : Group } type alias Mandate = { start : String, end : String, user : User } type alias User = { firstName : String, lastName : String, kthId : String, ugKthId : String } type alias Group = { name : String, identifier : String } type Msg = GotRoles (Result Http.Error (List Role)) view : Model -> Html Msg view model = viewContent model viewContent : Model -> Html Msg viewContent model = div [ id "content" ] [ h1 [] [ text "Aktuella mandat" ] , div [ id "table-container" ] [ table [ class "table" ] [ thead [] [ tr [] [ th [] [ text "Roll" ] --, th [] [ text "Grupp" ] , th [] [ text "E-post" ] , th [] [ text "Nuvarande innehavare" ] ] ] , case model.status of Loading -> -- TODO spinner while loading? text "" Loaded roles -> viewMandates roles model.admin Errored string -> -- TODO error handling text string ] ] ] viewMandates : List Role -> Bool -> Html Msg viewMandates roles admin = tbody [] <| List.concatMap (\role -> case role.active || admin of True -> case role.mandates of [] -> [ viewMandate role Nothing ] _ -> List.map (\{ user } -> viewMandate role (Just user)) role.mandates False -> [] ) roles viewMandate : Role -> Maybe User -> Html Msg viewMandate { title, identifier, email, group } user = tr [] [ th [] [ a [ href ("/role/" ++ identifier) ] [ text title ] ] --, th [] [ text group.name ] , th [] [ a [ href ("mailto:" ++ email) ] [ text email ] ] , th [ class "user" ] [ case user of Just u -> a [ href ("/user/" ++ u.kthId) ] [ text (fullName u) ] Nothing -> a [] [ text "Vakant" ] ] ] fullName : User -> String fullName { firstName, lastName } = firstName ++ " " ++ lastName update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of GotRoles (Ok roles) -> ( { model | status = Loaded roles }, Cmd.none ) GotRoles (Err _) -> ( model, Cmd.none ) initialModel : Model initialModel = { status = Loading, admin = True } initialMethoneConfig : MethoneConfig initialMethoneConfig = { login_text = "Logga in" , login_href = "/login" --TODO fix login } init : () -> ( Model, Cmd Msg ) init _ = ( initialModel , Cmd.batch [ Http.get { url = "https://dfunkt.datasektionen.se/api/roles/all/current" , expect = Http.expectJson GotRoles rolesDecoder } , setMethoneConfig initialMethoneConfig -- TODO don't set here but maybe set on login ] ) main : Program () Model Msg main = Browser.element { init = init , view = view , update = update , subscriptions = \_ -> Sub.none } roleDecoder : Decoder Role roleDecoder = succeed Role |> required "title" string |> required "identifier" string |> required "email" string |> required "active" bool |> required "id" int |> required "Mandates" (list decodeMandate) |> required "Group" decodeGroup decodeMandate = succeed Mandate |> required "start" string |> required "end" string |> required "User" decodeUser decodeUser = succeed User |> required "first_name" string |> required "last_name" string |> required "kthid" string |> required "ugkthid" string decodeGroup = succeed Group |> required "name" string |> required "identifier" string rolesDecoder : Decoder (List Role) rolesDecoder = list roleDecoder
24377
port module CurrentMandates exposing (..) import Browser import Html exposing (..) import Html.Attributes as Attr exposing (class, classList, href, id, name, src, title, type_) import Html.Events exposing (on, onClick) import Http import Json.Decode as Decode exposing (Decoder, at, bool, int, list, string, succeed) import Json.Decode.Pipeline exposing (optional, required) port setMethoneConfig : MethoneConfig -> Cmd msg type alias Model = { status : Status , admin : Bool } type Status = Loading | Loaded (List Role) | Errored String type alias MethoneConfig = { login_text : String , login_href : String } -- TODO reduce fields? -- TODO toggle active -- TODO add fuzzyfile type alias Role = { title : String , identifier : String , email : String , active : Bool , id : Int , mandates : List Mandate , group : Group } type alias Mandate = { start : String, end : String, user : User } type alias User = { firstName : String, lastName : String, kthId : String, ugKthId : String } type alias Group = { name : String, identifier : String } type Msg = GotRoles (Result Http.Error (List Role)) view : Model -> Html Msg view model = viewContent model viewContent : Model -> Html Msg viewContent model = div [ id "content" ] [ h1 [] [ text "Aktuella mandat" ] , div [ id "table-container" ] [ table [ class "table" ] [ thead [] [ tr [] [ th [] [ text "Roll" ] --, th [] [ text "Grupp" ] , th [] [ text "E-post" ] , th [] [ text "Nuvarande innehavare" ] ] ] , case model.status of Loading -> -- TODO spinner while loading? text "" Loaded roles -> viewMandates roles model.admin Errored string -> -- TODO error handling text string ] ] ] viewMandates : List Role -> Bool -> Html Msg viewMandates roles admin = tbody [] <| List.concatMap (\role -> case role.active || admin of True -> case role.mandates of [] -> [ viewMandate role Nothing ] _ -> List.map (\{ user } -> viewMandate role (Just user)) role.mandates False -> [] ) roles viewMandate : Role -> Maybe User -> Html Msg viewMandate { title, identifier, email, group } user = tr [] [ th [] [ a [ href ("/role/" ++ identifier) ] [ text title ] ] --, th [] [ text group.name ] , th [] [ a [ href ("mailto:" ++ email) ] [ text email ] ] , th [ class "user" ] [ case user of Just u -> a [ href ("/user/" ++ u.kthId) ] [ text (fullName u) ] Nothing -> a [] [ text "Vakant" ] ] ] fullName : User -> String fullName { <NAME>, <NAME> } = <NAME> ++ " " ++ <NAME> update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of GotRoles (Ok roles) -> ( { model | status = Loaded roles }, Cmd.none ) GotRoles (Err _) -> ( model, Cmd.none ) initialModel : Model initialModel = { status = Loading, admin = True } initialMethoneConfig : MethoneConfig initialMethoneConfig = { login_text = "Logga in" , login_href = "/login" --TODO fix login } init : () -> ( Model, Cmd Msg ) init _ = ( initialModel , Cmd.batch [ Http.get { url = "https://dfunkt.datasektionen.se/api/roles/all/current" , expect = Http.expectJson GotRoles rolesDecoder } , setMethoneConfig initialMethoneConfig -- TODO don't set here but maybe set on login ] ) main : Program () Model Msg main = Browser.element { init = init , view = view , update = update , subscriptions = \_ -> Sub.none } roleDecoder : Decoder Role roleDecoder = succeed Role |> required "title" string |> required "identifier" string |> required "email" string |> required "active" bool |> required "id" int |> required "Mandates" (list decodeMandate) |> required "Group" decodeGroup decodeMandate = succeed Mandate |> required "start" string |> required "end" string |> required "User" decodeUser decodeUser = succeed User |> required "first_name" string |> required "last_name" string |> required "kthid" string |> required "ugkthid" string decodeGroup = succeed Group |> required "name" string |> required "identifier" string rolesDecoder : Decoder (List Role) rolesDecoder = list roleDecoder
true
port module CurrentMandates exposing (..) import Browser import Html exposing (..) import Html.Attributes as Attr exposing (class, classList, href, id, name, src, title, type_) import Html.Events exposing (on, onClick) import Http import Json.Decode as Decode exposing (Decoder, at, bool, int, list, string, succeed) import Json.Decode.Pipeline exposing (optional, required) port setMethoneConfig : MethoneConfig -> Cmd msg type alias Model = { status : Status , admin : Bool } type Status = Loading | Loaded (List Role) | Errored String type alias MethoneConfig = { login_text : String , login_href : String } -- TODO reduce fields? -- TODO toggle active -- TODO add fuzzyfile type alias Role = { title : String , identifier : String , email : String , active : Bool , id : Int , mandates : List Mandate , group : Group } type alias Mandate = { start : String, end : String, user : User } type alias User = { firstName : String, lastName : String, kthId : String, ugKthId : String } type alias Group = { name : String, identifier : String } type Msg = GotRoles (Result Http.Error (List Role)) view : Model -> Html Msg view model = viewContent model viewContent : Model -> Html Msg viewContent model = div [ id "content" ] [ h1 [] [ text "Aktuella mandat" ] , div [ id "table-container" ] [ table [ class "table" ] [ thead [] [ tr [] [ th [] [ text "Roll" ] --, th [] [ text "Grupp" ] , th [] [ text "E-post" ] , th [] [ text "Nuvarande innehavare" ] ] ] , case model.status of Loading -> -- TODO spinner while loading? text "" Loaded roles -> viewMandates roles model.admin Errored string -> -- TODO error handling text string ] ] ] viewMandates : List Role -> Bool -> Html Msg viewMandates roles admin = tbody [] <| List.concatMap (\role -> case role.active || admin of True -> case role.mandates of [] -> [ viewMandate role Nothing ] _ -> List.map (\{ user } -> viewMandate role (Just user)) role.mandates False -> [] ) roles viewMandate : Role -> Maybe User -> Html Msg viewMandate { title, identifier, email, group } user = tr [] [ th [] [ a [ href ("/role/" ++ identifier) ] [ text title ] ] --, th [] [ text group.name ] , th [] [ a [ href ("mailto:" ++ email) ] [ text email ] ] , th [ class "user" ] [ case user of Just u -> a [ href ("/user/" ++ u.kthId) ] [ text (fullName u) ] Nothing -> a [] [ text "Vakant" ] ] ] fullName : User -> String fullName { PI:NAME:<NAME>END_PI, PI:NAME:<NAME>END_PI } = PI:NAME:<NAME>END_PI ++ " " ++ PI:NAME:<NAME>END_PI update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of GotRoles (Ok roles) -> ( { model | status = Loaded roles }, Cmd.none ) GotRoles (Err _) -> ( model, Cmd.none ) initialModel : Model initialModel = { status = Loading, admin = True } initialMethoneConfig : MethoneConfig initialMethoneConfig = { login_text = "Logga in" , login_href = "/login" --TODO fix login } init : () -> ( Model, Cmd Msg ) init _ = ( initialModel , Cmd.batch [ Http.get { url = "https://dfunkt.datasektionen.se/api/roles/all/current" , expect = Http.expectJson GotRoles rolesDecoder } , setMethoneConfig initialMethoneConfig -- TODO don't set here but maybe set on login ] ) main : Program () Model Msg main = Browser.element { init = init , view = view , update = update , subscriptions = \_ -> Sub.none } roleDecoder : Decoder Role roleDecoder = succeed Role |> required "title" string |> required "identifier" string |> required "email" string |> required "active" bool |> required "id" int |> required "Mandates" (list decodeMandate) |> required "Group" decodeGroup decodeMandate = succeed Mandate |> required "start" string |> required "end" string |> required "User" decodeUser decodeUser = succeed User |> required "first_name" string |> required "last_name" string |> required "kthid" string |> required "ugkthid" string decodeGroup = succeed Group |> required "name" string |> required "identifier" string rolesDecoder : Decoder (List Role) rolesDecoder = list roleDecoder
elm
[ { "context": "sword password ->\n { state | password = password } ! []\n\n Submit loginUrl ->\n st", "end": 841, "score": 0.7080363631, "start": 833, "tag": "PASSWORD", "value": "password" } ]
web/src/Auth/LoginForm.elm
jshacks/challenge-show-me-the-money
2
module Auth.LoginForm exposing (..) import Http import Json.Decode as Decode exposing ((:=)) import Json.Encode as Encode import Task import Admin.Model exposing (Role(..)) type alias State = { email : String , password : String , token : String , role : Maybe Role , id : Int } type Msg = SetEmail String | SetPassword String | Submit String | FetchFail Http.Error | FetchSucceed ( String, Maybe Role, Int ) init : State init = initCustom "" Nothing 0 initCustom : String -> Maybe Role -> Int -> State initCustom token role id = State "" "" token role id update : Msg -> State -> ( State, Cmd Msg ) update msg state = case msg of SetEmail email -> { state | email = email } ! [] SetPassword password -> { state | password = password } ! [] Submit loginUrl -> state ! [ submitLogin loginUrl state ] FetchFail err -> let foo = Debug.log "error" err in state ! [] FetchSucceed ( token, role, id ) -> { state | token = token, role = role, id = id } ! [] submitLogin : String -> State -> Cmd Msg submitLogin loginUrl state = Http.post responseDecoder loginUrl (loginPayload state) |> Task.perform FetchFail FetchSucceed responseDecoder : Decode.Decoder ( String, Maybe Role, Int ) responseDecoder = Decode.object3 (,,) ("token" := Decode.string) ("role" := Decode.string `Decode.andThen` decodeRole) ("id" := Decode.int) decodeRole : String -> Decode.Decoder (Maybe Role) decodeRole role = Decode.succeed (roleFromString role) roleFromString : String -> Maybe Role roleFromString roleAsString = case roleAsString of "Admin" -> Just Admin "Notifier" -> Just Notifier "Watcher" -> Just Watcher _ -> Nothing loginPayload : State -> Http.Body loginPayload { email, password } = let encoder = Encode.object [ ( "email", Encode.string email ) , ( "password", Encode.string password ) ] in Http.string <| Encode.encode 0 encoder
53965
module Auth.LoginForm exposing (..) import Http import Json.Decode as Decode exposing ((:=)) import Json.Encode as Encode import Task import Admin.Model exposing (Role(..)) type alias State = { email : String , password : String , token : String , role : Maybe Role , id : Int } type Msg = SetEmail String | SetPassword String | Submit String | FetchFail Http.Error | FetchSucceed ( String, Maybe Role, Int ) init : State init = initCustom "" Nothing 0 initCustom : String -> Maybe Role -> Int -> State initCustom token role id = State "" "" token role id update : Msg -> State -> ( State, Cmd Msg ) update msg state = case msg of SetEmail email -> { state | email = email } ! [] SetPassword password -> { state | password = <PASSWORD> } ! [] Submit loginUrl -> state ! [ submitLogin loginUrl state ] FetchFail err -> let foo = Debug.log "error" err in state ! [] FetchSucceed ( token, role, id ) -> { state | token = token, role = role, id = id } ! [] submitLogin : String -> State -> Cmd Msg submitLogin loginUrl state = Http.post responseDecoder loginUrl (loginPayload state) |> Task.perform FetchFail FetchSucceed responseDecoder : Decode.Decoder ( String, Maybe Role, Int ) responseDecoder = Decode.object3 (,,) ("token" := Decode.string) ("role" := Decode.string `Decode.andThen` decodeRole) ("id" := Decode.int) decodeRole : String -> Decode.Decoder (Maybe Role) decodeRole role = Decode.succeed (roleFromString role) roleFromString : String -> Maybe Role roleFromString roleAsString = case roleAsString of "Admin" -> Just Admin "Notifier" -> Just Notifier "Watcher" -> Just Watcher _ -> Nothing loginPayload : State -> Http.Body loginPayload { email, password } = let encoder = Encode.object [ ( "email", Encode.string email ) , ( "password", Encode.string password ) ] in Http.string <| Encode.encode 0 encoder
true
module Auth.LoginForm exposing (..) import Http import Json.Decode as Decode exposing ((:=)) import Json.Encode as Encode import Task import Admin.Model exposing (Role(..)) type alias State = { email : String , password : String , token : String , role : Maybe Role , id : Int } type Msg = SetEmail String | SetPassword String | Submit String | FetchFail Http.Error | FetchSucceed ( String, Maybe Role, Int ) init : State init = initCustom "" Nothing 0 initCustom : String -> Maybe Role -> Int -> State initCustom token role id = State "" "" token role id update : Msg -> State -> ( State, Cmd Msg ) update msg state = case msg of SetEmail email -> { state | email = email } ! [] SetPassword password -> { state | password = PI:PASSWORD:<PASSWORD>END_PI } ! [] Submit loginUrl -> state ! [ submitLogin loginUrl state ] FetchFail err -> let foo = Debug.log "error" err in state ! [] FetchSucceed ( token, role, id ) -> { state | token = token, role = role, id = id } ! [] submitLogin : String -> State -> Cmd Msg submitLogin loginUrl state = Http.post responseDecoder loginUrl (loginPayload state) |> Task.perform FetchFail FetchSucceed responseDecoder : Decode.Decoder ( String, Maybe Role, Int ) responseDecoder = Decode.object3 (,,) ("token" := Decode.string) ("role" := Decode.string `Decode.andThen` decodeRole) ("id" := Decode.int) decodeRole : String -> Decode.Decoder (Maybe Role) decodeRole role = Decode.succeed (roleFromString role) roleFromString : String -> Maybe Role roleFromString roleAsString = case roleAsString of "Admin" -> Just Admin "Notifier" -> Just Notifier "Watcher" -> Just Watcher _ -> Nothing loginPayload : State -> Http.Body loginPayload { email, password } = let encoder = Encode.object [ ( "email", Encode.string email ) , ( "password", Encode.string password ) ] in Http.string <| Encode.encode 0 encoder
elm
[ { "context": "lm-community/elm-time -}\n{-\n Copyright (c) 2016, Bogdan Paul Popa\n All rights reserved.\n\n Redistribution and us", "end": 1250, "score": 0.9998756051, "start": 1234, "tag": "NAME", "value": "Bogdan Paul Popa" } ]
programming-elm/awesome-date/src/AwesomeDate.elm
dycw/elm-learning
0
module AwesomeDate exposing (Date, Weekday(..), addDays, addMonths, addYears, create, daysInMonth, fromISO8601, isLeapYear, toDateString, toISO8601, weekday, weekdayToString, year) type Date = Date { year : Int, month : Int, day : Int } create : Int -> Int -> Int -> Date create year_ month_ day_ = Date { year = year_, month = month_, day = day_ } year : Date -> Int year (Date date) = date.year isLeapYear : Int -> Bool isLeapYear year_ = let isDivisibleBy n = remainderBy n year_ == 0 in isDivisibleBy 4 && not (isDivisibleBy 100) || isDivisibleBy 400 addYears : Int -> Date -> Date addYears years (Date date) = Date { date | year = date.year + years } |> preventInvalidLeapDates toDateString : Date -> String toDateString (Date date) = [ date.month, date.day, date.year ] |> List.map String.fromInt |> String.join "/" preventInvalidLeapDates : Date -> Date preventInvalidLeapDates (Date date) = if not (isLeapYear date.year) && date.month == 2 && date.day >= 29 then Date { date | day = 28 } else Date date {- AwesomeDate Helpers -} {- Adapted from https://github.com/elm-community/elm-time -} {- Copyright (c) 2016, Bogdan Paul Popa All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -} type Weekday = Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday addMonths : Int -> Date -> Date addMonths months (Date date) = Date { date | month = date.month + months } |> ensureValidDate addDays : Int -> Date -> Date addDays days (Date date) = (daysFromYearMonthDay date.year date.month date.day + days) |> dateFromDays daysInMonth : Int -> Int -> Int daysInMonth year_ month_ = case month_ of 2 -> if isLeapYear year_ then 29 else 28 4 -> 30 6 -> 30 9 -> 30 11 -> 30 _ -> 31 toISO8601 : Date -> String toISO8601 (Date date) = [ String.fromInt date.year, padZero date.month, padZero date.day ] |> String.join "-" fromISO8601 : String -> Maybe Date fromISO8601 input = let parsed = input |> String.split "-" |> List.map String.toInt in case parsed of [ Just year_, Just month_, Just day_ ] -> Just (create year_ month_ day_) _ -> Nothing weekday : Date -> Weekday weekday (Date date) = let m = if date.month == 1 then 0 else if date.month == 2 then 3 else if date.month == 3 then 2 else if date.month == 4 then 5 else if date.month == 5 then 0 else if date.month == 6 then 3 else if date.month == 7 then 5 else if date.month == 8 then 1 else if date.month == 9 then 4 else if date.month == 10 then 6 else if date.month == 11 then 2 else 4 y = if date.month < 3 then date.year - 1 else date.year d = modBy 7 (y + y // 4 - y // 100 + y // 400 + m + date.day) in if d == 0 then Sunday else if d == 1 then Monday else if d == 2 then Tuesday else if d == 3 then Wednesday else if d == 4 then Thursday else if d == 5 then Friday else Saturday ensureValidDate : Date -> Date ensureValidDate date = date |> ensureValidMonth |> preventInvalidLeapDates ensureValidMonth : Date -> Date ensureValidMonth (Date date) = if date.month < 1 || date.month > 12 then let monthOffset = date.month - 1 newMonth = modBy 12 monthOffset + 1 newYear = date.year + floor (toFloat monthOffset / 12) in Date { date | year = newYear, month = newMonth } else Date date padZero : Int -> String padZero = String.fromInt >> String.padLeft 2 '0' daysFromYearMonthDay : Int -> Int -> Int -> Int daysFromYearMonthDay year_ month_ day_ = let yds = daysFromYear year_ mds = daysFromYearMonth year_ month_ dds = day_ - 1 in yds + mds + dds daysFromYearMonth : Int -> Int -> Int daysFromYearMonth year_ month_ = let go y m acc = if m == 0 then acc else go y (m - 1) (acc + daysInMonth y m) in go year_ (month_ - 1) 0 daysFromYear : Int -> Int daysFromYear y = if y > 0 then 366 + ((y - 1) * 365) + ((y - 1) // 4) - ((y - 1) // 100) + ((y - 1) // 400) else if y < 0 then (y * 365) + (y // 4) - (y // 100) + (y // 400) else 0 yearFromDays : Int -> Int yearFromDays ds = let y = ds // 365 d = daysFromYear y in if ds <= d then y - 1 else y dateFromDays : Int -> Date dateFromDays ds = let d400 = daysFromYear 400 y400 = ds // d400 d = remainderBy d400 ds year_ = yearFromDays (d + 1) leap = if isLeapYear year_ then (+) 1 else identity doy = d - daysFromYear year_ ( month_, day_ ) = if doy < 31 then ( 1, doy + 1 ) else if doy < leap 59 then ( 2, doy - 31 + 1 ) else if doy < leap 90 then ( 3, doy - leap 59 + 1 ) else if doy < leap 120 then ( 4, doy - leap 90 + 1 ) else if doy < leap 151 then ( 5, doy - leap 120 + 1 ) else if doy < leap 181 then ( 6, doy - leap 151 + 1 ) else if doy < leap 212 then ( 7, doy - leap 181 + 1 ) else if doy < leap 243 then ( 8, doy - leap 212 + 1 ) else if doy < leap 273 then ( 9, doy - leap 243 + 1 ) else if doy < leap 304 then ( 10, doy - leap 273 + 1 ) else if doy < leap 334 then ( 11, doy - leap 304 + 1 ) else ( 12, doy - leap 334 + 1 ) in Date { year = year_ + y400 * 400 , month = month_ , day = day_ } weekdayToString : Weekday -> String weekdayToString weekday_ = case weekday_ of Sunday -> "Sunday" Monday -> "Monday" Tuesday -> "Tuesday" Wednesday -> "Wednesday" Thursday -> "Thursday" Friday -> "Friday" Saturday -> "Saturday"
55577
module AwesomeDate exposing (Date, Weekday(..), addDays, addMonths, addYears, create, daysInMonth, fromISO8601, isLeapYear, toDateString, toISO8601, weekday, weekdayToString, year) type Date = Date { year : Int, month : Int, day : Int } create : Int -> Int -> Int -> Date create year_ month_ day_ = Date { year = year_, month = month_, day = day_ } year : Date -> Int year (Date date) = date.year isLeapYear : Int -> Bool isLeapYear year_ = let isDivisibleBy n = remainderBy n year_ == 0 in isDivisibleBy 4 && not (isDivisibleBy 100) || isDivisibleBy 400 addYears : Int -> Date -> Date addYears years (Date date) = Date { date | year = date.year + years } |> preventInvalidLeapDates toDateString : Date -> String toDateString (Date date) = [ date.month, date.day, date.year ] |> List.map String.fromInt |> String.join "/" preventInvalidLeapDates : Date -> Date preventInvalidLeapDates (Date date) = if not (isLeapYear date.year) && date.month == 2 && date.day >= 29 then Date { date | day = 28 } else Date date {- AwesomeDate Helpers -} {- Adapted from https://github.com/elm-community/elm-time -} {- Copyright (c) 2016, <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -} type Weekday = Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday addMonths : Int -> Date -> Date addMonths months (Date date) = Date { date | month = date.month + months } |> ensureValidDate addDays : Int -> Date -> Date addDays days (Date date) = (daysFromYearMonthDay date.year date.month date.day + days) |> dateFromDays daysInMonth : Int -> Int -> Int daysInMonth year_ month_ = case month_ of 2 -> if isLeapYear year_ then 29 else 28 4 -> 30 6 -> 30 9 -> 30 11 -> 30 _ -> 31 toISO8601 : Date -> String toISO8601 (Date date) = [ String.fromInt date.year, padZero date.month, padZero date.day ] |> String.join "-" fromISO8601 : String -> Maybe Date fromISO8601 input = let parsed = input |> String.split "-" |> List.map String.toInt in case parsed of [ Just year_, Just month_, Just day_ ] -> Just (create year_ month_ day_) _ -> Nothing weekday : Date -> Weekday weekday (Date date) = let m = if date.month == 1 then 0 else if date.month == 2 then 3 else if date.month == 3 then 2 else if date.month == 4 then 5 else if date.month == 5 then 0 else if date.month == 6 then 3 else if date.month == 7 then 5 else if date.month == 8 then 1 else if date.month == 9 then 4 else if date.month == 10 then 6 else if date.month == 11 then 2 else 4 y = if date.month < 3 then date.year - 1 else date.year d = modBy 7 (y + y // 4 - y // 100 + y // 400 + m + date.day) in if d == 0 then Sunday else if d == 1 then Monday else if d == 2 then Tuesday else if d == 3 then Wednesday else if d == 4 then Thursday else if d == 5 then Friday else Saturday ensureValidDate : Date -> Date ensureValidDate date = date |> ensureValidMonth |> preventInvalidLeapDates ensureValidMonth : Date -> Date ensureValidMonth (Date date) = if date.month < 1 || date.month > 12 then let monthOffset = date.month - 1 newMonth = modBy 12 monthOffset + 1 newYear = date.year + floor (toFloat monthOffset / 12) in Date { date | year = newYear, month = newMonth } else Date date padZero : Int -> String padZero = String.fromInt >> String.padLeft 2 '0' daysFromYearMonthDay : Int -> Int -> Int -> Int daysFromYearMonthDay year_ month_ day_ = let yds = daysFromYear year_ mds = daysFromYearMonth year_ month_ dds = day_ - 1 in yds + mds + dds daysFromYearMonth : Int -> Int -> Int daysFromYearMonth year_ month_ = let go y m acc = if m == 0 then acc else go y (m - 1) (acc + daysInMonth y m) in go year_ (month_ - 1) 0 daysFromYear : Int -> Int daysFromYear y = if y > 0 then 366 + ((y - 1) * 365) + ((y - 1) // 4) - ((y - 1) // 100) + ((y - 1) // 400) else if y < 0 then (y * 365) + (y // 4) - (y // 100) + (y // 400) else 0 yearFromDays : Int -> Int yearFromDays ds = let y = ds // 365 d = daysFromYear y in if ds <= d then y - 1 else y dateFromDays : Int -> Date dateFromDays ds = let d400 = daysFromYear 400 y400 = ds // d400 d = remainderBy d400 ds year_ = yearFromDays (d + 1) leap = if isLeapYear year_ then (+) 1 else identity doy = d - daysFromYear year_ ( month_, day_ ) = if doy < 31 then ( 1, doy + 1 ) else if doy < leap 59 then ( 2, doy - 31 + 1 ) else if doy < leap 90 then ( 3, doy - leap 59 + 1 ) else if doy < leap 120 then ( 4, doy - leap 90 + 1 ) else if doy < leap 151 then ( 5, doy - leap 120 + 1 ) else if doy < leap 181 then ( 6, doy - leap 151 + 1 ) else if doy < leap 212 then ( 7, doy - leap 181 + 1 ) else if doy < leap 243 then ( 8, doy - leap 212 + 1 ) else if doy < leap 273 then ( 9, doy - leap 243 + 1 ) else if doy < leap 304 then ( 10, doy - leap 273 + 1 ) else if doy < leap 334 then ( 11, doy - leap 304 + 1 ) else ( 12, doy - leap 334 + 1 ) in Date { year = year_ + y400 * 400 , month = month_ , day = day_ } weekdayToString : Weekday -> String weekdayToString weekday_ = case weekday_ of Sunday -> "Sunday" Monday -> "Monday" Tuesday -> "Tuesday" Wednesday -> "Wednesday" Thursday -> "Thursday" Friday -> "Friday" Saturday -> "Saturday"
true
module AwesomeDate exposing (Date, Weekday(..), addDays, addMonths, addYears, create, daysInMonth, fromISO8601, isLeapYear, toDateString, toISO8601, weekday, weekdayToString, year) type Date = Date { year : Int, month : Int, day : Int } create : Int -> Int -> Int -> Date create year_ month_ day_ = Date { year = year_, month = month_, day = day_ } year : Date -> Int year (Date date) = date.year isLeapYear : Int -> Bool isLeapYear year_ = let isDivisibleBy n = remainderBy n year_ == 0 in isDivisibleBy 4 && not (isDivisibleBy 100) || isDivisibleBy 400 addYears : Int -> Date -> Date addYears years (Date date) = Date { date | year = date.year + years } |> preventInvalidLeapDates toDateString : Date -> String toDateString (Date date) = [ date.month, date.day, date.year ] |> List.map String.fromInt |> String.join "/" preventInvalidLeapDates : Date -> Date preventInvalidLeapDates (Date date) = if not (isLeapYear date.year) && date.month == 2 && date.day >= 29 then Date { date | day = 28 } else Date date {- AwesomeDate Helpers -} {- Adapted from https://github.com/elm-community/elm-time -} {- Copyright (c) 2016, PI:NAME:<NAME>END_PI All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -} type Weekday = Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday addMonths : Int -> Date -> Date addMonths months (Date date) = Date { date | month = date.month + months } |> ensureValidDate addDays : Int -> Date -> Date addDays days (Date date) = (daysFromYearMonthDay date.year date.month date.day + days) |> dateFromDays daysInMonth : Int -> Int -> Int daysInMonth year_ month_ = case month_ of 2 -> if isLeapYear year_ then 29 else 28 4 -> 30 6 -> 30 9 -> 30 11 -> 30 _ -> 31 toISO8601 : Date -> String toISO8601 (Date date) = [ String.fromInt date.year, padZero date.month, padZero date.day ] |> String.join "-" fromISO8601 : String -> Maybe Date fromISO8601 input = let parsed = input |> String.split "-" |> List.map String.toInt in case parsed of [ Just year_, Just month_, Just day_ ] -> Just (create year_ month_ day_) _ -> Nothing weekday : Date -> Weekday weekday (Date date) = let m = if date.month == 1 then 0 else if date.month == 2 then 3 else if date.month == 3 then 2 else if date.month == 4 then 5 else if date.month == 5 then 0 else if date.month == 6 then 3 else if date.month == 7 then 5 else if date.month == 8 then 1 else if date.month == 9 then 4 else if date.month == 10 then 6 else if date.month == 11 then 2 else 4 y = if date.month < 3 then date.year - 1 else date.year d = modBy 7 (y + y // 4 - y // 100 + y // 400 + m + date.day) in if d == 0 then Sunday else if d == 1 then Monday else if d == 2 then Tuesday else if d == 3 then Wednesday else if d == 4 then Thursday else if d == 5 then Friday else Saturday ensureValidDate : Date -> Date ensureValidDate date = date |> ensureValidMonth |> preventInvalidLeapDates ensureValidMonth : Date -> Date ensureValidMonth (Date date) = if date.month < 1 || date.month > 12 then let monthOffset = date.month - 1 newMonth = modBy 12 monthOffset + 1 newYear = date.year + floor (toFloat monthOffset / 12) in Date { date | year = newYear, month = newMonth } else Date date padZero : Int -> String padZero = String.fromInt >> String.padLeft 2 '0' daysFromYearMonthDay : Int -> Int -> Int -> Int daysFromYearMonthDay year_ month_ day_ = let yds = daysFromYear year_ mds = daysFromYearMonth year_ month_ dds = day_ - 1 in yds + mds + dds daysFromYearMonth : Int -> Int -> Int daysFromYearMonth year_ month_ = let go y m acc = if m == 0 then acc else go y (m - 1) (acc + daysInMonth y m) in go year_ (month_ - 1) 0 daysFromYear : Int -> Int daysFromYear y = if y > 0 then 366 + ((y - 1) * 365) + ((y - 1) // 4) - ((y - 1) // 100) + ((y - 1) // 400) else if y < 0 then (y * 365) + (y // 4) - (y // 100) + (y // 400) else 0 yearFromDays : Int -> Int yearFromDays ds = let y = ds // 365 d = daysFromYear y in if ds <= d then y - 1 else y dateFromDays : Int -> Date dateFromDays ds = let d400 = daysFromYear 400 y400 = ds // d400 d = remainderBy d400 ds year_ = yearFromDays (d + 1) leap = if isLeapYear year_ then (+) 1 else identity doy = d - daysFromYear year_ ( month_, day_ ) = if doy < 31 then ( 1, doy + 1 ) else if doy < leap 59 then ( 2, doy - 31 + 1 ) else if doy < leap 90 then ( 3, doy - leap 59 + 1 ) else if doy < leap 120 then ( 4, doy - leap 90 + 1 ) else if doy < leap 151 then ( 5, doy - leap 120 + 1 ) else if doy < leap 181 then ( 6, doy - leap 151 + 1 ) else if doy < leap 212 then ( 7, doy - leap 181 + 1 ) else if doy < leap 243 then ( 8, doy - leap 212 + 1 ) else if doy < leap 273 then ( 9, doy - leap 243 + 1 ) else if doy < leap 304 then ( 10, doy - leap 273 + 1 ) else if doy < leap 334 then ( 11, doy - leap 304 + 1 ) else ( 12, doy - leap 334 + 1 ) in Date { year = year_ + y400 * 400 , month = month_ , day = day_ } weekdayToString : Weekday -> String weekdayToString weekday_ = case weekday_ of Sunday -> "Sunday" Monday -> "Monday" Tuesday -> "Tuesday" Wednesday -> "Wednesday" Thursday -> "Thursday" Friday -> "Friday" Saturday -> "Saturday"
elm
[ { "context": "he URI spec](https://tools.ietf.org/html/rfc3986), Tim Berners-Lee\nsays a URL looks like this:\n\n```\n https://exampl", "end": 1552, "score": 0.9736166, "start": 1537, "tag": "NAME", "value": "Tim Berners-Lee" }, { "context": ":\n\n```\n https://example.com:8042/over/there?name=ferret#nose\n \\\\___/ \\\\______________/\\\\_________/ \\\\_", "end": 1635, "score": 0.8500112295, "start": 1629, "tag": "NAME", "value": "ferret" }, { "context": "serinfo` segment you see in email\naddresses like `tom@example.com`.\n\"\"\"\n , tipe = Record [ ( \"protocol", "end": 2313, "score": 0.999920249, "start": 2298, "tag": "EMAIL", "value": "tom@example.com" }, { "context": "== Nothing -- no protocol\n fromString \"http://tom@example.com\" == Nothing -- userinfo disallowed\n fromStrin", "end": 4179, "score": 0.9038259387, "start": 4164, "tag": "EMAIL", "value": "tom@example.com" }, { "context": "he URI spec](https://tools.ietf.org/html/rfc3986), Tim Berners-Lee\nsays a URL looks like this:\n\n```\n https://exampl", "end": 7750, "score": 0.9997166395, "start": 7735, "tag": "NAME", "value": "Tim Berners-Lee" }, { "context": ":\n\n```\n https://example.com:8042/over/there?name=ferret#nose\n \\\\___/ \\\\______________/\\\\_________/ \\\\_", "end": 7833, "score": 0.9776889086, "start": 7827, "tag": "NAME", "value": "ferret" }, { "context": "\n [ \"over\", \"there\" ]\n [ string \"name\" \"ferret\" ]\n -- \"https://example.com:8042/over/there?na", "end": 9909, "score": 0.9989400506, "start": 9903, "tag": "NAME", "value": "ferret" }, { "context": "\n -- \"https://example.com:8042/over/there?name=ferret\"\n\n**Note:** Cross-origin requests are slightly re", "end": 9968, "score": 0.9974907637, "start": 9962, "tag": "NAME", "value": "ferret" }, { "context": "\n custom Relative [ \"there\" ] [ string \"name\" \"ferret\" ] Nothing\n -- \"there?name=ferret\"\n\n custom", "end": 10993, "score": 0.9981004596, "start": 10987, "tag": "NAME", "value": "ferret" }, { "context": "ring \"name\" \"ferret\" ] Nothing\n -- \"there?name=ferret\"\n\n custom\n (CrossOrigin \"https://example.", "end": 11030, "score": 0.9962816238, "start": 11024, "tag": "NAME", "value": "ferret" }, { "context": "\n [ \"over\", \"there\" ]\n [ string \"name\" \"ferret\" ]\n (Just \"nose\")\n -- \"https://example.co", "end": 11146, "score": 0.9987689257, "start": 11140, "tag": "NAME", "value": "ferret" }, { "context": "\n -- \"https://example.com:8042/over/there?name=ferret#nose\"\n\"\"\"\n , tipe = Lambda (Type \"Ur", "end": 11225, "score": 0.9742920399, "start": 11219, "tag": "NAME", "value": "ferret" }, { "context": "he URI spec](https://tools.ietf.org/html/rfc3986), Tim Berners-Lee\nsays a URL looks like this:\n\n```\n https://exampl", "end": 13751, "score": 0.9980427623, "start": 13736, "tag": "NAME", "value": "Tim Berners-Lee" }, { "context": ":\n\n```\n https://example.com:8042/over/there?name=ferret#nose\n \\\\___/ \\\\______________/\\\\_________/ \\\\_", "end": 13834, "score": 0.9010225534, "start": 13828, "tag": "NAME", "value": "ferret" }, { "context": "\n -- /user/bob/comment/42 ==> Just { user = \"bob\", id = 42 }\n -- /user/tom/comment/35 ==> Jus", "end": 18739, "score": 0.8471514583, "start": 18736, "tag": "USERNAME", "value": "bob" }, { "context": "\n -- /user/tom/comment/35 ==> Just { user = \"tom\", id = 35 }\n -- /user/sam/ ==> No", "end": 18804, "score": 0.9556540251, "start": 18801, "tag": "USERNAME", "value": "tom" }, { "context": "g\n\n -- /user/sam/ ==> Just (User \"sam\")\n -- /user/bob/comment/42 ==> Just (Comment", "end": 19754, "score": 0.8988637328, "start": 19751, "tag": "USERNAME", "value": "sam" }, { "context": "he URI spec](https://tools.ietf.org/html/rfc3986), Tim Berners-Lee\nsays a URL looks like this:\n\n```\n https://exampl", "end": 23940, "score": 0.9998047948, "start": 23925, "tag": "NAME", "value": "Tim Berners-Lee" }, { "context": ":\n\n```\n https://example.com:8042/over/there?name=ferret#nose\n \\\\___/ \\\\______________/\\\\_________/ \\\\_", "end": 24023, "score": 0.9910182953, "start": 24017, "tag": "NAME", "value": "ferret" } ]
src/Review/Test/Dependencies/ElmUrl.elm
lue-bird/elm-review
0
module Review.Test.Dependencies.ElmUrl exposing (dependency) import Elm.Constraint import Elm.Docs import Elm.License import Elm.Module import Elm.Package import Elm.Project import Elm.Type exposing (Type(..)) import Elm.Version import Review.Project.Dependency as Dependency exposing (Dependency) dependency : Dependency dependency = Dependency.create "elm/url" elmJson dependencyModules elmJson : Elm.Project.Project elmJson = Elm.Project.Package { elm = unsafeConstraint "0.19.0 <= v < 0.20.0" , exposed = Elm.Project.ExposedList [ unsafeModuleName "Url", unsafeModuleName "Url.Builder", unsafeModuleName "Url.Parser", unsafeModuleName "Url.Parser.Query" ] , license = Elm.License.fromString "BSD-3-Clause" |> Maybe.withDefault Elm.License.bsd3 , name = unsafePackageName "elm/url" , summary = "Create and parse URLs. Use for HTTP and \"routing\" in single-page apps (SPAs)" , deps = [ ( unsafePackageName "elm/core", unsafeConstraint "1.0.0 <= v < 2.0.0" ) ] , testDeps = [] , version = Elm.Version.fromString "1.0.0" |> Maybe.withDefault Elm.Version.one } dependencyModules : List Elm.Docs.Module dependencyModules = [ { name = "Url" , comment = """ # URLs @docs Url, Protocol, toString, fromString # Percent-Encoding @docs percentEncode, percentDecode """ , aliases = [ { name = "Url" , args = [] , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), Tim Berners-Lee says a URL looks like this: ``` https://example.com:8042/over/there?name=ferret#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` When you are creating a single-page app with [`Browser.fullscreen`][fs], you use the [`Url.Parser`](Url-Parser) module to turn a `Url` into even nicer data. If you want to create your own URLs, check out the [`Url.Builder`](Url-Builder) module as well! [fs]: /packages/elm/browser/latest/Browser#fullscreen **Note:** This is a subset of all the full possibilities listed in the URI spec. Specifically, it does not accept the `userinfo` segment you see in email addresses like `tom@example.com`. """ , tipe = Record [ ( "protocol", Type "Url.Protocol" [] ), ( "host", Type "String.String" [] ), ( "port_", Type "Maybe.Maybe" [ Type "Basics.Int" [] ] ), ( "path", Type "String.String" [] ), ( "query", Type "Maybe.Maybe" [ Type "String.String" [] ] ), ( "fragment", Type "Maybe.Maybe" [ Type "String.String" [] ] ) ] Nothing } ] , unions = [ { name = "Protocol" , args = [] , comment = """ Is the URL served over a secure connection or not? """ , tags = [ ( "Http", [] ) , ( "Https", [] ) ] } ] , binops = [] , values = [ { name = "fromString" , comment = """ Attempt to break a URL up into [`Url`](#Url). This is useful in single-page apps when you want to parse certain chunks of a URL to figure out what to show on screen. fromString "https://example.com:443" -- Just -- { protocol = Https -- , host = "example.com" -- , port_ = Just 443 -- , path = "/" -- , query = Nothing -- , fragment = Nothing -- } fromString "https://example.com/hats?q=top%20hat" -- Just -- { protocol = Https -- , host = "example.com" -- , port_ = Nothing -- , path = "/hats" -- , query = Just "q=top%20hat" -- , fragment = Nothing -- } fromString "http://example.com/core/List/#map" -- Just -- { protocol = Http -- , host = "example.com" -- , port_ = Nothing -- , path = "/core/List/" -- , query = Nothing -- , fragment = Just "map" -- } The conversion to segments can fail in some cases as well: fromString "example.com:443" == Nothing -- no protocol fromString "http://tom@example.com" == Nothing -- userinfo disallowed fromString "http://#cats" == Nothing -- no host **Note:** This function does not use [`percentDecode`](#percentDecode) anything. It just splits things up. [`Url.Parser`](Url-Parser) actually _needs_ the raw `query` string to parse it properly. Otherwise it could get confused about `=` and `&` characters! """ , tipe = Lambda (Type "String.String" []) (Type "Maybe.Maybe" [ Type "Url.Url" [] ]) } , { name = "percentDecode" , comment = """ **Use [Url.Parser](Url-Parser) instead!** It will decode query parameters appropriately already! `percentDecode` is only available so that extremely custom cases are possible, if needed. Check out the `percentEncode` function to learn about percent-encoding. This function does the opposite! Here are the reverse examples: -- ASCII percentDecode "99%25" == Just "hat" percentDecode "to%20be" == Just "to be" percentDecode "hat" == Just "99%" -- UTF-8 percentDecode "%24" == Just "$" percentDecode "%C2%A2" == Just "¢" percentDecode "%E2%82%AC" == Just "€" Why is it a `Maybe` though? Well, these strings come from strangers on the internet as a bunch of bits and may have encoding problems. For example: percentDecode "%" == Nothing -- not followed by two hex digits percentDecode "%XY" == Nothing -- not followed by two HEX digits percentDecode "%C2" == Nothing -- half of the "¢" encoding "%C2%A2" This is the same behavior as JavaScript's [`decodeURIComponent`][js] function. [js]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent """ , tipe = Lambda (Type "String.String" []) (Type "Maybe.Maybe" [ Type "String.String" [] ]) } , { name = "percentEncode" , comment = """ **Use [Url.Builder](Url-Builder) instead!** Functions like `absolute`, `relative`, and `crossOrigin` already do this automatically! `percentEncode` is only available so that extremely custom cases are possible, if needed. Percent-encoding is how [the official URI spec][uri] “escapes” special characters. You can still represent a `?` even though it is reserved for queries. This function exists in case you want to do something extra custom. Here are some examples: -- standard ASCII encoding percentEncode "hat" == "hat" percentEncode "to be" == "to%20be" percentEncode "99%" == "99%25" -- non-standard, but widely accepted, UTF-8 encoding percentEncode "$" == "%24" percentEncode "¢" == "%C2%A2" percentEncode "€" == "%E2%82%AC" This is the same behavior as JavaScript's [`encodeURIComponent`][js] function, and the rules are described in more detail officially [here][s2] and with some notes about Unicode [here][wiki]. [js]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent [uri]: https://tools.ietf.org/html/rfc3986 [s2]: https://tools.ietf.org/html/rfc3986#section-2.1 [wiki]: https://en.wikipedia.org/wiki/Percent-encoding """ , tipe = Lambda (Type "String.String" []) (Type "String.String" []) } , { name = "toString" , comment = """ Turn a [`Url`](#Url) into a `String`. """ , tipe = Lambda (Type "Url.Url" []) (Type "String.String" []) } ] } , { name = "Url.Builder" , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), Tim Berners-Lee says a URL looks like this: ``` https://example.com:8042/over/there?name=ferret#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` This module helps you create these! # Builders @docs absolute, relative, crossOrigin, custom, Root # Queries @docs QueryParameter, string, int, toQuery """ , aliases = [] , unions = [ { name = "QueryParameter" , args = [] , comment = """ Represents query parameter. Builder functions like `absolute` percent-encode all the query parameters they get, so you do not need to worry about it! """ , tags = [] } , { name = "Root" , args = [] , comment = """ Specify whether a [`custom`](#custom) URL is absolute, relative, or cross-origin. """ , tags = [ ( "Absolute", [] ) , ( "Relative", [] ) , ( "CrossOrigin", [ Type "String.String" [] ] ) ] } ] , binops = [] , values = [ { name = "absolute" , comment = """ Create an absolute URL: absolute [] [] -- "/" absolute [ "packages", "elm", "core" ] [] -- "/packages/elm/core" absolute [ "blog", String.fromInt 42 ] [] -- "/blog/42" absolute [ "products" ] [ string "search" "hat", int "page" 2 ] -- "/products?search=hat&page=2" Notice that the URLs start with a slash! """ , tipe = Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" [])) } , { name = "crossOrigin" , comment = """ Create a cross-origin URL. crossOrigin "https://example.com" [ "products" ] [] -- "https://example.com/products" crossOrigin "https://example.com" [] [] -- "https://example.com/" crossOrigin "https://example.com:8042" [ "over", "there" ] [ string "name" "ferret" ] -- "https://example.com:8042/over/there?name=ferret" **Note:** Cross-origin requests are slightly restricted for security. For example, the [same-origin policy][sop] applies when sending HTTP requests, so the appropriate `Access-Control-Allow-Origin` header must be enabled on the *server* to get things working. Read more about the security rules [here][cors]. [sop]: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy [cors]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" []))) } , { name = "custom" , comment = """ Create custom URLs that may have a hash on the end: custom Absolute [ "packages", "elm", "core", "latest", "String" ] [] (Just "length") -- "/packages/elm/core/latest/String#length" custom Relative [ "there" ] [ string "name" "ferret" ] Nothing -- "there?name=ferret" custom (CrossOrigin "https://example.com:8042") [ "over", "there" ] [ string "name" "ferret" ] (Just "nose") -- "https://example.com:8042/over/there?name=ferret#nose" """ , tipe = Lambda (Type "Url.Builder.Root" []) (Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Lambda (Type "Maybe.Maybe" [ Type "String.String" [] ]) (Type "String.String" [])))) } , { name = "int" , comment = """ Create a percent-encoded query parameter. absolute ["products"] [ string "search" "hat", int "page" 2 ] -- "/products?search=hat&page=2" Writing `int key n` is the same as writing `string key (String.fromInt n)`. So this is just a convenience function, making your code a bit shorter! """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "Basics.Int" []) (Type "Url.Builder.QueryParameter" [])) } , { name = "relative" , comment = """ Create a relative URL: relative [] [] -- "" relative [ "elm", "core" ] [] -- "elm/core" relative [ "blog", String.fromInt 42 ] [] -- "blog/42" relative [ "products" ] [ string "search" "hat", int "page" 2 ] -- "products?search=hat&page=2" Notice that the URLs **do not** start with a slash! """ , tipe = Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" [])) } , { name = "string" , comment = """ Create a percent-encoded query parameter. absolute ["products"] [ string "search" "hat" ] -- "/products?search=hat" absolute ["products"] [ string "search" "coffee table" ] -- "/products?search=coffee%20table" """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "String.String" []) (Type "Url.Builder.QueryParameter" [])) } , { name = "toQuery" , comment = """ Convert a list of query parameters to a percent-encoded query. This function is used by `absolute`, `relative`, etc. toQuery [ string "search" "hat" ] -- "?search=hat" toQuery [ string "search" "coffee table" ] -- "?search=coffee%20table" toQuery [ string "search" "hat", int "page" 2 ] -- "?search=hat&page=2" toQuery [] -- "" """ , tipe = Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" []) } ] } , { name = "Url.Parser" , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), Tim Berners-Lee says a URL looks like this: ``` https://example.com:8042/over/there?name=ferret#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` This module is primarily for parsing the `path` part. # Primitives @docs Parser, string, int, s # Path @docs (</>), map, oneOf, top, custom # Query @docs (<?>), query # Fragment @docs fragment # Run Parsers @docs parse """ , aliases = [] , unions = [ { name = "Parser" , args = [ "a", "b" ] , comment = """ Turn URLs like `/blog/42/cat-herding-techniques` into nice Elm data. """ , tags = [] } ] , binops = [ { name = "</>" , comment = """ Parse a path with multiple segments. blog : Parser (Int -> a) a blog = s "blog" </> int -- /blog/35/ ==> Just 35 -- /blog/42 ==> Just 42 -- /blog/ ==> Nothing -- /42/ ==> Nothing search : Parser (String -> a) a search = s "search" </> string -- /search/wolf/ ==> Just "wolf" -- /search/frog ==> Just "frog" -- /search/ ==> Nothing -- /wolf/ ==> Nothing """ , tipe = Lambda (Type "Url.Parser.Parser" [ Var "a", Var "b" ]) (Lambda (Type "Url.Parser.Parser" [ Var "b", Var "c" ]) (Type "Url.Parser.Parser" [ Var "a", Var "c" ])) , associativity = Elm.Docs.Right , precedence = 7 } , { name = "<?>" , comment = """ The [`Url.Parser.Query`](Url-Parser-Query) module defines its own [`Parser`](Url-Parser-Query#Parser) type. This function helps you use those with normal parsers. For example, maybe you want to add a search feature to your blog website: import Url.Parser.Query as Query type Route = Overview (Maybe String) | Post Int blog : Parser (Route -> a) a blog = oneOf [ map Overview (s "blog" <?> Query.string "q") , map Post (s "blog" </> int) ] -- /blog/ ==> Just (Overview Nothing) -- /blog/?q=wolf ==> Just (Overview (Just "wolf")) -- /blog/wolf ==> Nothing -- /blog/42 ==> Just (Post 42) -- /blog/42?q=wolf ==> Just (Post 42) -- /blog/42/wolf ==> Nothing """ , tipe = Lambda (Type "Url.Parser.Parser" [ Var "a", Lambda (Var "query") (Var "b") ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "query" ]) (Type "Url.Parser.Parser" [ Var "a", Var "b" ])) , associativity = Elm.Docs.Left , precedence = 8 } ] , values = [ { name = "custom" , comment = """ Create a custom path segment parser. Here is how it is used to define the `int` parser: int : Parser (Int -> a) a int = custom "NUMBER" String.toInt You can use it to define something like “only CSS files” like this: css : Parser (String -> a) a css = custom "CSS_FILE" <| \\segment -> if String.endsWith ".css" segment then Just segment else Nothing """ , tipe = Lambda (Type "String.String" []) (Lambda (Lambda (Type "String.String" []) (Type "Maybe.Maybe" [ Var "a" ])) (Type "Url.Parser.Parser" [ Lambda (Var "a") (Var "b"), Var "b" ])) } , { name = "fragment" , comment = """ Create a parser for the URL fragment, the stuff after the `#`. This can be handy for handling links to DOM elements within a page. Pages like this one! type alias Docs = (String, Maybe String) docs : Parser (Docs -> a) a docs = map Tuple.pair (string </> fragment identity) -- /List/map ==> Nothing -- /List/#map ==> Just ("List", Just "map") -- /List#map ==> Just ("List", Just "map") -- /List# ==> Just ("List", Just "") -- /List ==> Just ("List", Nothing) -- / ==> Nothing """ , tipe = Lambda (Lambda (Type "Maybe.Maybe" [ Type "String.String" [] ]) (Var "fragment")) (Type "Url.Parser.Parser" [ Lambda (Var "fragment") (Var "a"), Var "a" ]) } , { name = "int" , comment = """ Parse a segment of the path as an `Int`. -- /alice/ ==> Nothing -- /bob ==> Nothing -- /42/ ==> Just 42 -- / ==> Nothing """ , tipe = Type "Url.Parser.Parser" [ Lambda (Type "Basics.Int" []) (Var "a"), Var "a" ] } , { name = "map" , comment = """ Transform a path parser. type alias Comment = { user : String, id : Int } userAndId : Parser (String -> Int -> a) a userAndId = s "user" </> string </> s "comment" </> int comment : Parser (Comment -> a) a comment = map Comment userAndId -- /user/bob/comment/42 ==> Just { user = "bob", id = 42 } -- /user/tom/comment/35 ==> Just { user = "tom", id = 35 } -- /user/sam/ ==> Nothing """ , tipe = Lambda (Var "a") (Lambda (Type "Url.Parser.Parser" [ Var "a", Var "b" ]) (Type "Url.Parser.Parser" [ Lambda (Var "b") (Var "c"), Var "c" ])) } , { name = "oneOf" , comment = """ Try a bunch of different path parsers. type Route = Topic String | Blog Int | User String | Comment String Int route : Parser (Route -> a) a route = oneOf [ map Topic (s "topic" </> string) , map Blog (s "blog" </> int) , map User (s "user" </> string) , map Comment (s "user" </> string </> s "comment" </> int) ] -- /topic/wolf ==> Just (Topic "wolf") -- /topic/ ==> Nothing -- /blog/42 ==> Just (Blog 42) -- /blog/wolf ==> Nothing -- /user/sam/ ==> Just (User "sam") -- /user/bob/comment/42 ==> Just (Comment "bob" 42) -- /user/tom/comment/35 ==> Just (Comment "tom" 35) -- /user/ ==> Nothing If there are multiple parsers that could succeed, the first one wins. """ , tipe = Lambda (Type "List.List" [ Type "Url.Parser.Parser" [ Var "a", Var "b" ] ]) (Type "Url.Parser.Parser" [ Var "a", Var "b" ]) } , { name = "parse" , comment = """ Actually run a parser! You provide some [`Url`](Url#Url) that represent a valid URL. From there `parse` runs your parser on the path, query parameters, and fragment. import Url import Url.Parser exposing (Parser, parse, int, map, oneOf, s, top) type Route = Home | Blog Int | NotFound route : Parser (Route -> a) a route = oneOf [ map Home top , map Blog (s "blog" </> int) ] toRoute : String -> Route toRoute string = case Url.fromString string of Nothing -> NotFound Just url -> Maybe.withDefault NotFound (parse route url) -- toRoute "/blog/42" == NotFound -- toRoute "https://example.com/" == Home -- toRoute "https://example.com/blog" == NotFound -- toRoute "https://example.com/blog/42" == Blog 42 -- toRoute "https://example.com/blog/42/" == Blog 42 -- toRoute "https://example.com/blog/42#wolf" == Blog 42 -- toRoute "https://example.com/blog/42?q=wolf" == Blog 42 -- toRoute "https://example.com/settings" == NotFound Functions like `toRoute` are useful when creating single-page apps with [`Browser.fullscreen`][fs]. I use them in `init` and `onNavigation` to handle the initial URL and any changes. [fs]: /packages/elm/browser/latest/Browser#fullscreen """ , tipe = Lambda (Type "Url.Parser.Parser" [ Lambda (Var "a") (Var "a"), Var "a" ]) (Lambda (Type "Url.Url" []) (Type "Maybe.Maybe" [ Var "a" ])) } , { name = "query" , comment = """ The [`Url.Parser.Query`](Url-Parser-Query) module defines its own [`Parser`](Url-Parser-Query#Parser) type. This function is a helper to convert those into normal parsers. import Url.Parser.Query as Query -- the following expressions are both the same! -- -- s "blog" <?> Query.string "search" -- s "blog" </> query (Query.string "search") This may be handy if you need query parameters but are not parsing any path segments. """ , tipe = Lambda (Type "Url.Parser.Query.Parser" [ Var "query" ]) (Type "Url.Parser.Parser" [ Lambda (Var "query") (Var "a"), Var "a" ]) } , { name = "s" , comment = """ Parse a segment of the path if it matches a given string. It is almost always used with [`</>`](#</>) or [`oneOf`](#oneOf). For example: blog : Parser (Int -> a) a blog = s "blog" </> int -- /blog/42 ==> Just 42 -- /tree/42 ==> Nothing The path segment must be an exact match! """ , tipe = Lambda (Type "String.String" []) (Type "Url.Parser.Parser" [ Var "a", Var "a" ]) } , { name = "string" , comment = """ Parse a segment of the path as a `String`. -- /alice/ ==> Just "alice" -- /bob ==> Just "bob" -- /42/ ==> Just "42" -- / ==> Nothing """ , tipe = Type "Url.Parser.Parser" [ Lambda (Type "String.String" []) (Var "a"), Var "a" ] } , { name = "top" , comment = """ A parser that does not consume any path segments. type Route = Overview | Post Int blog : Parser (BlogRoute -> a) a blog = s "blog" </> oneOf [ map Overview top , map Post (s "post" </> int) ] -- /blog/ ==> Just Overview -- /blog/post/42 ==> Just (Post 42) """ , tipe = Type "Url.Parser.Parser" [ Var "a", Var "a" ] } ] } , { name = "Url.Parser.Query" , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), Tim Berners-Lee says a URL looks like this: ``` https://example.com:8042/over/there?name=ferret#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` This module is for parsing the `query` part. In this library, a valid query looks like `?search=hats&page=2` where each query parameter has the format `key=value` and is separated from the next parameter by the `&` character. # Parse Query Parameters @docs Parser, string, int, enum, custom # Mapping @docs map, map2, map3, map4, map5, map6, map7, map8 """ , aliases = [ { name = "Parser" , args = [ "a" ] , comment = """ Parse a query like `?search=hat&page=2` into nice Elm data. """ , tipe = Type "Url.Parser.Internal.QueryParser" [ Var "a" ] } ] , unions = [] , binops = [] , values = [ { name = "custom" , comment = """ Create a custom query parser. The [`string`](#string), [`int`](#int), and [`enum`](#enum) parsers are defined using this function. It can help you handle anything though! Say you are unlucky enough to need to handle `?post=2&post=7` to show a couple posts on screen at once. You could say: posts : Parser (Maybe (List Int)) posts = custom "post" (List.maybeMap String.toInt) -- ?post=2 == [2] -- ?post=2&post=7 == [2, 7] -- ?post=2&post=x == [2] -- ?hats=2 == [] """ , tipe = Lambda (Type "String.String" []) (Lambda (Lambda (Type "List.List" [ Type "String.String" [] ]) (Var "a")) (Type "Url.Parser.Query.Parser" [ Var "a" ])) } , { name = "enum" , comment = """ Handle enumerated parameters. Maybe you want a true-or-false parameter: import Dict debug : Parser (Maybe Bool) debug = enum "debug" (Dict.fromList [ ("true", True), ("false", False) ]) -- ?debug=true == Just True -- ?debug=false == Just False -- ?debug=1 == Nothing -- ?debug=0 == Nothing -- ?true=true == Nothing -- ?debug=true&debug=true == Nothing You could add `0` and `1` to the dictionary if you want to handle those as well. You can also use [`map`](#map) to say `map (Result.withDefault False) debug` to get a parser of type `Parser Bool` that swallows any errors and defaults to `False`. **Note:** Parameters like `?debug` with no `=` are not supported by this library. """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "Dict.Dict" [ Type "String.String" [], Var "a" ]) (Type "Url.Parser.Query.Parser" [ Type "Maybe.Maybe" [ Var "a" ] ])) } , { name = "int" , comment = """ Handle `Int` parameters. Maybe you want to show paginated search results: page : Parser (Maybe Int) page = int "page" -- ?page=2 == Just 2 -- ?page=17 == Just 17 -- ?page=two == Nothing -- ?sort=date == Nothing -- ?page=2&page=3 == Nothing Check out [`custom`](#custom) if you need to handle multiple `page` parameters or something like that. """ , tipe = Lambda (Type "String.String" []) (Type "Url.Parser.Query.Parser" [ Type "Maybe.Maybe" [ Type "Basics.Int" [] ] ]) } , { name = "map" , comment = """ Transform a parser in some way. Maybe you want your `page` query parser to default to `1` if there is any problem? page : Parser Int page = map (Result.withDefault 1) (int "page") """ , tipe = Lambda (Lambda (Var "a") (Var "b")) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Type "Url.Parser.Query.Parser" [ Var "b" ])) } , { name = "map2" , comment = """ Combine two parsers. A query like `?search=hats&page=2` could be parsed with something like this: type alias Query = { search : Maybe String , page : Maybe Int } query : Parser Query query = map2 Query (string "search") (int "page") """ , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Var "result"))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))) } , { name = "map3" , comment = """ Combine three parsers. A query like `?search=hats&page=2&sort=ascending` could be parsed with something like this: import Dict type alias Query = { search : Maybe String , page : Maybe Int , sort : Maybe Order } type Order = Ascending | Descending query : Parser Query query = map3 Query (string "search") (int "page") (enum "sort" order) order : Dict.Dict String Order order = Dict.fromList [ ( "ascending", Ascending ) , ( "descending", Descending ) ] """ , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Var "result")))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ])))) } , { name = "map4" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Var "result"))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))))) } , { name = "map5" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Var "result")))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ])))))) } , { name = "map6" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Lambda (Var "f") (Var "result"))))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "f" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))))))) } , { name = "map7" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Lambda (Var "f") (Lambda (Var "g") (Var "result")))))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "f" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "g" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ])))))))) } , { name = "map8" , comment = """ If you need higher than eight, you can define a function like this: apply : Parser a -> Parser (a -> b) -> Parser b apply argParser funcParser = map2 (<|) funcParser argParser And then you can chain it to do as many of these as you would like: map func (string "search") |> apply (int "page") |> apply (int "per-page") """ , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Lambda (Var "f") (Lambda (Var "g") (Lambda (Var "h") (Var "result"))))))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "f" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "g" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "h" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))))))))) } , { name = "string" , comment = """ Handle `String` parameters. search : Parser (Maybe String) search = string "search" -- ?search=cats == Just "cats" -- ?search=42 == Just "42" -- ?branch=left == Nothing -- ?search=cats&search=dogs == Nothing Check out [`custom`](#custom) if you need to handle multiple `search` parameters for some reason. """ , tipe = Lambda (Type "String.String" []) (Type "Url.Parser.Query.Parser" [ Type "Maybe.Maybe" [ Type "String.String" [] ] ]) } ] } ] unsafePackageName : String -> Elm.Package.Name unsafePackageName packageName = case Elm.Package.fromString packageName of Just name -> name Nothing -> -- unsafe, but if the generation went well, it should all be good. unsafePackageName packageName -- Disables the tail-call optimization, so that the test crashes if we enter this case |> identity unsafeModuleName : String -> Elm.Module.Name unsafeModuleName moduleName = case Elm.Module.fromString moduleName of Just name -> name Nothing -> -- unsafe, but if the generation went well, it should all be good. unsafeModuleName moduleName -- Disables the tail-call optimization, so that the test crashes if we enter this case |> identity unsafeConstraint : String -> Elm.Constraint.Constraint unsafeConstraint constraint = case Elm.Constraint.fromString constraint of Just constr -> constr Nothing -> -- unsafe, but if the generation went well, it should all be good. unsafeConstraint constraint -- Disables the tail-call optimization, so that the test crashes if we enter this case |> identity
52173
module Review.Test.Dependencies.ElmUrl exposing (dependency) import Elm.Constraint import Elm.Docs import Elm.License import Elm.Module import Elm.Package import Elm.Project import Elm.Type exposing (Type(..)) import Elm.Version import Review.Project.Dependency as Dependency exposing (Dependency) dependency : Dependency dependency = Dependency.create "elm/url" elmJson dependencyModules elmJson : Elm.Project.Project elmJson = Elm.Project.Package { elm = unsafeConstraint "0.19.0 <= v < 0.20.0" , exposed = Elm.Project.ExposedList [ unsafeModuleName "Url", unsafeModuleName "Url.Builder", unsafeModuleName "Url.Parser", unsafeModuleName "Url.Parser.Query" ] , license = Elm.License.fromString "BSD-3-Clause" |> Maybe.withDefault Elm.License.bsd3 , name = unsafePackageName "elm/url" , summary = "Create and parse URLs. Use for HTTP and \"routing\" in single-page apps (SPAs)" , deps = [ ( unsafePackageName "elm/core", unsafeConstraint "1.0.0 <= v < 2.0.0" ) ] , testDeps = [] , version = Elm.Version.fromString "1.0.0" |> Maybe.withDefault Elm.Version.one } dependencyModules : List Elm.Docs.Module dependencyModules = [ { name = "Url" , comment = """ # URLs @docs Url, Protocol, toString, fromString # Percent-Encoding @docs percentEncode, percentDecode """ , aliases = [ { name = "Url" , args = [] , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), <NAME> says a URL looks like this: ``` https://example.com:8042/over/there?name=<NAME>#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` When you are creating a single-page app with [`Browser.fullscreen`][fs], you use the [`Url.Parser`](Url-Parser) module to turn a `Url` into even nicer data. If you want to create your own URLs, check out the [`Url.Builder`](Url-Builder) module as well! [fs]: /packages/elm/browser/latest/Browser#fullscreen **Note:** This is a subset of all the full possibilities listed in the URI spec. Specifically, it does not accept the `userinfo` segment you see in email addresses like `<EMAIL>`. """ , tipe = Record [ ( "protocol", Type "Url.Protocol" [] ), ( "host", Type "String.String" [] ), ( "port_", Type "Maybe.Maybe" [ Type "Basics.Int" [] ] ), ( "path", Type "String.String" [] ), ( "query", Type "Maybe.Maybe" [ Type "String.String" [] ] ), ( "fragment", Type "Maybe.Maybe" [ Type "String.String" [] ] ) ] Nothing } ] , unions = [ { name = "Protocol" , args = [] , comment = """ Is the URL served over a secure connection or not? """ , tags = [ ( "Http", [] ) , ( "Https", [] ) ] } ] , binops = [] , values = [ { name = "fromString" , comment = """ Attempt to break a URL up into [`Url`](#Url). This is useful in single-page apps when you want to parse certain chunks of a URL to figure out what to show on screen. fromString "https://example.com:443" -- Just -- { protocol = Https -- , host = "example.com" -- , port_ = Just 443 -- , path = "/" -- , query = Nothing -- , fragment = Nothing -- } fromString "https://example.com/hats?q=top%20hat" -- Just -- { protocol = Https -- , host = "example.com" -- , port_ = Nothing -- , path = "/hats" -- , query = Just "q=top%20hat" -- , fragment = Nothing -- } fromString "http://example.com/core/List/#map" -- Just -- { protocol = Http -- , host = "example.com" -- , port_ = Nothing -- , path = "/core/List/" -- , query = Nothing -- , fragment = Just "map" -- } The conversion to segments can fail in some cases as well: fromString "example.com:443" == Nothing -- no protocol fromString "http://<EMAIL>" == Nothing -- userinfo disallowed fromString "http://#cats" == Nothing -- no host **Note:** This function does not use [`percentDecode`](#percentDecode) anything. It just splits things up. [`Url.Parser`](Url-Parser) actually _needs_ the raw `query` string to parse it properly. Otherwise it could get confused about `=` and `&` characters! """ , tipe = Lambda (Type "String.String" []) (Type "Maybe.Maybe" [ Type "Url.Url" [] ]) } , { name = "percentDecode" , comment = """ **Use [Url.Parser](Url-Parser) instead!** It will decode query parameters appropriately already! `percentDecode` is only available so that extremely custom cases are possible, if needed. Check out the `percentEncode` function to learn about percent-encoding. This function does the opposite! Here are the reverse examples: -- ASCII percentDecode "99%25" == Just "hat" percentDecode "to%20be" == Just "to be" percentDecode "hat" == Just "99%" -- UTF-8 percentDecode "%24" == Just "$" percentDecode "%C2%A2" == Just "¢" percentDecode "%E2%82%AC" == Just "€" Why is it a `Maybe` though? Well, these strings come from strangers on the internet as a bunch of bits and may have encoding problems. For example: percentDecode "%" == Nothing -- not followed by two hex digits percentDecode "%XY" == Nothing -- not followed by two HEX digits percentDecode "%C2" == Nothing -- half of the "¢" encoding "%C2%A2" This is the same behavior as JavaScript's [`decodeURIComponent`][js] function. [js]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent """ , tipe = Lambda (Type "String.String" []) (Type "Maybe.Maybe" [ Type "String.String" [] ]) } , { name = "percentEncode" , comment = """ **Use [Url.Builder](Url-Builder) instead!** Functions like `absolute`, `relative`, and `crossOrigin` already do this automatically! `percentEncode` is only available so that extremely custom cases are possible, if needed. Percent-encoding is how [the official URI spec][uri] “escapes” special characters. You can still represent a `?` even though it is reserved for queries. This function exists in case you want to do something extra custom. Here are some examples: -- standard ASCII encoding percentEncode "hat" == "hat" percentEncode "to be" == "to%20be" percentEncode "99%" == "99%25" -- non-standard, but widely accepted, UTF-8 encoding percentEncode "$" == "%24" percentEncode "¢" == "%C2%A2" percentEncode "€" == "%E2%82%AC" This is the same behavior as JavaScript's [`encodeURIComponent`][js] function, and the rules are described in more detail officially [here][s2] and with some notes about Unicode [here][wiki]. [js]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent [uri]: https://tools.ietf.org/html/rfc3986 [s2]: https://tools.ietf.org/html/rfc3986#section-2.1 [wiki]: https://en.wikipedia.org/wiki/Percent-encoding """ , tipe = Lambda (Type "String.String" []) (Type "String.String" []) } , { name = "toString" , comment = """ Turn a [`Url`](#Url) into a `String`. """ , tipe = Lambda (Type "Url.Url" []) (Type "String.String" []) } ] } , { name = "Url.Builder" , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), <NAME> says a URL looks like this: ``` https://example.com:8042/over/there?name=<NAME>#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` This module helps you create these! # Builders @docs absolute, relative, crossOrigin, custom, Root # Queries @docs QueryParameter, string, int, toQuery """ , aliases = [] , unions = [ { name = "QueryParameter" , args = [] , comment = """ Represents query parameter. Builder functions like `absolute` percent-encode all the query parameters they get, so you do not need to worry about it! """ , tags = [] } , { name = "Root" , args = [] , comment = """ Specify whether a [`custom`](#custom) URL is absolute, relative, or cross-origin. """ , tags = [ ( "Absolute", [] ) , ( "Relative", [] ) , ( "CrossOrigin", [ Type "String.String" [] ] ) ] } ] , binops = [] , values = [ { name = "absolute" , comment = """ Create an absolute URL: absolute [] [] -- "/" absolute [ "packages", "elm", "core" ] [] -- "/packages/elm/core" absolute [ "blog", String.fromInt 42 ] [] -- "/blog/42" absolute [ "products" ] [ string "search" "hat", int "page" 2 ] -- "/products?search=hat&page=2" Notice that the URLs start with a slash! """ , tipe = Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" [])) } , { name = "crossOrigin" , comment = """ Create a cross-origin URL. crossOrigin "https://example.com" [ "products" ] [] -- "https://example.com/products" crossOrigin "https://example.com" [] [] -- "https://example.com/" crossOrigin "https://example.com:8042" [ "over", "there" ] [ string "name" "<NAME>" ] -- "https://example.com:8042/over/there?name=<NAME>" **Note:** Cross-origin requests are slightly restricted for security. For example, the [same-origin policy][sop] applies when sending HTTP requests, so the appropriate `Access-Control-Allow-Origin` header must be enabled on the *server* to get things working. Read more about the security rules [here][cors]. [sop]: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy [cors]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" []))) } , { name = "custom" , comment = """ Create custom URLs that may have a hash on the end: custom Absolute [ "packages", "elm", "core", "latest", "String" ] [] (Just "length") -- "/packages/elm/core/latest/String#length" custom Relative [ "there" ] [ string "name" "<NAME>" ] Nothing -- "there?name=<NAME>" custom (CrossOrigin "https://example.com:8042") [ "over", "there" ] [ string "name" "<NAME>" ] (Just "nose") -- "https://example.com:8042/over/there?name=<NAME>#nose" """ , tipe = Lambda (Type "Url.Builder.Root" []) (Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Lambda (Type "Maybe.Maybe" [ Type "String.String" [] ]) (Type "String.String" [])))) } , { name = "int" , comment = """ Create a percent-encoded query parameter. absolute ["products"] [ string "search" "hat", int "page" 2 ] -- "/products?search=hat&page=2" Writing `int key n` is the same as writing `string key (String.fromInt n)`. So this is just a convenience function, making your code a bit shorter! """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "Basics.Int" []) (Type "Url.Builder.QueryParameter" [])) } , { name = "relative" , comment = """ Create a relative URL: relative [] [] -- "" relative [ "elm", "core" ] [] -- "elm/core" relative [ "blog", String.fromInt 42 ] [] -- "blog/42" relative [ "products" ] [ string "search" "hat", int "page" 2 ] -- "products?search=hat&page=2" Notice that the URLs **do not** start with a slash! """ , tipe = Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" [])) } , { name = "string" , comment = """ Create a percent-encoded query parameter. absolute ["products"] [ string "search" "hat" ] -- "/products?search=hat" absolute ["products"] [ string "search" "coffee table" ] -- "/products?search=coffee%20table" """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "String.String" []) (Type "Url.Builder.QueryParameter" [])) } , { name = "toQuery" , comment = """ Convert a list of query parameters to a percent-encoded query. This function is used by `absolute`, `relative`, etc. toQuery [ string "search" "hat" ] -- "?search=hat" toQuery [ string "search" "coffee table" ] -- "?search=coffee%20table" toQuery [ string "search" "hat", int "page" 2 ] -- "?search=hat&page=2" toQuery [] -- "" """ , tipe = Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" []) } ] } , { name = "Url.Parser" , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), <NAME> says a URL looks like this: ``` https://example.com:8042/over/there?name=<NAME>#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` This module is primarily for parsing the `path` part. # Primitives @docs Parser, string, int, s # Path @docs (</>), map, oneOf, top, custom # Query @docs (<?>), query # Fragment @docs fragment # Run Parsers @docs parse """ , aliases = [] , unions = [ { name = "Parser" , args = [ "a", "b" ] , comment = """ Turn URLs like `/blog/42/cat-herding-techniques` into nice Elm data. """ , tags = [] } ] , binops = [ { name = "</>" , comment = """ Parse a path with multiple segments. blog : Parser (Int -> a) a blog = s "blog" </> int -- /blog/35/ ==> Just 35 -- /blog/42 ==> Just 42 -- /blog/ ==> Nothing -- /42/ ==> Nothing search : Parser (String -> a) a search = s "search" </> string -- /search/wolf/ ==> Just "wolf" -- /search/frog ==> Just "frog" -- /search/ ==> Nothing -- /wolf/ ==> Nothing """ , tipe = Lambda (Type "Url.Parser.Parser" [ Var "a", Var "b" ]) (Lambda (Type "Url.Parser.Parser" [ Var "b", Var "c" ]) (Type "Url.Parser.Parser" [ Var "a", Var "c" ])) , associativity = Elm.Docs.Right , precedence = 7 } , { name = "<?>" , comment = """ The [`Url.Parser.Query`](Url-Parser-Query) module defines its own [`Parser`](Url-Parser-Query#Parser) type. This function helps you use those with normal parsers. For example, maybe you want to add a search feature to your blog website: import Url.Parser.Query as Query type Route = Overview (Maybe String) | Post Int blog : Parser (Route -> a) a blog = oneOf [ map Overview (s "blog" <?> Query.string "q") , map Post (s "blog" </> int) ] -- /blog/ ==> Just (Overview Nothing) -- /blog/?q=wolf ==> Just (Overview (Just "wolf")) -- /blog/wolf ==> Nothing -- /blog/42 ==> Just (Post 42) -- /blog/42?q=wolf ==> Just (Post 42) -- /blog/42/wolf ==> Nothing """ , tipe = Lambda (Type "Url.Parser.Parser" [ Var "a", Lambda (Var "query") (Var "b") ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "query" ]) (Type "Url.Parser.Parser" [ Var "a", Var "b" ])) , associativity = Elm.Docs.Left , precedence = 8 } ] , values = [ { name = "custom" , comment = """ Create a custom path segment parser. Here is how it is used to define the `int` parser: int : Parser (Int -> a) a int = custom "NUMBER" String.toInt You can use it to define something like “only CSS files” like this: css : Parser (String -> a) a css = custom "CSS_FILE" <| \\segment -> if String.endsWith ".css" segment then Just segment else Nothing """ , tipe = Lambda (Type "String.String" []) (Lambda (Lambda (Type "String.String" []) (Type "Maybe.Maybe" [ Var "a" ])) (Type "Url.Parser.Parser" [ Lambda (Var "a") (Var "b"), Var "b" ])) } , { name = "fragment" , comment = """ Create a parser for the URL fragment, the stuff after the `#`. This can be handy for handling links to DOM elements within a page. Pages like this one! type alias Docs = (String, Maybe String) docs : Parser (Docs -> a) a docs = map Tuple.pair (string </> fragment identity) -- /List/map ==> Nothing -- /List/#map ==> Just ("List", Just "map") -- /List#map ==> Just ("List", Just "map") -- /List# ==> Just ("List", Just "") -- /List ==> Just ("List", Nothing) -- / ==> Nothing """ , tipe = Lambda (Lambda (Type "Maybe.Maybe" [ Type "String.String" [] ]) (Var "fragment")) (Type "Url.Parser.Parser" [ Lambda (Var "fragment") (Var "a"), Var "a" ]) } , { name = "int" , comment = """ Parse a segment of the path as an `Int`. -- /alice/ ==> Nothing -- /bob ==> Nothing -- /42/ ==> Just 42 -- / ==> Nothing """ , tipe = Type "Url.Parser.Parser" [ Lambda (Type "Basics.Int" []) (Var "a"), Var "a" ] } , { name = "map" , comment = """ Transform a path parser. type alias Comment = { user : String, id : Int } userAndId : Parser (String -> Int -> a) a userAndId = s "user" </> string </> s "comment" </> int comment : Parser (Comment -> a) a comment = map Comment userAndId -- /user/bob/comment/42 ==> Just { user = "bob", id = 42 } -- /user/tom/comment/35 ==> Just { user = "tom", id = 35 } -- /user/sam/ ==> Nothing """ , tipe = Lambda (Var "a") (Lambda (Type "Url.Parser.Parser" [ Var "a", Var "b" ]) (Type "Url.Parser.Parser" [ Lambda (Var "b") (Var "c"), Var "c" ])) } , { name = "oneOf" , comment = """ Try a bunch of different path parsers. type Route = Topic String | Blog Int | User String | Comment String Int route : Parser (Route -> a) a route = oneOf [ map Topic (s "topic" </> string) , map Blog (s "blog" </> int) , map User (s "user" </> string) , map Comment (s "user" </> string </> s "comment" </> int) ] -- /topic/wolf ==> Just (Topic "wolf") -- /topic/ ==> Nothing -- /blog/42 ==> Just (Blog 42) -- /blog/wolf ==> Nothing -- /user/sam/ ==> Just (User "sam") -- /user/bob/comment/42 ==> Just (Comment "bob" 42) -- /user/tom/comment/35 ==> Just (Comment "tom" 35) -- /user/ ==> Nothing If there are multiple parsers that could succeed, the first one wins. """ , tipe = Lambda (Type "List.List" [ Type "Url.Parser.Parser" [ Var "a", Var "b" ] ]) (Type "Url.Parser.Parser" [ Var "a", Var "b" ]) } , { name = "parse" , comment = """ Actually run a parser! You provide some [`Url`](Url#Url) that represent a valid URL. From there `parse` runs your parser on the path, query parameters, and fragment. import Url import Url.Parser exposing (Parser, parse, int, map, oneOf, s, top) type Route = Home | Blog Int | NotFound route : Parser (Route -> a) a route = oneOf [ map Home top , map Blog (s "blog" </> int) ] toRoute : String -> Route toRoute string = case Url.fromString string of Nothing -> NotFound Just url -> Maybe.withDefault NotFound (parse route url) -- toRoute "/blog/42" == NotFound -- toRoute "https://example.com/" == Home -- toRoute "https://example.com/blog" == NotFound -- toRoute "https://example.com/blog/42" == Blog 42 -- toRoute "https://example.com/blog/42/" == Blog 42 -- toRoute "https://example.com/blog/42#wolf" == Blog 42 -- toRoute "https://example.com/blog/42?q=wolf" == Blog 42 -- toRoute "https://example.com/settings" == NotFound Functions like `toRoute` are useful when creating single-page apps with [`Browser.fullscreen`][fs]. I use them in `init` and `onNavigation` to handle the initial URL and any changes. [fs]: /packages/elm/browser/latest/Browser#fullscreen """ , tipe = Lambda (Type "Url.Parser.Parser" [ Lambda (Var "a") (Var "a"), Var "a" ]) (Lambda (Type "Url.Url" []) (Type "Maybe.Maybe" [ Var "a" ])) } , { name = "query" , comment = """ The [`Url.Parser.Query`](Url-Parser-Query) module defines its own [`Parser`](Url-Parser-Query#Parser) type. This function is a helper to convert those into normal parsers. import Url.Parser.Query as Query -- the following expressions are both the same! -- -- s "blog" <?> Query.string "search" -- s "blog" </> query (Query.string "search") This may be handy if you need query parameters but are not parsing any path segments. """ , tipe = Lambda (Type "Url.Parser.Query.Parser" [ Var "query" ]) (Type "Url.Parser.Parser" [ Lambda (Var "query") (Var "a"), Var "a" ]) } , { name = "s" , comment = """ Parse a segment of the path if it matches a given string. It is almost always used with [`</>`](#</>) or [`oneOf`](#oneOf). For example: blog : Parser (Int -> a) a blog = s "blog" </> int -- /blog/42 ==> Just 42 -- /tree/42 ==> Nothing The path segment must be an exact match! """ , tipe = Lambda (Type "String.String" []) (Type "Url.Parser.Parser" [ Var "a", Var "a" ]) } , { name = "string" , comment = """ Parse a segment of the path as a `String`. -- /alice/ ==> Just "alice" -- /bob ==> Just "bob" -- /42/ ==> Just "42" -- / ==> Nothing """ , tipe = Type "Url.Parser.Parser" [ Lambda (Type "String.String" []) (Var "a"), Var "a" ] } , { name = "top" , comment = """ A parser that does not consume any path segments. type Route = Overview | Post Int blog : Parser (BlogRoute -> a) a blog = s "blog" </> oneOf [ map Overview top , map Post (s "post" </> int) ] -- /blog/ ==> Just Overview -- /blog/post/42 ==> Just (Post 42) """ , tipe = Type "Url.Parser.Parser" [ Var "a", Var "a" ] } ] } , { name = "Url.Parser.Query" , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), <NAME> says a URL looks like this: ``` https://example.com:8042/over/there?name=<NAME>#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` This module is for parsing the `query` part. In this library, a valid query looks like `?search=hats&page=2` where each query parameter has the format `key=value` and is separated from the next parameter by the `&` character. # Parse Query Parameters @docs Parser, string, int, enum, custom # Mapping @docs map, map2, map3, map4, map5, map6, map7, map8 """ , aliases = [ { name = "Parser" , args = [ "a" ] , comment = """ Parse a query like `?search=hat&page=2` into nice Elm data. """ , tipe = Type "Url.Parser.Internal.QueryParser" [ Var "a" ] } ] , unions = [] , binops = [] , values = [ { name = "custom" , comment = """ Create a custom query parser. The [`string`](#string), [`int`](#int), and [`enum`](#enum) parsers are defined using this function. It can help you handle anything though! Say you are unlucky enough to need to handle `?post=2&post=7` to show a couple posts on screen at once. You could say: posts : Parser (Maybe (List Int)) posts = custom "post" (List.maybeMap String.toInt) -- ?post=2 == [2] -- ?post=2&post=7 == [2, 7] -- ?post=2&post=x == [2] -- ?hats=2 == [] """ , tipe = Lambda (Type "String.String" []) (Lambda (Lambda (Type "List.List" [ Type "String.String" [] ]) (Var "a")) (Type "Url.Parser.Query.Parser" [ Var "a" ])) } , { name = "enum" , comment = """ Handle enumerated parameters. Maybe you want a true-or-false parameter: import Dict debug : Parser (Maybe Bool) debug = enum "debug" (Dict.fromList [ ("true", True), ("false", False) ]) -- ?debug=true == Just True -- ?debug=false == Just False -- ?debug=1 == Nothing -- ?debug=0 == Nothing -- ?true=true == Nothing -- ?debug=true&debug=true == Nothing You could add `0` and `1` to the dictionary if you want to handle those as well. You can also use [`map`](#map) to say `map (Result.withDefault False) debug` to get a parser of type `Parser Bool` that swallows any errors and defaults to `False`. **Note:** Parameters like `?debug` with no `=` are not supported by this library. """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "Dict.Dict" [ Type "String.String" [], Var "a" ]) (Type "Url.Parser.Query.Parser" [ Type "Maybe.Maybe" [ Var "a" ] ])) } , { name = "int" , comment = """ Handle `Int` parameters. Maybe you want to show paginated search results: page : Parser (Maybe Int) page = int "page" -- ?page=2 == Just 2 -- ?page=17 == Just 17 -- ?page=two == Nothing -- ?sort=date == Nothing -- ?page=2&page=3 == Nothing Check out [`custom`](#custom) if you need to handle multiple `page` parameters or something like that. """ , tipe = Lambda (Type "String.String" []) (Type "Url.Parser.Query.Parser" [ Type "Maybe.Maybe" [ Type "Basics.Int" [] ] ]) } , { name = "map" , comment = """ Transform a parser in some way. Maybe you want your `page` query parser to default to `1` if there is any problem? page : Parser Int page = map (Result.withDefault 1) (int "page") """ , tipe = Lambda (Lambda (Var "a") (Var "b")) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Type "Url.Parser.Query.Parser" [ Var "b" ])) } , { name = "map2" , comment = """ Combine two parsers. A query like `?search=hats&page=2` could be parsed with something like this: type alias Query = { search : Maybe String , page : Maybe Int } query : Parser Query query = map2 Query (string "search") (int "page") """ , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Var "result"))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))) } , { name = "map3" , comment = """ Combine three parsers. A query like `?search=hats&page=2&sort=ascending` could be parsed with something like this: import Dict type alias Query = { search : Maybe String , page : Maybe Int , sort : Maybe Order } type Order = Ascending | Descending query : Parser Query query = map3 Query (string "search") (int "page") (enum "sort" order) order : Dict.Dict String Order order = Dict.fromList [ ( "ascending", Ascending ) , ( "descending", Descending ) ] """ , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Var "result")))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ])))) } , { name = "map4" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Var "result"))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))))) } , { name = "map5" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Var "result")))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ])))))) } , { name = "map6" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Lambda (Var "f") (Var "result"))))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "f" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))))))) } , { name = "map7" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Lambda (Var "f") (Lambda (Var "g") (Var "result")))))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "f" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "g" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ])))))))) } , { name = "map8" , comment = """ If you need higher than eight, you can define a function like this: apply : Parser a -> Parser (a -> b) -> Parser b apply argParser funcParser = map2 (<|) funcParser argParser And then you can chain it to do as many of these as you would like: map func (string "search") |> apply (int "page") |> apply (int "per-page") """ , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Lambda (Var "f") (Lambda (Var "g") (Lambda (Var "h") (Var "result"))))))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "f" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "g" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "h" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))))))))) } , { name = "string" , comment = """ Handle `String` parameters. search : Parser (Maybe String) search = string "search" -- ?search=cats == Just "cats" -- ?search=42 == Just "42" -- ?branch=left == Nothing -- ?search=cats&search=dogs == Nothing Check out [`custom`](#custom) if you need to handle multiple `search` parameters for some reason. """ , tipe = Lambda (Type "String.String" []) (Type "Url.Parser.Query.Parser" [ Type "Maybe.Maybe" [ Type "String.String" [] ] ]) } ] } ] unsafePackageName : String -> Elm.Package.Name unsafePackageName packageName = case Elm.Package.fromString packageName of Just name -> name Nothing -> -- unsafe, but if the generation went well, it should all be good. unsafePackageName packageName -- Disables the tail-call optimization, so that the test crashes if we enter this case |> identity unsafeModuleName : String -> Elm.Module.Name unsafeModuleName moduleName = case Elm.Module.fromString moduleName of Just name -> name Nothing -> -- unsafe, but if the generation went well, it should all be good. unsafeModuleName moduleName -- Disables the tail-call optimization, so that the test crashes if we enter this case |> identity unsafeConstraint : String -> Elm.Constraint.Constraint unsafeConstraint constraint = case Elm.Constraint.fromString constraint of Just constr -> constr Nothing -> -- unsafe, but if the generation went well, it should all be good. unsafeConstraint constraint -- Disables the tail-call optimization, so that the test crashes if we enter this case |> identity
true
module Review.Test.Dependencies.ElmUrl exposing (dependency) import Elm.Constraint import Elm.Docs import Elm.License import Elm.Module import Elm.Package import Elm.Project import Elm.Type exposing (Type(..)) import Elm.Version import Review.Project.Dependency as Dependency exposing (Dependency) dependency : Dependency dependency = Dependency.create "elm/url" elmJson dependencyModules elmJson : Elm.Project.Project elmJson = Elm.Project.Package { elm = unsafeConstraint "0.19.0 <= v < 0.20.0" , exposed = Elm.Project.ExposedList [ unsafeModuleName "Url", unsafeModuleName "Url.Builder", unsafeModuleName "Url.Parser", unsafeModuleName "Url.Parser.Query" ] , license = Elm.License.fromString "BSD-3-Clause" |> Maybe.withDefault Elm.License.bsd3 , name = unsafePackageName "elm/url" , summary = "Create and parse URLs. Use for HTTP and \"routing\" in single-page apps (SPAs)" , deps = [ ( unsafePackageName "elm/core", unsafeConstraint "1.0.0 <= v < 2.0.0" ) ] , testDeps = [] , version = Elm.Version.fromString "1.0.0" |> Maybe.withDefault Elm.Version.one } dependencyModules : List Elm.Docs.Module dependencyModules = [ { name = "Url" , comment = """ # URLs @docs Url, Protocol, toString, fromString # Percent-Encoding @docs percentEncode, percentDecode """ , aliases = [ { name = "Url" , args = [] , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), PI:NAME:<NAME>END_PI says a URL looks like this: ``` https://example.com:8042/over/there?name=PI:NAME:<NAME>END_PI#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` When you are creating a single-page app with [`Browser.fullscreen`][fs], you use the [`Url.Parser`](Url-Parser) module to turn a `Url` into even nicer data. If you want to create your own URLs, check out the [`Url.Builder`](Url-Builder) module as well! [fs]: /packages/elm/browser/latest/Browser#fullscreen **Note:** This is a subset of all the full possibilities listed in the URI spec. Specifically, it does not accept the `userinfo` segment you see in email addresses like `PI:EMAIL:<EMAIL>END_PI`. """ , tipe = Record [ ( "protocol", Type "Url.Protocol" [] ), ( "host", Type "String.String" [] ), ( "port_", Type "Maybe.Maybe" [ Type "Basics.Int" [] ] ), ( "path", Type "String.String" [] ), ( "query", Type "Maybe.Maybe" [ Type "String.String" [] ] ), ( "fragment", Type "Maybe.Maybe" [ Type "String.String" [] ] ) ] Nothing } ] , unions = [ { name = "Protocol" , args = [] , comment = """ Is the URL served over a secure connection or not? """ , tags = [ ( "Http", [] ) , ( "Https", [] ) ] } ] , binops = [] , values = [ { name = "fromString" , comment = """ Attempt to break a URL up into [`Url`](#Url). This is useful in single-page apps when you want to parse certain chunks of a URL to figure out what to show on screen. fromString "https://example.com:443" -- Just -- { protocol = Https -- , host = "example.com" -- , port_ = Just 443 -- , path = "/" -- , query = Nothing -- , fragment = Nothing -- } fromString "https://example.com/hats?q=top%20hat" -- Just -- { protocol = Https -- , host = "example.com" -- , port_ = Nothing -- , path = "/hats" -- , query = Just "q=top%20hat" -- , fragment = Nothing -- } fromString "http://example.com/core/List/#map" -- Just -- { protocol = Http -- , host = "example.com" -- , port_ = Nothing -- , path = "/core/List/" -- , query = Nothing -- , fragment = Just "map" -- } The conversion to segments can fail in some cases as well: fromString "example.com:443" == Nothing -- no protocol fromString "http://PI:EMAIL:<EMAIL>END_PI" == Nothing -- userinfo disallowed fromString "http://#cats" == Nothing -- no host **Note:** This function does not use [`percentDecode`](#percentDecode) anything. It just splits things up. [`Url.Parser`](Url-Parser) actually _needs_ the raw `query` string to parse it properly. Otherwise it could get confused about `=` and `&` characters! """ , tipe = Lambda (Type "String.String" []) (Type "Maybe.Maybe" [ Type "Url.Url" [] ]) } , { name = "percentDecode" , comment = """ **Use [Url.Parser](Url-Parser) instead!** It will decode query parameters appropriately already! `percentDecode` is only available so that extremely custom cases are possible, if needed. Check out the `percentEncode` function to learn about percent-encoding. This function does the opposite! Here are the reverse examples: -- ASCII percentDecode "99%25" == Just "hat" percentDecode "to%20be" == Just "to be" percentDecode "hat" == Just "99%" -- UTF-8 percentDecode "%24" == Just "$" percentDecode "%C2%A2" == Just "¢" percentDecode "%E2%82%AC" == Just "€" Why is it a `Maybe` though? Well, these strings come from strangers on the internet as a bunch of bits and may have encoding problems. For example: percentDecode "%" == Nothing -- not followed by two hex digits percentDecode "%XY" == Nothing -- not followed by two HEX digits percentDecode "%C2" == Nothing -- half of the "¢" encoding "%C2%A2" This is the same behavior as JavaScript's [`decodeURIComponent`][js] function. [js]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent """ , tipe = Lambda (Type "String.String" []) (Type "Maybe.Maybe" [ Type "String.String" [] ]) } , { name = "percentEncode" , comment = """ **Use [Url.Builder](Url-Builder) instead!** Functions like `absolute`, `relative`, and `crossOrigin` already do this automatically! `percentEncode` is only available so that extremely custom cases are possible, if needed. Percent-encoding is how [the official URI spec][uri] “escapes” special characters. You can still represent a `?` even though it is reserved for queries. This function exists in case you want to do something extra custom. Here are some examples: -- standard ASCII encoding percentEncode "hat" == "hat" percentEncode "to be" == "to%20be" percentEncode "99%" == "99%25" -- non-standard, but widely accepted, UTF-8 encoding percentEncode "$" == "%24" percentEncode "¢" == "%C2%A2" percentEncode "€" == "%E2%82%AC" This is the same behavior as JavaScript's [`encodeURIComponent`][js] function, and the rules are described in more detail officially [here][s2] and with some notes about Unicode [here][wiki]. [js]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent [uri]: https://tools.ietf.org/html/rfc3986 [s2]: https://tools.ietf.org/html/rfc3986#section-2.1 [wiki]: https://en.wikipedia.org/wiki/Percent-encoding """ , tipe = Lambda (Type "String.String" []) (Type "String.String" []) } , { name = "toString" , comment = """ Turn a [`Url`](#Url) into a `String`. """ , tipe = Lambda (Type "Url.Url" []) (Type "String.String" []) } ] } , { name = "Url.Builder" , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), PI:NAME:<NAME>END_PI says a URL looks like this: ``` https://example.com:8042/over/there?name=PI:NAME:<NAME>END_PI#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` This module helps you create these! # Builders @docs absolute, relative, crossOrigin, custom, Root # Queries @docs QueryParameter, string, int, toQuery """ , aliases = [] , unions = [ { name = "QueryParameter" , args = [] , comment = """ Represents query parameter. Builder functions like `absolute` percent-encode all the query parameters they get, so you do not need to worry about it! """ , tags = [] } , { name = "Root" , args = [] , comment = """ Specify whether a [`custom`](#custom) URL is absolute, relative, or cross-origin. """ , tags = [ ( "Absolute", [] ) , ( "Relative", [] ) , ( "CrossOrigin", [ Type "String.String" [] ] ) ] } ] , binops = [] , values = [ { name = "absolute" , comment = """ Create an absolute URL: absolute [] [] -- "/" absolute [ "packages", "elm", "core" ] [] -- "/packages/elm/core" absolute [ "blog", String.fromInt 42 ] [] -- "/blog/42" absolute [ "products" ] [ string "search" "hat", int "page" 2 ] -- "/products?search=hat&page=2" Notice that the URLs start with a slash! """ , tipe = Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" [])) } , { name = "crossOrigin" , comment = """ Create a cross-origin URL. crossOrigin "https://example.com" [ "products" ] [] -- "https://example.com/products" crossOrigin "https://example.com" [] [] -- "https://example.com/" crossOrigin "https://example.com:8042" [ "over", "there" ] [ string "name" "PI:NAME:<NAME>END_PI" ] -- "https://example.com:8042/over/there?name=PI:NAME:<NAME>END_PI" **Note:** Cross-origin requests are slightly restricted for security. For example, the [same-origin policy][sop] applies when sending HTTP requests, so the appropriate `Access-Control-Allow-Origin` header must be enabled on the *server* to get things working. Read more about the security rules [here][cors]. [sop]: https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy [cors]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" []))) } , { name = "custom" , comment = """ Create custom URLs that may have a hash on the end: custom Absolute [ "packages", "elm", "core", "latest", "String" ] [] (Just "length") -- "/packages/elm/core/latest/String#length" custom Relative [ "there" ] [ string "name" "PI:NAME:<NAME>END_PI" ] Nothing -- "there?name=PI:NAME:<NAME>END_PI" custom (CrossOrigin "https://example.com:8042") [ "over", "there" ] [ string "name" "PI:NAME:<NAME>END_PI" ] (Just "nose") -- "https://example.com:8042/over/there?name=PI:NAME:<NAME>END_PI#nose" """ , tipe = Lambda (Type "Url.Builder.Root" []) (Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Lambda (Type "Maybe.Maybe" [ Type "String.String" [] ]) (Type "String.String" [])))) } , { name = "int" , comment = """ Create a percent-encoded query parameter. absolute ["products"] [ string "search" "hat", int "page" 2 ] -- "/products?search=hat&page=2" Writing `int key n` is the same as writing `string key (String.fromInt n)`. So this is just a convenience function, making your code a bit shorter! """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "Basics.Int" []) (Type "Url.Builder.QueryParameter" [])) } , { name = "relative" , comment = """ Create a relative URL: relative [] [] -- "" relative [ "elm", "core" ] [] -- "elm/core" relative [ "blog", String.fromInt 42 ] [] -- "blog/42" relative [ "products" ] [ string "search" "hat", int "page" 2 ] -- "products?search=hat&page=2" Notice that the URLs **do not** start with a slash! """ , tipe = Lambda (Type "List.List" [ Type "String.String" [] ]) (Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" [])) } , { name = "string" , comment = """ Create a percent-encoded query parameter. absolute ["products"] [ string "search" "hat" ] -- "/products?search=hat" absolute ["products"] [ string "search" "coffee table" ] -- "/products?search=coffee%20table" """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "String.String" []) (Type "Url.Builder.QueryParameter" [])) } , { name = "toQuery" , comment = """ Convert a list of query parameters to a percent-encoded query. This function is used by `absolute`, `relative`, etc. toQuery [ string "search" "hat" ] -- "?search=hat" toQuery [ string "search" "coffee table" ] -- "?search=coffee%20table" toQuery [ string "search" "hat", int "page" 2 ] -- "?search=hat&page=2" toQuery [] -- "" """ , tipe = Lambda (Type "List.List" [ Type "Url.Builder.QueryParameter" [] ]) (Type "String.String" []) } ] } , { name = "Url.Parser" , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), PI:NAME:<NAME>END_PI says a URL looks like this: ``` https://example.com:8042/over/there?name=PI:NAME:<NAME>END_PI#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` This module is primarily for parsing the `path` part. # Primitives @docs Parser, string, int, s # Path @docs (</>), map, oneOf, top, custom # Query @docs (<?>), query # Fragment @docs fragment # Run Parsers @docs parse """ , aliases = [] , unions = [ { name = "Parser" , args = [ "a", "b" ] , comment = """ Turn URLs like `/blog/42/cat-herding-techniques` into nice Elm data. """ , tags = [] } ] , binops = [ { name = "</>" , comment = """ Parse a path with multiple segments. blog : Parser (Int -> a) a blog = s "blog" </> int -- /blog/35/ ==> Just 35 -- /blog/42 ==> Just 42 -- /blog/ ==> Nothing -- /42/ ==> Nothing search : Parser (String -> a) a search = s "search" </> string -- /search/wolf/ ==> Just "wolf" -- /search/frog ==> Just "frog" -- /search/ ==> Nothing -- /wolf/ ==> Nothing """ , tipe = Lambda (Type "Url.Parser.Parser" [ Var "a", Var "b" ]) (Lambda (Type "Url.Parser.Parser" [ Var "b", Var "c" ]) (Type "Url.Parser.Parser" [ Var "a", Var "c" ])) , associativity = Elm.Docs.Right , precedence = 7 } , { name = "<?>" , comment = """ The [`Url.Parser.Query`](Url-Parser-Query) module defines its own [`Parser`](Url-Parser-Query#Parser) type. This function helps you use those with normal parsers. For example, maybe you want to add a search feature to your blog website: import Url.Parser.Query as Query type Route = Overview (Maybe String) | Post Int blog : Parser (Route -> a) a blog = oneOf [ map Overview (s "blog" <?> Query.string "q") , map Post (s "blog" </> int) ] -- /blog/ ==> Just (Overview Nothing) -- /blog/?q=wolf ==> Just (Overview (Just "wolf")) -- /blog/wolf ==> Nothing -- /blog/42 ==> Just (Post 42) -- /blog/42?q=wolf ==> Just (Post 42) -- /blog/42/wolf ==> Nothing """ , tipe = Lambda (Type "Url.Parser.Parser" [ Var "a", Lambda (Var "query") (Var "b") ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "query" ]) (Type "Url.Parser.Parser" [ Var "a", Var "b" ])) , associativity = Elm.Docs.Left , precedence = 8 } ] , values = [ { name = "custom" , comment = """ Create a custom path segment parser. Here is how it is used to define the `int` parser: int : Parser (Int -> a) a int = custom "NUMBER" String.toInt You can use it to define something like “only CSS files” like this: css : Parser (String -> a) a css = custom "CSS_FILE" <| \\segment -> if String.endsWith ".css" segment then Just segment else Nothing """ , tipe = Lambda (Type "String.String" []) (Lambda (Lambda (Type "String.String" []) (Type "Maybe.Maybe" [ Var "a" ])) (Type "Url.Parser.Parser" [ Lambda (Var "a") (Var "b"), Var "b" ])) } , { name = "fragment" , comment = """ Create a parser for the URL fragment, the stuff after the `#`. This can be handy for handling links to DOM elements within a page. Pages like this one! type alias Docs = (String, Maybe String) docs : Parser (Docs -> a) a docs = map Tuple.pair (string </> fragment identity) -- /List/map ==> Nothing -- /List/#map ==> Just ("List", Just "map") -- /List#map ==> Just ("List", Just "map") -- /List# ==> Just ("List", Just "") -- /List ==> Just ("List", Nothing) -- / ==> Nothing """ , tipe = Lambda (Lambda (Type "Maybe.Maybe" [ Type "String.String" [] ]) (Var "fragment")) (Type "Url.Parser.Parser" [ Lambda (Var "fragment") (Var "a"), Var "a" ]) } , { name = "int" , comment = """ Parse a segment of the path as an `Int`. -- /alice/ ==> Nothing -- /bob ==> Nothing -- /42/ ==> Just 42 -- / ==> Nothing """ , tipe = Type "Url.Parser.Parser" [ Lambda (Type "Basics.Int" []) (Var "a"), Var "a" ] } , { name = "map" , comment = """ Transform a path parser. type alias Comment = { user : String, id : Int } userAndId : Parser (String -> Int -> a) a userAndId = s "user" </> string </> s "comment" </> int comment : Parser (Comment -> a) a comment = map Comment userAndId -- /user/bob/comment/42 ==> Just { user = "bob", id = 42 } -- /user/tom/comment/35 ==> Just { user = "tom", id = 35 } -- /user/sam/ ==> Nothing """ , tipe = Lambda (Var "a") (Lambda (Type "Url.Parser.Parser" [ Var "a", Var "b" ]) (Type "Url.Parser.Parser" [ Lambda (Var "b") (Var "c"), Var "c" ])) } , { name = "oneOf" , comment = """ Try a bunch of different path parsers. type Route = Topic String | Blog Int | User String | Comment String Int route : Parser (Route -> a) a route = oneOf [ map Topic (s "topic" </> string) , map Blog (s "blog" </> int) , map User (s "user" </> string) , map Comment (s "user" </> string </> s "comment" </> int) ] -- /topic/wolf ==> Just (Topic "wolf") -- /topic/ ==> Nothing -- /blog/42 ==> Just (Blog 42) -- /blog/wolf ==> Nothing -- /user/sam/ ==> Just (User "sam") -- /user/bob/comment/42 ==> Just (Comment "bob" 42) -- /user/tom/comment/35 ==> Just (Comment "tom" 35) -- /user/ ==> Nothing If there are multiple parsers that could succeed, the first one wins. """ , tipe = Lambda (Type "List.List" [ Type "Url.Parser.Parser" [ Var "a", Var "b" ] ]) (Type "Url.Parser.Parser" [ Var "a", Var "b" ]) } , { name = "parse" , comment = """ Actually run a parser! You provide some [`Url`](Url#Url) that represent a valid URL. From there `parse` runs your parser on the path, query parameters, and fragment. import Url import Url.Parser exposing (Parser, parse, int, map, oneOf, s, top) type Route = Home | Blog Int | NotFound route : Parser (Route -> a) a route = oneOf [ map Home top , map Blog (s "blog" </> int) ] toRoute : String -> Route toRoute string = case Url.fromString string of Nothing -> NotFound Just url -> Maybe.withDefault NotFound (parse route url) -- toRoute "/blog/42" == NotFound -- toRoute "https://example.com/" == Home -- toRoute "https://example.com/blog" == NotFound -- toRoute "https://example.com/blog/42" == Blog 42 -- toRoute "https://example.com/blog/42/" == Blog 42 -- toRoute "https://example.com/blog/42#wolf" == Blog 42 -- toRoute "https://example.com/blog/42?q=wolf" == Blog 42 -- toRoute "https://example.com/settings" == NotFound Functions like `toRoute` are useful when creating single-page apps with [`Browser.fullscreen`][fs]. I use them in `init` and `onNavigation` to handle the initial URL and any changes. [fs]: /packages/elm/browser/latest/Browser#fullscreen """ , tipe = Lambda (Type "Url.Parser.Parser" [ Lambda (Var "a") (Var "a"), Var "a" ]) (Lambda (Type "Url.Url" []) (Type "Maybe.Maybe" [ Var "a" ])) } , { name = "query" , comment = """ The [`Url.Parser.Query`](Url-Parser-Query) module defines its own [`Parser`](Url-Parser-Query#Parser) type. This function is a helper to convert those into normal parsers. import Url.Parser.Query as Query -- the following expressions are both the same! -- -- s "blog" <?> Query.string "search" -- s "blog" </> query (Query.string "search") This may be handy if you need query parameters but are not parsing any path segments. """ , tipe = Lambda (Type "Url.Parser.Query.Parser" [ Var "query" ]) (Type "Url.Parser.Parser" [ Lambda (Var "query") (Var "a"), Var "a" ]) } , { name = "s" , comment = """ Parse a segment of the path if it matches a given string. It is almost always used with [`</>`](#</>) or [`oneOf`](#oneOf). For example: blog : Parser (Int -> a) a blog = s "blog" </> int -- /blog/42 ==> Just 42 -- /tree/42 ==> Nothing The path segment must be an exact match! """ , tipe = Lambda (Type "String.String" []) (Type "Url.Parser.Parser" [ Var "a", Var "a" ]) } , { name = "string" , comment = """ Parse a segment of the path as a `String`. -- /alice/ ==> Just "alice" -- /bob ==> Just "bob" -- /42/ ==> Just "42" -- / ==> Nothing """ , tipe = Type "Url.Parser.Parser" [ Lambda (Type "String.String" []) (Var "a"), Var "a" ] } , { name = "top" , comment = """ A parser that does not consume any path segments. type Route = Overview | Post Int blog : Parser (BlogRoute -> a) a blog = s "blog" </> oneOf [ map Overview top , map Post (s "post" </> int) ] -- /blog/ ==> Just Overview -- /blog/post/42 ==> Just (Post 42) """ , tipe = Type "Url.Parser.Parser" [ Var "a", Var "a" ] } ] } , { name = "Url.Parser.Query" , comment = """ In [the URI spec](https://tools.ietf.org/html/rfc3986), PI:NAME:<NAME>END_PI says a URL looks like this: ``` https://example.com:8042/over/there?name=PI:NAME:<NAME>END_PI#nose \\___/ \\______________/\\_________/ \\_________/ \\__/ | | | | | scheme authority path query fragment ``` This module is for parsing the `query` part. In this library, a valid query looks like `?search=hats&page=2` where each query parameter has the format `key=value` and is separated from the next parameter by the `&` character. # Parse Query Parameters @docs Parser, string, int, enum, custom # Mapping @docs map, map2, map3, map4, map5, map6, map7, map8 """ , aliases = [ { name = "Parser" , args = [ "a" ] , comment = """ Parse a query like `?search=hat&page=2` into nice Elm data. """ , tipe = Type "Url.Parser.Internal.QueryParser" [ Var "a" ] } ] , unions = [] , binops = [] , values = [ { name = "custom" , comment = """ Create a custom query parser. The [`string`](#string), [`int`](#int), and [`enum`](#enum) parsers are defined using this function. It can help you handle anything though! Say you are unlucky enough to need to handle `?post=2&post=7` to show a couple posts on screen at once. You could say: posts : Parser (Maybe (List Int)) posts = custom "post" (List.maybeMap String.toInt) -- ?post=2 == [2] -- ?post=2&post=7 == [2, 7] -- ?post=2&post=x == [2] -- ?hats=2 == [] """ , tipe = Lambda (Type "String.String" []) (Lambda (Lambda (Type "List.List" [ Type "String.String" [] ]) (Var "a")) (Type "Url.Parser.Query.Parser" [ Var "a" ])) } , { name = "enum" , comment = """ Handle enumerated parameters. Maybe you want a true-or-false parameter: import Dict debug : Parser (Maybe Bool) debug = enum "debug" (Dict.fromList [ ("true", True), ("false", False) ]) -- ?debug=true == Just True -- ?debug=false == Just False -- ?debug=1 == Nothing -- ?debug=0 == Nothing -- ?true=true == Nothing -- ?debug=true&debug=true == Nothing You could add `0` and `1` to the dictionary if you want to handle those as well. You can also use [`map`](#map) to say `map (Result.withDefault False) debug` to get a parser of type `Parser Bool` that swallows any errors and defaults to `False`. **Note:** Parameters like `?debug` with no `=` are not supported by this library. """ , tipe = Lambda (Type "String.String" []) (Lambda (Type "Dict.Dict" [ Type "String.String" [], Var "a" ]) (Type "Url.Parser.Query.Parser" [ Type "Maybe.Maybe" [ Var "a" ] ])) } , { name = "int" , comment = """ Handle `Int` parameters. Maybe you want to show paginated search results: page : Parser (Maybe Int) page = int "page" -- ?page=2 == Just 2 -- ?page=17 == Just 17 -- ?page=two == Nothing -- ?sort=date == Nothing -- ?page=2&page=3 == Nothing Check out [`custom`](#custom) if you need to handle multiple `page` parameters or something like that. """ , tipe = Lambda (Type "String.String" []) (Type "Url.Parser.Query.Parser" [ Type "Maybe.Maybe" [ Type "Basics.Int" [] ] ]) } , { name = "map" , comment = """ Transform a parser in some way. Maybe you want your `page` query parser to default to `1` if there is any problem? page : Parser Int page = map (Result.withDefault 1) (int "page") """ , tipe = Lambda (Lambda (Var "a") (Var "b")) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Type "Url.Parser.Query.Parser" [ Var "b" ])) } , { name = "map2" , comment = """ Combine two parsers. A query like `?search=hats&page=2` could be parsed with something like this: type alias Query = { search : Maybe String , page : Maybe Int } query : Parser Query query = map2 Query (string "search") (int "page") """ , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Var "result"))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))) } , { name = "map3" , comment = """ Combine three parsers. A query like `?search=hats&page=2&sort=ascending` could be parsed with something like this: import Dict type alias Query = { search : Maybe String , page : Maybe Int , sort : Maybe Order } type Order = Ascending | Descending query : Parser Query query = map3 Query (string "search") (int "page") (enum "sort" order) order : Dict.Dict String Order order = Dict.fromList [ ( "ascending", Ascending ) , ( "descending", Descending ) ] """ , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Var "result")))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ])))) } , { name = "map4" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Var "result"))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))))) } , { name = "map5" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Var "result")))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ])))))) } , { name = "map6" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Lambda (Var "f") (Var "result"))))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "f" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))))))) } , { name = "map7" , comment = "" , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Lambda (Var "f") (Lambda (Var "g") (Var "result")))))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "f" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "g" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ])))))))) } , { name = "map8" , comment = """ If you need higher than eight, you can define a function like this: apply : Parser a -> Parser (a -> b) -> Parser b apply argParser funcParser = map2 (<|) funcParser argParser And then you can chain it to do as many of these as you would like: map func (string "search") |> apply (int "page") |> apply (int "per-page") """ , tipe = Lambda (Lambda (Var "a") (Lambda (Var "b") (Lambda (Var "c") (Lambda (Var "d") (Lambda (Var "e") (Lambda (Var "f") (Lambda (Var "g") (Lambda (Var "h") (Var "result"))))))))) (Lambda (Type "Url.Parser.Query.Parser" [ Var "a" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "b" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "c" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "d" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "e" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "f" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "g" ]) (Lambda (Type "Url.Parser.Query.Parser" [ Var "h" ]) (Type "Url.Parser.Query.Parser" [ Var "result" ]))))))))) } , { name = "string" , comment = """ Handle `String` parameters. search : Parser (Maybe String) search = string "search" -- ?search=cats == Just "cats" -- ?search=42 == Just "42" -- ?branch=left == Nothing -- ?search=cats&search=dogs == Nothing Check out [`custom`](#custom) if you need to handle multiple `search` parameters for some reason. """ , tipe = Lambda (Type "String.String" []) (Type "Url.Parser.Query.Parser" [ Type "Maybe.Maybe" [ Type "String.String" [] ] ]) } ] } ] unsafePackageName : String -> Elm.Package.Name unsafePackageName packageName = case Elm.Package.fromString packageName of Just name -> name Nothing -> -- unsafe, but if the generation went well, it should all be good. unsafePackageName packageName -- Disables the tail-call optimization, so that the test crashes if we enter this case |> identity unsafeModuleName : String -> Elm.Module.Name unsafeModuleName moduleName = case Elm.Module.fromString moduleName of Just name -> name Nothing -> -- unsafe, but if the generation went well, it should all be good. unsafeModuleName moduleName -- Disables the tail-call optimization, so that the test crashes if we enter this case |> identity unsafeConstraint : String -> Elm.Constraint.Constraint unsafeConstraint constraint = case Elm.Constraint.fromString constraint of Just constr -> constr Nothing -> -- unsafe, but if the generation went well, it should all be good. unsafeConstraint constraint -- Disables the tail-call optimization, so that the test crashes if we enter this case |> identity
elm
[ { "context": " , info [ class \"marginTopM\" ] \"COMPANY\" [ text \"Bekk Consulting\" ]\n , info [ class \"marginTopM\" ] ", "end": 2184, "score": 0.5333257318, "start": 2169, "tag": "NAME", "value": "Bekk Consulting" }, { "context": " , div [] [ a [ href \"https://github.com/navikt/sykdom-i-familien\" ] [ text \"sykdom-i-familien\" ]", "end": 3619, "score": 0.9993086457, "start": 3613, "tag": "USERNAME", "value": "navikt" }, { "context": " , div [] [ a [ href \"https://github.com/navikt/omsorgsdager-kalkulator\" ] [ text \"omsorgsdager-k", "end": 3750, "score": 0.9996004701, "start": 3744, "tag": "USERNAME", "value": "navikt" }, { "context": "\"paddingBottomL\" ] [ a [ href \"https://github.com/navikt/omsorgspengerutbetaling-arbeidstaker-soknad\" ] [ ", "end": 3917, "score": 0.9996030927, "start": 3911, "tag": "USERNAME", "value": "navikt" }, { "context": "2019\"\n , infoText \"Team Digisos\"\n , collapse\n ", "end": 4448, "score": 0.5775768161, "start": 4441, "tag": "NAME", "value": "Digisos" }, { "context": " , div [] [ a [ href \"https://github.com/navikt/sosialhjelp-soknad\" ] [ text \"sosialhjelp-soknad\"", "end": 5250, "score": 0.9993456006, "start": 5244, "tag": "USERNAME", "value": "navikt" }, { "context": " , div [] [ a [ href \"https://github.com/navikt/sosialhjelp-innsyn\" ] [ text \"sosialhjelp-innsyn\"", "end": 5383, "score": 0.9991537929, "start": 5377, "tag": "USERNAME", "value": "navikt" }, { "context": "\"paddingBottomL\" ] [ a [ href \"https://github.com/navikt/sosialhjelp-woldena-tm\" ] [ text \"sosialhjelp-wol", "end": 5540, "score": 0.9993311763, "start": 5534, "tag": "USERNAME", "value": "navikt" }, { "context": "v []\n [ div [] [ text \"Statens Vegvesen\" ]\n , infoText \"Januar", "end": 5922, "score": 0.9907247424, "start": 5906, "tag": "NAME", "value": "Statens Vegvesen" }, { "context": "rch 2018\"\n , infoText \"Team Datainn\"\n , collapse\n ", "end": 6037, "score": 0.7593069673, "start": 6033, "tag": "NAME", "value": "Team" }, { "context": "2018\"\n , infoText \"Team Datainn\"\n , collapse\n ", "end": 6045, "score": 0.9531188011, "start": 6038, "tag": "NAME", "value": "Datainn" } ]
src/Cv2.elm
woldena/andrewolden
0
module Cv2 exposing (..) import Components.CollapseTransition.Collapse exposing (collapse) import Html exposing (Attribute, Html, a, div, text) import Html.Attributes exposing (class, href, rel, target) import Messages exposing (Msg) import Model exposing (Model, collapseId1, collapseId2, collapseId3) import String exposing (fromInt) import Svg import Svg.Attributes as SvgA largeCircleColor = "#CED4DA" circle : Int -> String -> Html Msg circle radius color = let radiuseString = fromInt radius diameterString = radius * 2 |> fromInt in Svg.svg [ SvgA.width diameterString , SvgA.height diameterString , SvgA.viewBox <| "0 0 " ++ diameterString ++ " " ++ diameterString ] [ Svg.circle [ SvgA.cx radiuseString , SvgA.cy radiuseString , SvgA.r radiuseString , SvgA.fill color ] [] ] largeCircle = circle 10 largeCircleColor smallCircle = circle 7 largeCircleColor descriptionHeader : List (Attribute Msg) -> String -> Html Msg descriptionHeader attributes content = div ([ class "description marginBottomXXS" ] ++ attributes) [ text content ] info : List (Attribute Msg) -> String -> List (Html Msg) -> Html Msg info attributes description content = div attributes [ descriptionHeader [] description , div [ class "large-text p" ] content ] infoText : String -> Html Msg infoText content = div [ class "large-text" ] [ text content ] workPlaces : List (Attribute Msg) -> List (Html Msg) -> Html Msg workPlaces attributes workplaces = workplaces |> List.map (\wp -> div [ class "cv-content-wrapper marginTopL" ] [ div [ class "left" ] [ largeCircle ], div [ class "right" ] [ wp ] ]) |> div [] cv : Model -> Html Msg cv model = div [] [ div [ class "titleXXL" ] [ text "CV" ] , workPlaces [] [ div [] [ div [ class "workplace-title" ] [ text "January 2018 - now" ] , info [ class "marginTopM" ] "COMPANY" [ text "Bekk Consulting" ] , info [ class "marginTopM" ] "POSITION" [ text "Senior software developer" ] , div [ class "marginTopM marginBottomS" ] [ descriptionHeader [] "PROJECTS" ] , div [] [ div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "NAV - Arbeids- og velferdsetaten" ] , infoText "January 2020 - now" , infoText "Team Sykdom i familien" , collapse ( collapseId1, model.collapseTransitions ) [ class "marginTopS" ] [ info [] "SHORT INTRODUCTION" [ text "Different application forms in some way related to attendance allowance. Several react based application forms, and Kotlin based backends. Application form data is validated before it is put on a Kafka topic ready to be evaluated." ] , info [ class "marginTopM" ] "TECHNOLOGIES" [ text "React, Typescript, Formik, Gatsby, Sanity, Kotlin, Kafka, Docker, Nais (nais.io, built on Kubernetes)" ] , descriptionHeader [ class "marginTopM" ] "OPEN SOURCE REPOSITORIES" , div [] [ a [ href "https://github.com/navikt/sykdom-i-familien" ] [ text "sykdom-i-familien" ] ] , div [] [ a [ href "https://github.com/navikt/omsorgsdager-kalkulator" ] [ text "omsorgsdager-kalkulator" ] ] , div [ class "paddingBottomL" ] [ a [ href "https://github.com/navikt/omsorgspengerutbetaling-arbeidstaker-soknad" ] [ text "arbeidstaker" ] ] ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "NAV - Arbeids- og velferdsetaten" ] , infoText "May 2018 - December 2019" , infoText "Team Digisos" , collapse ( collapseId2, model.collapseTransitions ) [ class "marginTopS" ] [ info [] "SHORT INTRODUCTION" [ text "Application form for financial assistance. React frontend and Java backend. Users can log in with Idporten. Each submitted application is validated and transmitted to the correct municipality based on the user’s current andress." ] , info [ class "marginTopM" ] "TECHNOLOGIES" [ text "React, Typescript, Redux, Java, Docker, nais.io, Kubernetes" ] , descriptionHeader [ class "marginTopM" ] "OPEN SOURCE REPOSITORIES" , div [] [ a [ href "https://github.com/navikt/sosialhjelp-soknad" ] [ text "sosialhjelp-soknad" ] ] , div [] [ a [ href "https://github.com/navikt/sosialhjelp-innsyn" ] [ text "sosialhjelp-innsyn" ] ] , div [ class "paddingBottomL" ] [ a [ href "https://github.com/navikt/sosialhjelp-woldena-tm" ] [ text "sosialhjelp-woldena-tm" ] ] ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "Statens Vegvesen" ] , infoText "January 2018 - March 2018" , infoText "Team Datainn" , collapse ( collapseId3, model.collapseTransitions ) [ class "marginTopS" ] [ info [] "SHORT INTRODUCTION" [ text "Collection and aggregation of traffic data along the Norwegian road network." ] , info [ class "marginTopM" ] "TECHNOLOGIES" [ text "React, Java, AngularJS, Akka, Elasticsearch" ] ] ] ] ] ] , div [] [ div [ class "workplace-title" ] [ text "August 2012 - December 2017" ] , info [ class "marginTopM" ] "COMPANY" [ text "FMC Technologies (TechnipFMC)" ] , div [ class "marginTopM marginBottomS" ] [ descriptionHeader [] "PROJECTS / POSITIONS" ] , div [] [ div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "NGA - Next Generation Automation" ] , infoText "January 2016 - December 2017" , infoText "Project Engineer" , info [ class "marginTopM" ] "SHORT INTRODUCTION" [ text "Engineering and prototyping of new subsea electronic module" ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "WAMS - Well Access Monitoring Systems" ] , infoText "May 2014 - December 2017" , infoText "Product engineer" , info [ class "marginTopM" ] "SHORT INTRODUCTION" [ text "Responsible for specifying Inclinometers and Strain Gauges procured from subsuplier, and calibration of sensors after installation onto riser joints. Travel to site locations for performing calibration tests." ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "Controls and Distribution" ] , infoText "May 2014 - December 2015" , infoText "Project Engineer" , info [ class "marginTopM" ] "SHORT INTRODUCTION" [ text "Project engineer for instrumentation on various projects, for example Snorre B" ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "Graduate Engineering Program" ] , infoText "August 2012 - July 2014" , infoText "Trainee" ] ] ] ] , div [] [ div [ class "workplace-title" ] [ text "August 2007 - July 2012" ] , info [ class "marginTopM" ] "UNIVERSITY" [ text "NTNU (Norwegian University of Science and Technology)" ] , info [ class "marginTopM" ] "PROGRAMME" [ text "Mechanical Engineering" ] , info [ class "marginTopM" ] "MAIN PROFILE" [ text "Energy, Process and Fluids Engineering" ] , info [ class "marginTopM" ] "DESCRIPTION" [ text "Specialized in fluid mechanics and multiphase flow. Master's Thesis working for the Multiphase Flow Lab at KAIST (Korea Advanced Institute of Science and Technology)" ] , info [ class "marginTopM" ] "THESIS" [ a [ rel "noreferrer noopener", target "_blank", href "https://ntnuopen.ntnu.no/ntnu-xmlui/bitstream/handle/11250/234896/566557_FULLTEXT01.pdf?sequence=2" ] [ text "Evaluation of Split Ratio for Plug Flow at a Meso-Scale T-Junction" ] ] ] ] ]
10361
module Cv2 exposing (..) import Components.CollapseTransition.Collapse exposing (collapse) import Html exposing (Attribute, Html, a, div, text) import Html.Attributes exposing (class, href, rel, target) import Messages exposing (Msg) import Model exposing (Model, collapseId1, collapseId2, collapseId3) import String exposing (fromInt) import Svg import Svg.Attributes as SvgA largeCircleColor = "#CED4DA" circle : Int -> String -> Html Msg circle radius color = let radiuseString = fromInt radius diameterString = radius * 2 |> fromInt in Svg.svg [ SvgA.width diameterString , SvgA.height diameterString , SvgA.viewBox <| "0 0 " ++ diameterString ++ " " ++ diameterString ] [ Svg.circle [ SvgA.cx radiuseString , SvgA.cy radiuseString , SvgA.r radiuseString , SvgA.fill color ] [] ] largeCircle = circle 10 largeCircleColor smallCircle = circle 7 largeCircleColor descriptionHeader : List (Attribute Msg) -> String -> Html Msg descriptionHeader attributes content = div ([ class "description marginBottomXXS" ] ++ attributes) [ text content ] info : List (Attribute Msg) -> String -> List (Html Msg) -> Html Msg info attributes description content = div attributes [ descriptionHeader [] description , div [ class "large-text p" ] content ] infoText : String -> Html Msg infoText content = div [ class "large-text" ] [ text content ] workPlaces : List (Attribute Msg) -> List (Html Msg) -> Html Msg workPlaces attributes workplaces = workplaces |> List.map (\wp -> div [ class "cv-content-wrapper marginTopL" ] [ div [ class "left" ] [ largeCircle ], div [ class "right" ] [ wp ] ]) |> div [] cv : Model -> Html Msg cv model = div [] [ div [ class "titleXXL" ] [ text "CV" ] , workPlaces [] [ div [] [ div [ class "workplace-title" ] [ text "January 2018 - now" ] , info [ class "marginTopM" ] "COMPANY" [ text "<NAME>" ] , info [ class "marginTopM" ] "POSITION" [ text "Senior software developer" ] , div [ class "marginTopM marginBottomS" ] [ descriptionHeader [] "PROJECTS" ] , div [] [ div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "NAV - Arbeids- og velferdsetaten" ] , infoText "January 2020 - now" , infoText "Team Sykdom i familien" , collapse ( collapseId1, model.collapseTransitions ) [ class "marginTopS" ] [ info [] "SHORT INTRODUCTION" [ text "Different application forms in some way related to attendance allowance. Several react based application forms, and Kotlin based backends. Application form data is validated before it is put on a Kafka topic ready to be evaluated." ] , info [ class "marginTopM" ] "TECHNOLOGIES" [ text "React, Typescript, Formik, Gatsby, Sanity, Kotlin, Kafka, Docker, Nais (nais.io, built on Kubernetes)" ] , descriptionHeader [ class "marginTopM" ] "OPEN SOURCE REPOSITORIES" , div [] [ a [ href "https://github.com/navikt/sykdom-i-familien" ] [ text "sykdom-i-familien" ] ] , div [] [ a [ href "https://github.com/navikt/omsorgsdager-kalkulator" ] [ text "omsorgsdager-kalkulator" ] ] , div [ class "paddingBottomL" ] [ a [ href "https://github.com/navikt/omsorgspengerutbetaling-arbeidstaker-soknad" ] [ text "arbeidstaker" ] ] ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "NAV - Arbeids- og velferdsetaten" ] , infoText "May 2018 - December 2019" , infoText "Team <NAME>" , collapse ( collapseId2, model.collapseTransitions ) [ class "marginTopS" ] [ info [] "SHORT INTRODUCTION" [ text "Application form for financial assistance. React frontend and Java backend. Users can log in with Idporten. Each submitted application is validated and transmitted to the correct municipality based on the user’s current andress." ] , info [ class "marginTopM" ] "TECHNOLOGIES" [ text "React, Typescript, Redux, Java, Docker, nais.io, Kubernetes" ] , descriptionHeader [ class "marginTopM" ] "OPEN SOURCE REPOSITORIES" , div [] [ a [ href "https://github.com/navikt/sosialhjelp-soknad" ] [ text "sosialhjelp-soknad" ] ] , div [] [ a [ href "https://github.com/navikt/sosialhjelp-innsyn" ] [ text "sosialhjelp-innsyn" ] ] , div [ class "paddingBottomL" ] [ a [ href "https://github.com/navikt/sosialhjelp-woldena-tm" ] [ text "sosialhjelp-woldena-tm" ] ] ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "<NAME>" ] , infoText "January 2018 - March 2018" , infoText "<NAME> <NAME>" , collapse ( collapseId3, model.collapseTransitions ) [ class "marginTopS" ] [ info [] "SHORT INTRODUCTION" [ text "Collection and aggregation of traffic data along the Norwegian road network." ] , info [ class "marginTopM" ] "TECHNOLOGIES" [ text "React, Java, AngularJS, Akka, Elasticsearch" ] ] ] ] ] ] , div [] [ div [ class "workplace-title" ] [ text "August 2012 - December 2017" ] , info [ class "marginTopM" ] "COMPANY" [ text "FMC Technologies (TechnipFMC)" ] , div [ class "marginTopM marginBottomS" ] [ descriptionHeader [] "PROJECTS / POSITIONS" ] , div [] [ div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "NGA - Next Generation Automation" ] , infoText "January 2016 - December 2017" , infoText "Project Engineer" , info [ class "marginTopM" ] "SHORT INTRODUCTION" [ text "Engineering and prototyping of new subsea electronic module" ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "WAMS - Well Access Monitoring Systems" ] , infoText "May 2014 - December 2017" , infoText "Product engineer" , info [ class "marginTopM" ] "SHORT INTRODUCTION" [ text "Responsible for specifying Inclinometers and Strain Gauges procured from subsuplier, and calibration of sensors after installation onto riser joints. Travel to site locations for performing calibration tests." ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "Controls and Distribution" ] , infoText "May 2014 - December 2015" , infoText "Project Engineer" , info [ class "marginTopM" ] "SHORT INTRODUCTION" [ text "Project engineer for instrumentation on various projects, for example Snorre B" ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "Graduate Engineering Program" ] , infoText "August 2012 - July 2014" , infoText "Trainee" ] ] ] ] , div [] [ div [ class "workplace-title" ] [ text "August 2007 - July 2012" ] , info [ class "marginTopM" ] "UNIVERSITY" [ text "NTNU (Norwegian University of Science and Technology)" ] , info [ class "marginTopM" ] "PROGRAMME" [ text "Mechanical Engineering" ] , info [ class "marginTopM" ] "MAIN PROFILE" [ text "Energy, Process and Fluids Engineering" ] , info [ class "marginTopM" ] "DESCRIPTION" [ text "Specialized in fluid mechanics and multiphase flow. Master's Thesis working for the Multiphase Flow Lab at KAIST (Korea Advanced Institute of Science and Technology)" ] , info [ class "marginTopM" ] "THESIS" [ a [ rel "noreferrer noopener", target "_blank", href "https://ntnuopen.ntnu.no/ntnu-xmlui/bitstream/handle/11250/234896/566557_FULLTEXT01.pdf?sequence=2" ] [ text "Evaluation of Split Ratio for Plug Flow at a Meso-Scale T-Junction" ] ] ] ] ]
true
module Cv2 exposing (..) import Components.CollapseTransition.Collapse exposing (collapse) import Html exposing (Attribute, Html, a, div, text) import Html.Attributes exposing (class, href, rel, target) import Messages exposing (Msg) import Model exposing (Model, collapseId1, collapseId2, collapseId3) import String exposing (fromInt) import Svg import Svg.Attributes as SvgA largeCircleColor = "#CED4DA" circle : Int -> String -> Html Msg circle radius color = let radiuseString = fromInt radius diameterString = radius * 2 |> fromInt in Svg.svg [ SvgA.width diameterString , SvgA.height diameterString , SvgA.viewBox <| "0 0 " ++ diameterString ++ " " ++ diameterString ] [ Svg.circle [ SvgA.cx radiuseString , SvgA.cy radiuseString , SvgA.r radiuseString , SvgA.fill color ] [] ] largeCircle = circle 10 largeCircleColor smallCircle = circle 7 largeCircleColor descriptionHeader : List (Attribute Msg) -> String -> Html Msg descriptionHeader attributes content = div ([ class "description marginBottomXXS" ] ++ attributes) [ text content ] info : List (Attribute Msg) -> String -> List (Html Msg) -> Html Msg info attributes description content = div attributes [ descriptionHeader [] description , div [ class "large-text p" ] content ] infoText : String -> Html Msg infoText content = div [ class "large-text" ] [ text content ] workPlaces : List (Attribute Msg) -> List (Html Msg) -> Html Msg workPlaces attributes workplaces = workplaces |> List.map (\wp -> div [ class "cv-content-wrapper marginTopL" ] [ div [ class "left" ] [ largeCircle ], div [ class "right" ] [ wp ] ]) |> div [] cv : Model -> Html Msg cv model = div [] [ div [ class "titleXXL" ] [ text "CV" ] , workPlaces [] [ div [] [ div [ class "workplace-title" ] [ text "January 2018 - now" ] , info [ class "marginTopM" ] "COMPANY" [ text "PI:NAME:<NAME>END_PI" ] , info [ class "marginTopM" ] "POSITION" [ text "Senior software developer" ] , div [ class "marginTopM marginBottomS" ] [ descriptionHeader [] "PROJECTS" ] , div [] [ div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "NAV - Arbeids- og velferdsetaten" ] , infoText "January 2020 - now" , infoText "Team Sykdom i familien" , collapse ( collapseId1, model.collapseTransitions ) [ class "marginTopS" ] [ info [] "SHORT INTRODUCTION" [ text "Different application forms in some way related to attendance allowance. Several react based application forms, and Kotlin based backends. Application form data is validated before it is put on a Kafka topic ready to be evaluated." ] , info [ class "marginTopM" ] "TECHNOLOGIES" [ text "React, Typescript, Formik, Gatsby, Sanity, Kotlin, Kafka, Docker, Nais (nais.io, built on Kubernetes)" ] , descriptionHeader [ class "marginTopM" ] "OPEN SOURCE REPOSITORIES" , div [] [ a [ href "https://github.com/navikt/sykdom-i-familien" ] [ text "sykdom-i-familien" ] ] , div [] [ a [ href "https://github.com/navikt/omsorgsdager-kalkulator" ] [ text "omsorgsdager-kalkulator" ] ] , div [ class "paddingBottomL" ] [ a [ href "https://github.com/navikt/omsorgspengerutbetaling-arbeidstaker-soknad" ] [ text "arbeidstaker" ] ] ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "NAV - Arbeids- og velferdsetaten" ] , infoText "May 2018 - December 2019" , infoText "Team PI:NAME:<NAME>END_PI" , collapse ( collapseId2, model.collapseTransitions ) [ class "marginTopS" ] [ info [] "SHORT INTRODUCTION" [ text "Application form for financial assistance. React frontend and Java backend. Users can log in with Idporten. Each submitted application is validated and transmitted to the correct municipality based on the user’s current andress." ] , info [ class "marginTopM" ] "TECHNOLOGIES" [ text "React, Typescript, Redux, Java, Docker, nais.io, Kubernetes" ] , descriptionHeader [ class "marginTopM" ] "OPEN SOURCE REPOSITORIES" , div [] [ a [ href "https://github.com/navikt/sosialhjelp-soknad" ] [ text "sosialhjelp-soknad" ] ] , div [] [ a [ href "https://github.com/navikt/sosialhjelp-innsyn" ] [ text "sosialhjelp-innsyn" ] ] , div [ class "paddingBottomL" ] [ a [ href "https://github.com/navikt/sosialhjelp-woldena-tm" ] [ text "sosialhjelp-woldena-tm" ] ] ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "PI:NAME:<NAME>END_PI" ] , infoText "January 2018 - March 2018" , infoText "PI:NAME:<NAME>END_PI PI:NAME:<NAME>END_PI" , collapse ( collapseId3, model.collapseTransitions ) [ class "marginTopS" ] [ info [] "SHORT INTRODUCTION" [ text "Collection and aggregation of traffic data along the Norwegian road network." ] , info [ class "marginTopM" ] "TECHNOLOGIES" [ text "React, Java, AngularJS, Akka, Elasticsearch" ] ] ] ] ] ] , div [] [ div [ class "workplace-title" ] [ text "August 2012 - December 2017" ] , info [ class "marginTopM" ] "COMPANY" [ text "FMC Technologies (TechnipFMC)" ] , div [ class "marginTopM marginBottomS" ] [ descriptionHeader [] "PROJECTS / POSITIONS" ] , div [] [ div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "NGA - Next Generation Automation" ] , infoText "January 2016 - December 2017" , infoText "Project Engineer" , info [ class "marginTopM" ] "SHORT INTRODUCTION" [ text "Engineering and prototyping of new subsea electronic module" ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "WAMS - Well Access Monitoring Systems" ] , infoText "May 2014 - December 2017" , infoText "Product engineer" , info [ class "marginTopM" ] "SHORT INTRODUCTION" [ text "Responsible for specifying Inclinometers and Strain Gauges procured from subsuplier, and calibration of sensors after installation onto riser joints. Travel to site locations for performing calibration tests." ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "Controls and Distribution" ] , infoText "May 2014 - December 2015" , infoText "Project Engineer" , info [ class "marginTopM" ] "SHORT INTRODUCTION" [ text "Project engineer for instrumentation on various projects, for example Snorre B" ] ] ] , div [ class "cv-project-wrapper marginBottomXL" ] [ div [ class "left" ] [ smallCircle ] , div [] [ div [] [ text "Graduate Engineering Program" ] , infoText "August 2012 - July 2014" , infoText "Trainee" ] ] ] ] , div [] [ div [ class "workplace-title" ] [ text "August 2007 - July 2012" ] , info [ class "marginTopM" ] "UNIVERSITY" [ text "NTNU (Norwegian University of Science and Technology)" ] , info [ class "marginTopM" ] "PROGRAMME" [ text "Mechanical Engineering" ] , info [ class "marginTopM" ] "MAIN PROFILE" [ text "Energy, Process and Fluids Engineering" ] , info [ class "marginTopM" ] "DESCRIPTION" [ text "Specialized in fluid mechanics and multiphase flow. Master's Thesis working for the Multiphase Flow Lab at KAIST (Korea Advanced Institute of Science and Technology)" ] , info [ class "marginTopM" ] "THESIS" [ a [ rel "noreferrer noopener", target "_blank", href "https://ntnuopen.ntnu.no/ntnu-xmlui/bitstream/handle/11250/234896/566557_FULLTEXT01.pdf?sequence=2" ] [ text "Evaluation of Split Ratio for Plug Flow at a Meso-Scale T-Junction" ] ] ] ] ]
elm
[ { "context": " , sourceCode = Just \"https://github.com/material-components/material-components-web/tree/master/packages/mdc-", "end": 2049, "score": 0.9116443396, "start": 2039, "tag": "USERNAME", "value": "components" }, { "context": " let\n label =\n \"Eclair\"\n\n selected =\n ", "end": 8421, "score": 0.8346021175, "start": 8415, "tag": "NAME", "value": "Eclair" } ]
demo/src/Demo/DataTable.elm
SwiftEngineer/material-components-web-elm
1
module Demo.DataTable exposing (Model, Msg, defaultModel, update, view) import Demo.CatalogPage exposing (CatalogPage) import Demo.Helper.ResourceLink as ResourceLink import Html exposing (Html, text) import Html.Attributes import Material.Button exposing (ButtonConfig, buttonConfig, outlinedButton, raisedButton, textButton, unelevatedButton) import Material.Checkbox as Checkbox exposing (checkboxConfig) import Material.DataTable exposing (dataTable, dataTableCell, dataTableCellConfig, dataTableConfig, dataTableHeaderCell, dataTableHeaderCellConfig, dataTableHeaderRow, dataTableHeaderRowCheckbox, dataTableRow, dataTableRowCheckbox, dataTableRowConfig) import Material.Typography as Typography import Set exposing (Set) type alias Model = { selected : Set String } defaultModel : Model defaultModel = { selected = Set.empty } type Msg = NoOp | ItemSelected String | AllSelected | AllUnselected update : Msg -> Model -> Model update msg model = case msg of NoOp -> model ItemSelected key -> { model | selected = if Set.member key model.selected then Set.remove key model.selected else Set.insert key model.selected } AllSelected -> { model | selected = Set.fromList [ "Frozen yogurt", "Ice cream sandwich", "Eclair" ] } AllUnselected -> { model | selected = Set.empty } view : Model -> CatalogPage Msg view model = { title = "Data Table" , prelude = "Data tables display information in a way that’s easy to scan, so that users can look for patterns and insights." , resources = { materialDesignGuidelines = Just "https://material.io/go/design-data-tables" , documentation = Just "https://material.io/components/web/catalog/data-tables/" , sourceCode = Just "https://github.com/material-components/material-components-web/tree/master/packages/mdc-data-table" } , hero = heroDataTable , content = [ Html.h3 [ Typography.subtitle1 ] [ text "Data Table Standard" ] , standardDataTable , Html.h3 [ Typography.subtitle1 ] [ text "Data Table with Row Selection" ] , dataTableWithRowSelection model ] } heroDataTable : List (Html msg) heroDataTable = [ standardDataTable ] standardDataTable : Html msg standardDataTable = dataTable dataTableConfig { thead = [ dataTableHeaderRow [] [ dataTableHeaderCell dataTableHeaderCellConfig [ text "Desert" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Carbs (g)" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Protein (g)" ] , dataTableHeaderCell dataTableHeaderCellConfig [ text "Comments" ] ] ] , tbody = [ dataTableRow dataTableRowConfig [ dataTableCell dataTableCellConfig [ text "Frozen yogurt" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.0" ] , dataTableCell dataTableCellConfig [ text "Super tasty" ] ] , dataTableRow dataTableRowConfig [ dataTableCell dataTableCellConfig [ text "Ice cream sandwich" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "37" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.33333333333" ] , dataTableCell dataTableCellConfig [ text "I like ice cream more" ] ] , dataTableRow dataTableRowConfig [ dataTableCell dataTableCellConfig [ text "Eclair" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "6.0" ] , dataTableCell dataTableCellConfig [ text "New filing flavor" ] ] ] } dataTableWithRowSelection : Model -> Html Msg dataTableWithRowSelection model = let allSelected = Set.size model.selected == 3 allUnselected = Set.size model.selected == 0 in dataTable dataTableConfig { thead = [ dataTableHeaderRow [] [ dataTableHeaderCell { dataTableHeaderCellConfig | checkbox = True } [ dataTableHeaderRowCheckbox { checkboxConfig | state = if allSelected then Checkbox.Checked else if allUnselected then Checkbox.Unchecked else Checkbox.Indeterminate , onChange = Just (if allSelected then AllUnselected else AllSelected ) } ] , dataTableHeaderCell dataTableHeaderCellConfig [ text "Desert" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Carbs (g)" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Protein (g)" ] , dataTableHeaderCell dataTableHeaderCellConfig [ text "Comments" ] ] ] , tbody = [ let label = "Frozen yogurt" selected = Set.member label model.selected in dataTableRow { dataTableRowConfig | selected = selected } [ dataTableCell { dataTableCellConfig | checkbox = True } [ dataTableRowCheckbox { checkboxConfig | state = if selected then Checkbox.Checked else Checkbox.Unchecked , onChange = Just (ItemSelected label) } ] , dataTableCell dataTableCellConfig [ text label ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.0" ] , dataTableCell dataTableCellConfig [ text "Super tasty" ] ] , let label = "Ice cream sandwich" selected = Set.member label model.selected in dataTableRow { dataTableRowConfig | selected = selected } [ dataTableCell { dataTableCellConfig | checkbox = True } [ dataTableRowCheckbox { checkboxConfig | state = if selected then Checkbox.Checked else Checkbox.Unchecked , onChange = Just (ItemSelected label) } ] , dataTableCell dataTableCellConfig [ text label ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "37" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.33333333333" ] , dataTableCell dataTableCellConfig [ text "I like ice cream more" ] ] , let label = "Eclair" selected = Set.member label model.selected in dataTableRow { dataTableRowConfig | selected = selected } [ dataTableCell { dataTableCellConfig | checkbox = True } [ dataTableRowCheckbox { checkboxConfig | state = if selected then Checkbox.Checked else Checkbox.Unchecked , onChange = Just (ItemSelected label) } ] , dataTableCell dataTableCellConfig [ text label ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "6.0" ] , dataTableCell dataTableCellConfig [ text "New filing flavor" ] ] ] }
36387
module Demo.DataTable exposing (Model, Msg, defaultModel, update, view) import Demo.CatalogPage exposing (CatalogPage) import Demo.Helper.ResourceLink as ResourceLink import Html exposing (Html, text) import Html.Attributes import Material.Button exposing (ButtonConfig, buttonConfig, outlinedButton, raisedButton, textButton, unelevatedButton) import Material.Checkbox as Checkbox exposing (checkboxConfig) import Material.DataTable exposing (dataTable, dataTableCell, dataTableCellConfig, dataTableConfig, dataTableHeaderCell, dataTableHeaderCellConfig, dataTableHeaderRow, dataTableHeaderRowCheckbox, dataTableRow, dataTableRowCheckbox, dataTableRowConfig) import Material.Typography as Typography import Set exposing (Set) type alias Model = { selected : Set String } defaultModel : Model defaultModel = { selected = Set.empty } type Msg = NoOp | ItemSelected String | AllSelected | AllUnselected update : Msg -> Model -> Model update msg model = case msg of NoOp -> model ItemSelected key -> { model | selected = if Set.member key model.selected then Set.remove key model.selected else Set.insert key model.selected } AllSelected -> { model | selected = Set.fromList [ "Frozen yogurt", "Ice cream sandwich", "Eclair" ] } AllUnselected -> { model | selected = Set.empty } view : Model -> CatalogPage Msg view model = { title = "Data Table" , prelude = "Data tables display information in a way that’s easy to scan, so that users can look for patterns and insights." , resources = { materialDesignGuidelines = Just "https://material.io/go/design-data-tables" , documentation = Just "https://material.io/components/web/catalog/data-tables/" , sourceCode = Just "https://github.com/material-components/material-components-web/tree/master/packages/mdc-data-table" } , hero = heroDataTable , content = [ Html.h3 [ Typography.subtitle1 ] [ text "Data Table Standard" ] , standardDataTable , Html.h3 [ Typography.subtitle1 ] [ text "Data Table with Row Selection" ] , dataTableWithRowSelection model ] } heroDataTable : List (Html msg) heroDataTable = [ standardDataTable ] standardDataTable : Html msg standardDataTable = dataTable dataTableConfig { thead = [ dataTableHeaderRow [] [ dataTableHeaderCell dataTableHeaderCellConfig [ text "Desert" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Carbs (g)" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Protein (g)" ] , dataTableHeaderCell dataTableHeaderCellConfig [ text "Comments" ] ] ] , tbody = [ dataTableRow dataTableRowConfig [ dataTableCell dataTableCellConfig [ text "Frozen yogurt" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.0" ] , dataTableCell dataTableCellConfig [ text "Super tasty" ] ] , dataTableRow dataTableRowConfig [ dataTableCell dataTableCellConfig [ text "Ice cream sandwich" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "37" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.33333333333" ] , dataTableCell dataTableCellConfig [ text "I like ice cream more" ] ] , dataTableRow dataTableRowConfig [ dataTableCell dataTableCellConfig [ text "Eclair" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "6.0" ] , dataTableCell dataTableCellConfig [ text "New filing flavor" ] ] ] } dataTableWithRowSelection : Model -> Html Msg dataTableWithRowSelection model = let allSelected = Set.size model.selected == 3 allUnselected = Set.size model.selected == 0 in dataTable dataTableConfig { thead = [ dataTableHeaderRow [] [ dataTableHeaderCell { dataTableHeaderCellConfig | checkbox = True } [ dataTableHeaderRowCheckbox { checkboxConfig | state = if allSelected then Checkbox.Checked else if allUnselected then Checkbox.Unchecked else Checkbox.Indeterminate , onChange = Just (if allSelected then AllUnselected else AllSelected ) } ] , dataTableHeaderCell dataTableHeaderCellConfig [ text "Desert" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Carbs (g)" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Protein (g)" ] , dataTableHeaderCell dataTableHeaderCellConfig [ text "Comments" ] ] ] , tbody = [ let label = "Frozen yogurt" selected = Set.member label model.selected in dataTableRow { dataTableRowConfig | selected = selected } [ dataTableCell { dataTableCellConfig | checkbox = True } [ dataTableRowCheckbox { checkboxConfig | state = if selected then Checkbox.Checked else Checkbox.Unchecked , onChange = Just (ItemSelected label) } ] , dataTableCell dataTableCellConfig [ text label ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.0" ] , dataTableCell dataTableCellConfig [ text "Super tasty" ] ] , let label = "Ice cream sandwich" selected = Set.member label model.selected in dataTableRow { dataTableRowConfig | selected = selected } [ dataTableCell { dataTableCellConfig | checkbox = True } [ dataTableRowCheckbox { checkboxConfig | state = if selected then Checkbox.Checked else Checkbox.Unchecked , onChange = Just (ItemSelected label) } ] , dataTableCell dataTableCellConfig [ text label ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "37" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.33333333333" ] , dataTableCell dataTableCellConfig [ text "I like ice cream more" ] ] , let label = "<NAME>" selected = Set.member label model.selected in dataTableRow { dataTableRowConfig | selected = selected } [ dataTableCell { dataTableCellConfig | checkbox = True } [ dataTableRowCheckbox { checkboxConfig | state = if selected then Checkbox.Checked else Checkbox.Unchecked , onChange = Just (ItemSelected label) } ] , dataTableCell dataTableCellConfig [ text label ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "6.0" ] , dataTableCell dataTableCellConfig [ text "New filing flavor" ] ] ] }
true
module Demo.DataTable exposing (Model, Msg, defaultModel, update, view) import Demo.CatalogPage exposing (CatalogPage) import Demo.Helper.ResourceLink as ResourceLink import Html exposing (Html, text) import Html.Attributes import Material.Button exposing (ButtonConfig, buttonConfig, outlinedButton, raisedButton, textButton, unelevatedButton) import Material.Checkbox as Checkbox exposing (checkboxConfig) import Material.DataTable exposing (dataTable, dataTableCell, dataTableCellConfig, dataTableConfig, dataTableHeaderCell, dataTableHeaderCellConfig, dataTableHeaderRow, dataTableHeaderRowCheckbox, dataTableRow, dataTableRowCheckbox, dataTableRowConfig) import Material.Typography as Typography import Set exposing (Set) type alias Model = { selected : Set String } defaultModel : Model defaultModel = { selected = Set.empty } type Msg = NoOp | ItemSelected String | AllSelected | AllUnselected update : Msg -> Model -> Model update msg model = case msg of NoOp -> model ItemSelected key -> { model | selected = if Set.member key model.selected then Set.remove key model.selected else Set.insert key model.selected } AllSelected -> { model | selected = Set.fromList [ "Frozen yogurt", "Ice cream sandwich", "Eclair" ] } AllUnselected -> { model | selected = Set.empty } view : Model -> CatalogPage Msg view model = { title = "Data Table" , prelude = "Data tables display information in a way that’s easy to scan, so that users can look for patterns and insights." , resources = { materialDesignGuidelines = Just "https://material.io/go/design-data-tables" , documentation = Just "https://material.io/components/web/catalog/data-tables/" , sourceCode = Just "https://github.com/material-components/material-components-web/tree/master/packages/mdc-data-table" } , hero = heroDataTable , content = [ Html.h3 [ Typography.subtitle1 ] [ text "Data Table Standard" ] , standardDataTable , Html.h3 [ Typography.subtitle1 ] [ text "Data Table with Row Selection" ] , dataTableWithRowSelection model ] } heroDataTable : List (Html msg) heroDataTable = [ standardDataTable ] standardDataTable : Html msg standardDataTable = dataTable dataTableConfig { thead = [ dataTableHeaderRow [] [ dataTableHeaderCell dataTableHeaderCellConfig [ text "Desert" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Carbs (g)" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Protein (g)" ] , dataTableHeaderCell dataTableHeaderCellConfig [ text "Comments" ] ] ] , tbody = [ dataTableRow dataTableRowConfig [ dataTableCell dataTableCellConfig [ text "Frozen yogurt" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.0" ] , dataTableCell dataTableCellConfig [ text "Super tasty" ] ] , dataTableRow dataTableRowConfig [ dataTableCell dataTableCellConfig [ text "Ice cream sandwich" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "37" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.33333333333" ] , dataTableCell dataTableCellConfig [ text "I like ice cream more" ] ] , dataTableRow dataTableRowConfig [ dataTableCell dataTableCellConfig [ text "Eclair" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "6.0" ] , dataTableCell dataTableCellConfig [ text "New filing flavor" ] ] ] } dataTableWithRowSelection : Model -> Html Msg dataTableWithRowSelection model = let allSelected = Set.size model.selected == 3 allUnselected = Set.size model.selected == 0 in dataTable dataTableConfig { thead = [ dataTableHeaderRow [] [ dataTableHeaderCell { dataTableHeaderCellConfig | checkbox = True } [ dataTableHeaderRowCheckbox { checkboxConfig | state = if allSelected then Checkbox.Checked else if allUnselected then Checkbox.Unchecked else Checkbox.Indeterminate , onChange = Just (if allSelected then AllUnselected else AllSelected ) } ] , dataTableHeaderCell dataTableHeaderCellConfig [ text "Desert" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Carbs (g)" ] , dataTableHeaderCell { dataTableHeaderCellConfig | numeric = True } [ text "Protein (g)" ] , dataTableHeaderCell dataTableHeaderCellConfig [ text "Comments" ] ] ] , tbody = [ let label = "Frozen yogurt" selected = Set.member label model.selected in dataTableRow { dataTableRowConfig | selected = selected } [ dataTableCell { dataTableCellConfig | checkbox = True } [ dataTableRowCheckbox { checkboxConfig | state = if selected then Checkbox.Checked else Checkbox.Unchecked , onChange = Just (ItemSelected label) } ] , dataTableCell dataTableCellConfig [ text label ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.0" ] , dataTableCell dataTableCellConfig [ text "Super tasty" ] ] , let label = "Ice cream sandwich" selected = Set.member label model.selected in dataTableRow { dataTableRowConfig | selected = selected } [ dataTableCell { dataTableCellConfig | checkbox = True } [ dataTableRowCheckbox { checkboxConfig | state = if selected then Checkbox.Checked else Checkbox.Unchecked , onChange = Just (ItemSelected label) } ] , dataTableCell dataTableCellConfig [ text label ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "37" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "4.33333333333" ] , dataTableCell dataTableCellConfig [ text "I like ice cream more" ] ] , let label = "PI:NAME:<NAME>END_PI" selected = Set.member label model.selected in dataTableRow { dataTableRowConfig | selected = selected } [ dataTableCell { dataTableCellConfig | checkbox = True } [ dataTableRowCheckbox { checkboxConfig | state = if selected then Checkbox.Checked else Checkbox.Unchecked , onChange = Just (ItemSelected label) } ] , dataTableCell dataTableCellConfig [ text label ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "24" ] , dataTableCell { dataTableCellConfig | numeric = True } [ text "6.0" ] , dataTableCell dataTableCellConfig [ text "New filing flavor" ] ] ] }
elm
[ { "context": "{ initialField | visible = True }\n , password = initialField\n , userId = Nothing\n , loading = False\n ", "end": 941, "score": 0.9981839657, "start": 929, "tag": "PASSWORD", "value": "initialField" } ]
src/EasyLogin/Model.elm
infertux/easy-login
3
module EasyLogin.Model exposing (..) import Http exposing (Error) import JsonApi exposing (Document) type Msg = Input FieldId String | LogIn | LogInResult (Result Http.Error Document) | SendPassword type FieldId = Email | Password type alias Model = { email : Field , password : Field , userId : Maybe String , loading : Bool , settings : Settings } type alias Settings = { loginPath : String , lostPasswordPath : String } type alias Field = { value : String , visible : Bool , error : Maybe String } initialField : Field initialField = { value = "" , visible = False , error = Nothing } initialSettings : Settings initialSettings = { loginPath = "/api/sessions" , lostPasswordPath = "/api/lost-password" } initialModel : Model initialModel = { email = { initialField | visible = True } , password = initialField , userId = Nothing , loading = False , settings = initialSettings }
23652
module EasyLogin.Model exposing (..) import Http exposing (Error) import JsonApi exposing (Document) type Msg = Input FieldId String | LogIn | LogInResult (Result Http.Error Document) | SendPassword type FieldId = Email | Password type alias Model = { email : Field , password : Field , userId : Maybe String , loading : Bool , settings : Settings } type alias Settings = { loginPath : String , lostPasswordPath : String } type alias Field = { value : String , visible : Bool , error : Maybe String } initialField : Field initialField = { value = "" , visible = False , error = Nothing } initialSettings : Settings initialSettings = { loginPath = "/api/sessions" , lostPasswordPath = "/api/lost-password" } initialModel : Model initialModel = { email = { initialField | visible = True } , password = <PASSWORD> , userId = Nothing , loading = False , settings = initialSettings }
true
module EasyLogin.Model exposing (..) import Http exposing (Error) import JsonApi exposing (Document) type Msg = Input FieldId String | LogIn | LogInResult (Result Http.Error Document) | SendPassword type FieldId = Email | Password type alias Model = { email : Field , password : Field , userId : Maybe String , loading : Bool , settings : Settings } type alias Settings = { loginPath : String , lostPasswordPath : String } type alias Field = { value : String , visible : Bool , error : Maybe String } initialField : Field initialField = { value = "" , visible = False , error = Nothing } initialSettings : Settings initialSettings = { loginPath = "/api/sessions" , lostPasswordPath = "/api/lost-password" } initialModel : Model initialModel = { email = { initialField | visible = True } , password = PI:PASSWORD:<PASSWORD>END_PI , userId = Nothing , loading = False , settings = initialSettings }
elm
[ { "context": " Elmer.some <| \n hasBody \"{\\\"name\\\":\\\"Fun Person\\\"}\"\n )\n\n-}\nhasBody : String -> Matcher HttpReq", "end": 1586, "score": 0.6800584793, "start": 1576, "tag": "NAME", "value": "Fun Person" }, { "context": " Elmer.some <| \n hasQueryParam ( \"name\", \"Fun Person\" )\n )\n\n-}\nhasQueryParam : ( String, String ) -", "end": 2321, "score": 0.7421159744, "start": 2311, "tag": "USERNAME", "value": "Fun Person" } ]
src/Elmer/Http/Matchers.elm
brian-watkins/elmer-http
0
module Elmer.Http.Matchers exposing ( wasRequested , hasBody , hasQueryParam , hasHeader ) {-| Make expectations about Http requests sent by the component under test. These matchers should be used with `Elmer.Http.expect`. Note: Your test must use `Elmer.Http.serve` or `Elmer.Http.spy` at the appropriate time to allow Elmer to record the requests sent by the component under test. # Matchers @docs wasRequested, hasBody, hasQueryParam, hasHeader -} import Expect import Url.Builder as Builder import Elmer exposing (Matcher) import Elmer.Http.Request exposing (HttpRequest) import Elmer.Http.Routable as Routable import Elmer.Message exposing (..) {-| Expect that exactly some number of requests have been recorded. Elmer.Http.expect (Elmer.Http.Route.get "http://fun.com/fun.html") ( wasRequested 3 ) -} wasRequested : Int -> Matcher (List HttpRequest) wasRequested times = \requests -> if List.length requests == times then Expect.pass else Expect.fail <| "Expected " ++ (String.fromInt times) ++ " " ++ (pluralize "request" times) ++ ", but recorded " ++ (String.fromInt <| List.length requests) ++ " " ++ (pluralize "request" (List.length requests)) pluralize : String -> Int -> String pluralize word num = if num > 1 || num == 0 then word ++ "s" else word {-| Match a request with the specified body. Elmer.Http.expect (Elmer.Http.Route.post "http://fake.com/fake") ( Elmer.some <| hasBody "{\"name\":\"Fun Person\"}" ) -} hasBody : String -> Matcher HttpRequest hasBody expectedBody = \request -> case request.body of Just body -> if body == expectedBody then Expect.pass else Expect.fail (format [ fact "Expected request to have body" expectedBody, fact "but it has" body ]) Nothing -> Expect.fail (format [ fact "Expected request to have body" expectedBody, note "but it has no body" ]) {-| Match a request that has a query string containing the specified name and value. Note: You don't need to worry about url encoding the name or value. Elmer.Http.expect (Elmer.Http.Route.get "http://fake.com/fake") ( Elmer.some <| hasQueryParam ( "name", "Fun Person" ) ) -} hasQueryParam : ( String, String ) -> Matcher HttpRequest hasQueryParam ( key, value ) = \request -> let query = queryString request params = String.split "&" query expectedParam = Builder.toQuery [ Builder.string key value ] |> String.dropLeft 1 in if String.isEmpty query then Expect.fail (format [ fact "Expected request to have query param" ( key ++ " = " ++ value), note "but it has no query string" ]) else if List.member expectedParam params then Expect.pass else Expect.fail (format [ fact "Expected request to have query param" ( key ++ " = " ++ value), fact "but it has" query ]) queryString : HttpRequest -> String queryString request = Routable.queryString request |> Maybe.withDefault "" {-| Match a request with the specified header name and value. Elmer.Http.expect (Elmer.Http.Route.get "http://fake.com/fake") ( Elmer.some <| hasHeader ( "x-auth-token", "xxxxx" ) ) -} hasHeader : ( String, String ) -> Matcher HttpRequest hasHeader ( name, value ) = \request -> if List.isEmpty request.headers then Expect.fail (format [ fact "Expected request to have header" (name ++ " = " ++ value), note "but no headers have been set" ]) else let filteredHeaders = List.filter (\h -> h.name == name && h.value == value) request.headers in if List.isEmpty filteredHeaders then let headers = String.join "\n" (List.map (\h -> h.name ++ " = " ++ h.value) request.headers) in Expect.fail (format [ fact "Expected request to have header" (name ++ " = " ++ value), fact "but it has" headers]) else Expect.pass
31199
module Elmer.Http.Matchers exposing ( wasRequested , hasBody , hasQueryParam , hasHeader ) {-| Make expectations about Http requests sent by the component under test. These matchers should be used with `Elmer.Http.expect`. Note: Your test must use `Elmer.Http.serve` or `Elmer.Http.spy` at the appropriate time to allow Elmer to record the requests sent by the component under test. # Matchers @docs wasRequested, hasBody, hasQueryParam, hasHeader -} import Expect import Url.Builder as Builder import Elmer exposing (Matcher) import Elmer.Http.Request exposing (HttpRequest) import Elmer.Http.Routable as Routable import Elmer.Message exposing (..) {-| Expect that exactly some number of requests have been recorded. Elmer.Http.expect (Elmer.Http.Route.get "http://fun.com/fun.html") ( wasRequested 3 ) -} wasRequested : Int -> Matcher (List HttpRequest) wasRequested times = \requests -> if List.length requests == times then Expect.pass else Expect.fail <| "Expected " ++ (String.fromInt times) ++ " " ++ (pluralize "request" times) ++ ", but recorded " ++ (String.fromInt <| List.length requests) ++ " " ++ (pluralize "request" (List.length requests)) pluralize : String -> Int -> String pluralize word num = if num > 1 || num == 0 then word ++ "s" else word {-| Match a request with the specified body. Elmer.Http.expect (Elmer.Http.Route.post "http://fake.com/fake") ( Elmer.some <| hasBody "{\"name\":\"<NAME>\"}" ) -} hasBody : String -> Matcher HttpRequest hasBody expectedBody = \request -> case request.body of Just body -> if body == expectedBody then Expect.pass else Expect.fail (format [ fact "Expected request to have body" expectedBody, fact "but it has" body ]) Nothing -> Expect.fail (format [ fact "Expected request to have body" expectedBody, note "but it has no body" ]) {-| Match a request that has a query string containing the specified name and value. Note: You don't need to worry about url encoding the name or value. Elmer.Http.expect (Elmer.Http.Route.get "http://fake.com/fake") ( Elmer.some <| hasQueryParam ( "name", "Fun Person" ) ) -} hasQueryParam : ( String, String ) -> Matcher HttpRequest hasQueryParam ( key, value ) = \request -> let query = queryString request params = String.split "&" query expectedParam = Builder.toQuery [ Builder.string key value ] |> String.dropLeft 1 in if String.isEmpty query then Expect.fail (format [ fact "Expected request to have query param" ( key ++ " = " ++ value), note "but it has no query string" ]) else if List.member expectedParam params then Expect.pass else Expect.fail (format [ fact "Expected request to have query param" ( key ++ " = " ++ value), fact "but it has" query ]) queryString : HttpRequest -> String queryString request = Routable.queryString request |> Maybe.withDefault "" {-| Match a request with the specified header name and value. Elmer.Http.expect (Elmer.Http.Route.get "http://fake.com/fake") ( Elmer.some <| hasHeader ( "x-auth-token", "xxxxx" ) ) -} hasHeader : ( String, String ) -> Matcher HttpRequest hasHeader ( name, value ) = \request -> if List.isEmpty request.headers then Expect.fail (format [ fact "Expected request to have header" (name ++ " = " ++ value), note "but no headers have been set" ]) else let filteredHeaders = List.filter (\h -> h.name == name && h.value == value) request.headers in if List.isEmpty filteredHeaders then let headers = String.join "\n" (List.map (\h -> h.name ++ " = " ++ h.value) request.headers) in Expect.fail (format [ fact "Expected request to have header" (name ++ " = " ++ value), fact "but it has" headers]) else Expect.pass
true
module Elmer.Http.Matchers exposing ( wasRequested , hasBody , hasQueryParam , hasHeader ) {-| Make expectations about Http requests sent by the component under test. These matchers should be used with `Elmer.Http.expect`. Note: Your test must use `Elmer.Http.serve` or `Elmer.Http.spy` at the appropriate time to allow Elmer to record the requests sent by the component under test. # Matchers @docs wasRequested, hasBody, hasQueryParam, hasHeader -} import Expect import Url.Builder as Builder import Elmer exposing (Matcher) import Elmer.Http.Request exposing (HttpRequest) import Elmer.Http.Routable as Routable import Elmer.Message exposing (..) {-| Expect that exactly some number of requests have been recorded. Elmer.Http.expect (Elmer.Http.Route.get "http://fun.com/fun.html") ( wasRequested 3 ) -} wasRequested : Int -> Matcher (List HttpRequest) wasRequested times = \requests -> if List.length requests == times then Expect.pass else Expect.fail <| "Expected " ++ (String.fromInt times) ++ " " ++ (pluralize "request" times) ++ ", but recorded " ++ (String.fromInt <| List.length requests) ++ " " ++ (pluralize "request" (List.length requests)) pluralize : String -> Int -> String pluralize word num = if num > 1 || num == 0 then word ++ "s" else word {-| Match a request with the specified body. Elmer.Http.expect (Elmer.Http.Route.post "http://fake.com/fake") ( Elmer.some <| hasBody "{\"name\":\"PI:NAME:<NAME>END_PI\"}" ) -} hasBody : String -> Matcher HttpRequest hasBody expectedBody = \request -> case request.body of Just body -> if body == expectedBody then Expect.pass else Expect.fail (format [ fact "Expected request to have body" expectedBody, fact "but it has" body ]) Nothing -> Expect.fail (format [ fact "Expected request to have body" expectedBody, note "but it has no body" ]) {-| Match a request that has a query string containing the specified name and value. Note: You don't need to worry about url encoding the name or value. Elmer.Http.expect (Elmer.Http.Route.get "http://fake.com/fake") ( Elmer.some <| hasQueryParam ( "name", "Fun Person" ) ) -} hasQueryParam : ( String, String ) -> Matcher HttpRequest hasQueryParam ( key, value ) = \request -> let query = queryString request params = String.split "&" query expectedParam = Builder.toQuery [ Builder.string key value ] |> String.dropLeft 1 in if String.isEmpty query then Expect.fail (format [ fact "Expected request to have query param" ( key ++ " = " ++ value), note "but it has no query string" ]) else if List.member expectedParam params then Expect.pass else Expect.fail (format [ fact "Expected request to have query param" ( key ++ " = " ++ value), fact "but it has" query ]) queryString : HttpRequest -> String queryString request = Routable.queryString request |> Maybe.withDefault "" {-| Match a request with the specified header name and value. Elmer.Http.expect (Elmer.Http.Route.get "http://fake.com/fake") ( Elmer.some <| hasHeader ( "x-auth-token", "xxxxx" ) ) -} hasHeader : ( String, String ) -> Matcher HttpRequest hasHeader ( name, value ) = \request -> if List.isEmpty request.headers then Expect.fail (format [ fact "Expected request to have header" (name ++ " = " ++ value), note "but no headers have been set" ]) else let filteredHeaders = List.filter (\h -> h.name == name && h.value == value) request.headers in if List.isEmpty filteredHeaders then let headers = String.join "\n" (List.map (\h -> h.name ++ " = " ++ h.value) request.headers) in Expect.fail (format [ fact "Expected request to have header" (name ++ " = " ++ value), fact "but it has" headers]) else Expect.pass
elm
[ { "context": "ML,JavaScript\">\n-- <meta name=\"author\" content=\"John Doe\">\n-- }\n--\n--\n--\n-- <div>\n-- <a>\n-- <div>\n--", "end": 1139, "score": 0.9998555183, "start": 1131, "tag": "NAME", "value": "John Doe" }, { "context": "ML,JavaScript\">\n-- <meta name=\"author\" content=\"John Doe\">\n-- <meta name=\"viewport\" content=\"width=devic", "end": 1636, "score": 0.9998662472, "start": 1628, "tag": "NAME", "value": "John Doe" } ]
src/BodyBuilder/Internals/Future.elm
elm-review-bot/athlete
38
module Main exposing (..) type Language = English | French type Country = Us | Uk | France type Charset = UTF8 type alias Lang = ( Language, Country ) type alias Html = { head : Maybe Head , body : Maybe Body , lang : Lang } type alias Head = { title : Maybe String , charset : Maybe Charset , description : Maybe String , keywords : List String , author : String , otherMeta : List ( String, String ) } type alias MimeType = String type alias Source = { mime : MimeType , src : Url } type alias Body = { nodes : List Node } type alias Node = {} type alias Caption = Node type alias Thead = Node type alias Tbody = Node type alias Tfoot = Node type alias TableNode = { caption : Maybe Caption , thead : Maybe Thead , tbody : Maybe Tbody , tfoot : Maybe Tfoot } type alias Url = String -- Html -- -- , <meta name="description" content="Free Web tutorials"> -- <meta name="keywords" content="HTML,CSS,XML,JavaScript"> -- <meta name="author" content="John Doe"> -- } -- -- -- -- <div> -- <a> -- <div> -- <a> -- </a> -- </div> -- </a> -- </div> -- -- -- type Node = -- A (List InsideLink) -- -- type InsideLink = -- InsideDiv (List InsideLink) -- -- -- type Html = -- Html Head Body -- -- type Head = -- Head (List InsideHead) -- -- -- <meta charset="UTF-8"> -- <meta name="description" content="Free Web tutorials"> -- <meta name="keywords" content="HTML,CSS,XML,JavaScript"> -- <meta name="author" content="John Doe"> -- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -- -- type InsideHead = -- Title String -- | Meta -- title> (this element is required in an HTML document) -- <style> -- <base> -- <link> -- <meta> -- <script> -- <noscript>
48610
module Main exposing (..) type Language = English | French type Country = Us | Uk | France type Charset = UTF8 type alias Lang = ( Language, Country ) type alias Html = { head : Maybe Head , body : Maybe Body , lang : Lang } type alias Head = { title : Maybe String , charset : Maybe Charset , description : Maybe String , keywords : List String , author : String , otherMeta : List ( String, String ) } type alias MimeType = String type alias Source = { mime : MimeType , src : Url } type alias Body = { nodes : List Node } type alias Node = {} type alias Caption = Node type alias Thead = Node type alias Tbody = Node type alias Tfoot = Node type alias TableNode = { caption : Maybe Caption , thead : Maybe Thead , tbody : Maybe Tbody , tfoot : Maybe Tfoot } type alias Url = String -- Html -- -- , <meta name="description" content="Free Web tutorials"> -- <meta name="keywords" content="HTML,CSS,XML,JavaScript"> -- <meta name="author" content="<NAME>"> -- } -- -- -- -- <div> -- <a> -- <div> -- <a> -- </a> -- </div> -- </a> -- </div> -- -- -- type Node = -- A (List InsideLink) -- -- type InsideLink = -- InsideDiv (List InsideLink) -- -- -- type Html = -- Html Head Body -- -- type Head = -- Head (List InsideHead) -- -- -- <meta charset="UTF-8"> -- <meta name="description" content="Free Web tutorials"> -- <meta name="keywords" content="HTML,CSS,XML,JavaScript"> -- <meta name="author" content="<NAME>"> -- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -- -- type InsideHead = -- Title String -- | Meta -- title> (this element is required in an HTML document) -- <style> -- <base> -- <link> -- <meta> -- <script> -- <noscript>
true
module Main exposing (..) type Language = English | French type Country = Us | Uk | France type Charset = UTF8 type alias Lang = ( Language, Country ) type alias Html = { head : Maybe Head , body : Maybe Body , lang : Lang } type alias Head = { title : Maybe String , charset : Maybe Charset , description : Maybe String , keywords : List String , author : String , otherMeta : List ( String, String ) } type alias MimeType = String type alias Source = { mime : MimeType , src : Url } type alias Body = { nodes : List Node } type alias Node = {} type alias Caption = Node type alias Thead = Node type alias Tbody = Node type alias Tfoot = Node type alias TableNode = { caption : Maybe Caption , thead : Maybe Thead , tbody : Maybe Tbody , tfoot : Maybe Tfoot } type alias Url = String -- Html -- -- , <meta name="description" content="Free Web tutorials"> -- <meta name="keywords" content="HTML,CSS,XML,JavaScript"> -- <meta name="author" content="PI:NAME:<NAME>END_PI"> -- } -- -- -- -- <div> -- <a> -- <div> -- <a> -- </a> -- </div> -- </a> -- </div> -- -- -- type Node = -- A (List InsideLink) -- -- type InsideLink = -- InsideDiv (List InsideLink) -- -- -- type Html = -- Html Head Body -- -- type Head = -- Head (List InsideHead) -- -- -- <meta charset="UTF-8"> -- <meta name="description" content="Free Web tutorials"> -- <meta name="keywords" content="HTML,CSS,XML,JavaScript"> -- <meta name="author" content="PI:NAME:<NAME>END_PI"> -- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -- -- type InsideHead = -- Title String -- | Meta -- title> (this element is required in an HTML document) -- <style> -- <base> -- <link> -- <meta> -- <script> -- <noscript>
elm
[ { "context": "rs: \" ++ facilitatedBy)\n , slideP \"hello@code-reading.org | https://code-reading.org\"\n , sli", "end": 1326, "score": 0.9996876717, "start": 1304, "tag": "EMAIL", "value": "hello@code-reading.org" }, { "context": "rs: \" ++ facilitatedBy)\n , slideP \"hello@code-reading.org | https://code-reading.org\"\n , sli", "end": 2822, "score": 0.9999055862, "start": 2800, "tag": "EMAIL", "value": "hello@code-reading.org" }, { "context": "//code-reading.org\"\n , slideP \"Read Felienne's book! The Programmer's Brain\"\n ", "end": 8048, "score": 0.6012106538, "start": 8047, "tag": "NAME", "value": "F" }, { "context": "oin a club\"\n , slideP \"Get in touch hello@code-reading.org\"\n ]\n )\n ]\n", "end": 8228, "score": 0.9999209046, "start": 8206, "tag": "EMAIL", "value": "hello@code-reading.org" } ]
src/Exercises.elm
katjam/code-reading-runner
0
module Exercises exposing (..) import Html exposing (Html, a, button, div, h1, h2, hr, img, li, p, span, text, ul) import Html.Attributes exposing (class, href, src, style) import Html.Events exposing (onClick) import Markdown import SharedType exposing (AnnotateInfo, CustomContent, CustomSlide, EndInfo, StartInfo) import SliceShow.Content exposing (..) import SliceShow.Slide exposing (..) import Time exposing (Posix) type Section -- Information = SessionStartFirstClub StartInfo | SessionStart StartInfo | WhyDoingThis | SecondThoughts | Reflect | Feedback | SessionEnd EndInfo -- First Look | FirstGlance | Syntax | AnnotateStructure AnnotateInfo | ListNames | RandomLine | ImportantLines | Summarise -- Second Look | RecapStructure (List Int) | CentralThemes | CentralConcepts | DecisionsMade | DecisionsConsequences | DecisionsWhy slideContent : Section -> List ( Bool, List SharedType.CustomContent ) slideContent section = case section of SessionStartFirstClub { facilitatedBy, miroLink, annotationLink, pdfLink } -> [ ( False , [ slideHeading "Code Reading Club" , slideP ("Facilitators: " ++ facilitatedBy) , slideP "hello@code-reading.org | https://code-reading.org" , slideHr , bullets [ bulletLink "Code of conduct" "https://code-reading.org/conduct" , bulletLink "Miro board" miroLink , bulletLink "Code in annotation tool" annotationLink , if String.length pdfLink > 0 then bulletLink "Code pdf to download" pdfLink else item (text "") ] , slideHr , bullets [ bullet "Hello! What is code reading? Why are we all here?" , bullet "Don't look at the code until we start the first exercise" , bullet "I'll keep the exercises & timer posted on my screenshare" , bullet "Join the miro and claim a board" , bullet "Make independent notes on your board" , bullet "After each exercise we'll copy any thoughts we want to share to a shared board" ] , item (h2 [ style "margin-top" "-20px" ] [ text "Any questions before we start?" ]) |> hide ] ) ] SessionStart { facilitatedBy, miroLink, annotationLink, pdfLink } -> [ ( False , [ slideHeading "Code Reading Club" , slideP ("Facilitators: " ++ facilitatedBy) , slideP "hello@code-reading.org | https://code-reading.org" , slideHr , bullets [ bulletLink "Code of conduct" "https://code-reading.org/conduct" , bulletLink "Miro board" miroLink , bulletLink "Code in annotation tool" annotationLink , if String.length pdfLink > 0 then bulletLink "Example annotation" pdfLink else item (text "") ] , slideHr , bullets [ bullet "Grab a copy of the code" , bullet "I'll keep the exercises & timer posted on my screenshare" , bullet "Join the miro and claim a board" , bullet "Make independent notes on your board" , bullet "After each exercise we'll copy any thoughts we want to share to a shared board" ] , item (h2 [ style "margin-top" "-20px" ] [ text "Any questions before we start?" ]) |> hide ] ) ] WhyDoingThis -> [ ( True , [ slideHeading "Why are we doing this?" , slideP "Take a few minutes to talk about your motivation for doing the club. This is important because it will help you support each other and make it more likely that your group will feel that the club sessions have value for them." , container (div []) [ timedHeading "2" "Independently" "Note down one thing" , bullets [ bullet "that you are looking forward to or excited about", bullet "that you are worried or confused about" ] , item (img [ src "example-excited-worried.png", style "height" "250px" ] []) ] |> hide ] ) , ( True , [ slideHeading "Why are we doing this?" , container (div []) [ timedHeading "5" "Together" "Discuss" , bullets [ bullet "Give everyone a chance to read out their hopes and fears" , bullet "Discuss what you want to get out of the club" , bullet "Think about how to accommodate members with varying levels of experience and confidence" ] ] ] ) ] SecondThoughts -> [ ( True , [ slideHeading "Second thoughts?" , slideP "What's the most disorientating thing so far? This can be something about the Code Reading Club process or the code sample we are looking at." , slideP "Is something confusing or worrying you? Are you feeling excited or uneasy?" , container (div []) [ timedHeading "2" "Independently" "Note down 1 or 2 things" , item (img [ src "example-excited-worried.png", style "height" "250px" ] []) ] ] ) , ( True , [ slideHeading "Second thoughts?" , container (div []) [ timedHeading "5" "Together" "Discuss" , bullets [ bullet "Give everyone a chance share if they want to" , bullet "Discuss what you want to get out of the club" , bullet "Think about how to accommodate members with varying levels of experience and confidence" ] ] ] ) ] Reflect -> [ ( True , [ slideHeading "Reflect on the session" , slideP "If you have time, it's helpful to wrap up the session with a little reflection." , timedHeading "5" "Together" "Note down things" , bullets [ bullet "that went well or felt good" , bullet "you want to try to do differently next time because they didn't work or felt bad" ] ] ) ] Feedback -> [ ( True , [ slideHeading "Reflect on the session" , slideP "If you have time, it's helpful to wrap up the session with a little reflection." , timedHeading "5" "Together" "Note down things" , bullets [ bullet "Feedback we can act on - both good and bad is helpful" , bullet "Observations about the experience - in the club today or thoughts you've had between clubs" ] ] ) ] SessionEnd { codeDescription, codeLink } -> [ ( False , [ slideHeading "What now?" , slideP "Code used for this session..." , bullets [ bulletLink codeDescription codeLink ] , slideP "Code reading club resources: https://code-reading.org" , slideP "Read Felienne's book! The Programmer's Brain" , slideP "Start a club" , slideP "Join a club" , slideP "Get in touch hello@code-reading.org" ] ) ] -- First Look FirstGlance -> [ ( True , [ slideHeading "First glance" , slideP "The goal of this exercise is to practice to get a first impression of code and act upon that. We all have different instincts and strategies for where to start when faced with a new piece of code. It doesn't matter how trivial you think the first and second things you noticed are." , timedHeading "1" "Independently" "Glance at the code" , slideP "It's important that what you use is your immediate reaction, don't overthink it!" , bullets [ bullet "Look at code for a few seconds. Note the first thing that catches your eye" , bullet "Then look again for a few more seconds. Note the second thing that catches your eye" , bullet "Now think about why you noticed those things first & note that down" ] , item (img [ src "example-first-glance.png", style "width" "120%", style "margin" "-10px 0 0 -10%" ] []) ] ) , ( True , [ slideHeading "First glance" , timedHeading "8" "Together" "Discuss" , slideP "Talk about why things might have jumped out for different people. It might be tempting for some people to start talking about the big picture; try to steer discussion back to individual details, rather than summaries." , bullets [ bullet "How do those initial observations help with deciding what to look at next?" , bullet "What lines or facts or concepts were chosen by everyone versus by only a few people?" ] , slideP "Reflect also on what kind of knowledge you used in this exercise." , bullets [ bullet "Knowledge of the domain, of the programming language? Of a framework?" , bullet "What knowledge do you think might be needed to better understand this code?" ] ] ) ] Syntax -> [ ( True , [ slideHeading "Syntax knowledge" , slideP "The goal of this exercise is to practice to make sure everyone in club is familiar with syntactic elements of the code." , timedHeading "5" "Independently" "Examine syntax" , slideP "Look at the code and examine syntactic elements. Do you know the meaning of all elements?" , slideP "You can use these questions as a guide:" , bullets [ bullet "Is it clear to you what the role of each block in the code is (function, condition, repetition etc)?" , bullet "Do you recognize all operators?" , bullet "Take the remainder of the time to think about what other things are unfamiliar." ] ] ) , ( True , [ slideHeading "Syntax knowledge" , timedHeading "5" "Together" "Discuss" , slideP "Talk about unfamiliar constructs." , slideP "Were there constructs that were unfamiliar?" , bullets [ bullet "If so, are there members of the group who know the meaning?" , bullet "If not, can you look up the constructs?" ] , slideP "Why are the syntactic constructs unfamiliar?" , slideP "Are they ideosyncratic to this language or code base?" ] ) ] AnnotateStructure { annotationLink, pdfLink } -> [ ( True , [ slideHeading "Code structure" , slideP "The goal of this exercise is to be a concrete thing to *do* when looking at new code for the first time. New code can be scary, doing something will help!" , timedHeading "8" "Independently" "Examine structure" , slideP "Highlight the places where they are defined a draw links to where they are used. Use 3 different colours." , item (img [ src "annotated-code.png", style "float" "right", style "height" "260px" ] []) , item (img [ src "scribbled-code.png", style "float" "right", style "height" "260px", style "margin" "-20px 20px 0 0" ] []) , bullets [ bulletLink "Code to annotate" annotationLink , if String.length pdfLink > 0 then bulletLink "Code pdf to download" pdfLink else item (text "") ] , bullets [ bullet "Variables" , bullet "Functions / Methods" , bullet "Classes / Instantiation" ] ] ) , ( True , [ slideHeading "Code structure" , timedHeading "10" "Together" "Discuss" , bullets [ bullet "Did anyone have trouble deciding what constituted a variable, function or class?" , bullet "What patterns are visible from the colors and links only?" , bullet "How does the data flow through the code?" , bullet "What parts of the code seem to warrant more attention?" ] ] ) ] ListNames -> [ ( True, [] ) ] RandomLine -> [ ( True , [ slideHeading "Random Line" , timedHeading "5" "Independently" "Examine the line" , slideP "Select a random line from the code in whatever way you like. It can be helpful to randomly pick 3 line numbers and have the facilitator choose from them, which they think will be most interesting to talk about; but surprisingly, even a blank line can generate some conversation!" , slideP "Debugging often starts with a line number." , slideP "Start by looking at the line itself, then think about how it relates to the code around it." , bullets [ bullet "What is the main idea of this line?" , bullet "What lines does it relate to and why?" , bullet "What strategies & prior knowlegde are you using to figure this out?" ] ] ) , ( True , [ slideHeading "The Line in Context" , timedHeading "8" "Together" "Discuss" , bullets [ bullet "What is the 'scope' of the random line?" , bullet "What part of the code was seen as related?" , bullet "How does the line fit into the rest of the code base?" ] , slideP "Take turns in the group, and let every member talk about the code for 30 seconds (could also be one sentence each). Try to add new information and not repeat things that have been said, and repeat until people do not know new things anymore or we run out of time.." ] ) ] ImportantLines -> [ ( True , [ slideHeading "Content" , timedHeading "5" "Independently" "Identify important lines" , slideP "Important can mean whatever you want it to. If it's helpful, try to think of it as a line that you might highlight when reading a text." , bullets [ bullet "Identify the 4 lines you consider most important" , bullet "Note those lines down on your board" , bullet "Think about why you chose them" ] , slideP "We'll dot vote our line numbers together and discuss choices in the next exercise" ] ) , ( True , [ slideHeading "Content" , timedHeading "8" "Together" "Discuss" , slideP "Discuss in the group:" , bullets [ bullet "lines covered by many people?" , bullet "lines named but not by a lot of people" , bullet "Agree less than 8 of the most important lines" ] , slideP "Take turns in the group, and let every member talk about the code for 30 seconds (could also be one sentence each). Try to add new information and not repeat things that have been said, and repeat until people do not know new things anymore." ] ) ] Summarise -> [ ( True , [ slideHeading "Summary" , timedHeading "5" "Independently" "Summarise" , slideP "The goal of this exercise is to think about the core purpose or function of this code." , bullets [ bullet "try to write down the essence of the code in a few sentences" ] ] ) , ( True , [ slideHeading "Summary" , timedHeading "8" "Together" "Discuss" , bullets [ bullet "topics covered by many vs few" , bullet "strategies used to create the summary (e.g. method names, documentation, variable names, prior knowledge of system)" ] ] ) ] -- Second Look RecapStructure importantLines -> [ ( True , [ slideHeading "Code structure" , timedHeading "5" "Independently" "Remember" , slideP "Look at the pieces that make up the code and how they connect or flow together. This exercise is meant as a recap of the first session on the code, and as a way to onboard people that might have missed the first session on this code snippet." , slideP "Looking at an annotated copy from the last session, make some notes about what parts of the code stand out and why. If you did not participate in the previous session, highlight the variables, methods and classes. Draw links between where they are instantiated and used." , bullets [ bullet "Study the patterns and think about what they tell you." ] , slideP "When we looked at this code last month, we talked about important lines together." , slideP ("These were chosen by a few people: " ++ String.join ", " (List.map String.fromInt importantLines)) ] ) , ( True , [ slideHeading "Code structure" , timedHeading "10" "Together" "Review & Summerise" , slideP "Someone who was in the previous session could summarise or where we got to or we could think about:" , bullets [ bullet "What direction does the code flow in?" , bullet "What parts stand out for lack, or excess, of links to other parts?" , bullet "What parts of the code seem to warrant more attention?" , bullet "Did anyone have trouble deciding what constituted a variable, function or class?" , bullet "What thoughts did you have when thinking about the structure?" ] ] ) ] CentralThemes -> [ ( True, [] ) ] CentralConcepts -> [ ( True, [] ) ] DecisionsMade -> [ ( True , [ slideHeading "The decisions made in the code" , timedHeading "5" "Independently" "Consider code choices" , slideP "Reexamine the code snippet and list decisions of the creator(s) of the code, for example a decision to use a certain design pattern or use a certain library or API." , bullets [ bullet "Try not to judge the decisions as good or bad" , bullet "Focus on what decisions the developer(s) had to make, not why they made them" ] , item (img [ src "example-code-decisions.png", style "height" "250px" ] []) ] ) , ( True , [ slideHeading "The decisions made in the code" , timedHeading "10" "Together" "Discuss" , bullets [ bullet "Decisions covered by many vs few" , bullet "Strategies used to decide (e.g. method names, documentation, variable names, prior knowledge of system)" ] ] ) ] DecisionsConsequences -> [ ( True , [ slideHeading "Consequences of the decisions" , timedHeading "5" "Independently" "Consider the consequences" , slideP "Think about the consequences of the decisions that were made. These could be the decisions you found yourself in the previous exercise or a decision someone else pointed out." , slideP "You might want to think consider the impact of the decisions this code on:" , bullets [ bullet "readability" , bullet "performance" , bullet "extendability" ] , item (img [ src "example-consequences.png", style "height" "210px" ] []) ] ) , ( True , [ slideHeading "Consequences of the decisions" , timedHeading "10" "Together" "Discuss" , bullets [ bullet "Consequences covered by many vs few" , bullet "Different types of consequence chosen (e.g. readability, extendability, performance)" , bullet "Pros of these decisions" , bullet "Possible cons of these decisions" ] ] ) ] DecisionsWhy -> [ ( True , [ slideHeading "The 'why' of the decisions" , timedHeading "10" "Together" "Make statements" , slideP "Can you understand why the code was designed this way?" , bullets [ bullet "What assumptions do these decisions rely on?" , bullet "Can you think of reasons these decisions might have been made?" , bullet "What alternatives would have been possible?" ] ] ) ] -- Markup helpers slideHeading : String -> CustomContent slideHeading title = item (h1 [] [ text title ]) slideHr : CustomContent slideHr = item (hr [] []) slideP : String -> CustomContent slideP paragraph = item (p [] [ text paragraph ]) slidePMarkdown : String -> CustomContent slidePMarkdown paragraph = item (Markdown.toHtml [] paragraph) timedHeading : String -> String -> String -> CustomContent timedHeading minutes who heading = let label = if minutes == "1" then " minute" else " minutes" in container (h2 []) [ item (text heading) , item (span [ class "who" ] [ text who ]) , item (span [ class "time" ] [ text (minutes ++ label) ]) ] bullets : List CustomContent -> CustomContent bullets = container (ul []) bullet : String -> CustomContent bullet str = item (li [] [ text str ]) bulletLink : String -> String -> CustomContent bulletLink str url = item (li [] [ a [ href url ] [ text str ] ]) {-| Custom slide that sets the padding and appends the custom content -} paddedSlide : ( Bool, List CustomContent ) -> CustomSlide paddedSlide ( showStopwatch, content ) = slide [ container (div [ class "slides", style "padding" "50px 100px" ]) (content ++ [ if showStopwatch then custom { displayTime = 0 , startTime = 0 , timerStarted = False } else item (img [ src "icon.png", class "stopwatch" ] []) , item (div [ class "footer" ] [ text "Slides for this workshop: https://runner.code-reading.org" ] ) ] ) ]
34574
module Exercises exposing (..) import Html exposing (Html, a, button, div, h1, h2, hr, img, li, p, span, text, ul) import Html.Attributes exposing (class, href, src, style) import Html.Events exposing (onClick) import Markdown import SharedType exposing (AnnotateInfo, CustomContent, CustomSlide, EndInfo, StartInfo) import SliceShow.Content exposing (..) import SliceShow.Slide exposing (..) import Time exposing (Posix) type Section -- Information = SessionStartFirstClub StartInfo | SessionStart StartInfo | WhyDoingThis | SecondThoughts | Reflect | Feedback | SessionEnd EndInfo -- First Look | FirstGlance | Syntax | AnnotateStructure AnnotateInfo | ListNames | RandomLine | ImportantLines | Summarise -- Second Look | RecapStructure (List Int) | CentralThemes | CentralConcepts | DecisionsMade | DecisionsConsequences | DecisionsWhy slideContent : Section -> List ( Bool, List SharedType.CustomContent ) slideContent section = case section of SessionStartFirstClub { facilitatedBy, miroLink, annotationLink, pdfLink } -> [ ( False , [ slideHeading "Code Reading Club" , slideP ("Facilitators: " ++ facilitatedBy) , slideP "<EMAIL> | https://code-reading.org" , slideHr , bullets [ bulletLink "Code of conduct" "https://code-reading.org/conduct" , bulletLink "Miro board" miroLink , bulletLink "Code in annotation tool" annotationLink , if String.length pdfLink > 0 then bulletLink "Code pdf to download" pdfLink else item (text "") ] , slideHr , bullets [ bullet "Hello! What is code reading? Why are we all here?" , bullet "Don't look at the code until we start the first exercise" , bullet "I'll keep the exercises & timer posted on my screenshare" , bullet "Join the miro and claim a board" , bullet "Make independent notes on your board" , bullet "After each exercise we'll copy any thoughts we want to share to a shared board" ] , item (h2 [ style "margin-top" "-20px" ] [ text "Any questions before we start?" ]) |> hide ] ) ] SessionStart { facilitatedBy, miroLink, annotationLink, pdfLink } -> [ ( False , [ slideHeading "Code Reading Club" , slideP ("Facilitators: " ++ facilitatedBy) , slideP "<EMAIL> | https://code-reading.org" , slideHr , bullets [ bulletLink "Code of conduct" "https://code-reading.org/conduct" , bulletLink "Miro board" miroLink , bulletLink "Code in annotation tool" annotationLink , if String.length pdfLink > 0 then bulletLink "Example annotation" pdfLink else item (text "") ] , slideHr , bullets [ bullet "Grab a copy of the code" , bullet "I'll keep the exercises & timer posted on my screenshare" , bullet "Join the miro and claim a board" , bullet "Make independent notes on your board" , bullet "After each exercise we'll copy any thoughts we want to share to a shared board" ] , item (h2 [ style "margin-top" "-20px" ] [ text "Any questions before we start?" ]) |> hide ] ) ] WhyDoingThis -> [ ( True , [ slideHeading "Why are we doing this?" , slideP "Take a few minutes to talk about your motivation for doing the club. This is important because it will help you support each other and make it more likely that your group will feel that the club sessions have value for them." , container (div []) [ timedHeading "2" "Independently" "Note down one thing" , bullets [ bullet "that you are looking forward to or excited about", bullet "that you are worried or confused about" ] , item (img [ src "example-excited-worried.png", style "height" "250px" ] []) ] |> hide ] ) , ( True , [ slideHeading "Why are we doing this?" , container (div []) [ timedHeading "5" "Together" "Discuss" , bullets [ bullet "Give everyone a chance to read out their hopes and fears" , bullet "Discuss what you want to get out of the club" , bullet "Think about how to accommodate members with varying levels of experience and confidence" ] ] ] ) ] SecondThoughts -> [ ( True , [ slideHeading "Second thoughts?" , slideP "What's the most disorientating thing so far? This can be something about the Code Reading Club process or the code sample we are looking at." , slideP "Is something confusing or worrying you? Are you feeling excited or uneasy?" , container (div []) [ timedHeading "2" "Independently" "Note down 1 or 2 things" , item (img [ src "example-excited-worried.png", style "height" "250px" ] []) ] ] ) , ( True , [ slideHeading "Second thoughts?" , container (div []) [ timedHeading "5" "Together" "Discuss" , bullets [ bullet "Give everyone a chance share if they want to" , bullet "Discuss what you want to get out of the club" , bullet "Think about how to accommodate members with varying levels of experience and confidence" ] ] ] ) ] Reflect -> [ ( True , [ slideHeading "Reflect on the session" , slideP "If you have time, it's helpful to wrap up the session with a little reflection." , timedHeading "5" "Together" "Note down things" , bullets [ bullet "that went well or felt good" , bullet "you want to try to do differently next time because they didn't work or felt bad" ] ] ) ] Feedback -> [ ( True , [ slideHeading "Reflect on the session" , slideP "If you have time, it's helpful to wrap up the session with a little reflection." , timedHeading "5" "Together" "Note down things" , bullets [ bullet "Feedback we can act on - both good and bad is helpful" , bullet "Observations about the experience - in the club today or thoughts you've had between clubs" ] ] ) ] SessionEnd { codeDescription, codeLink } -> [ ( False , [ slideHeading "What now?" , slideP "Code used for this session..." , bullets [ bulletLink codeDescription codeLink ] , slideP "Code reading club resources: https://code-reading.org" , slideP "Read <NAME>elienne's book! The Programmer's Brain" , slideP "Start a club" , slideP "Join a club" , slideP "Get in touch <EMAIL>" ] ) ] -- First Look FirstGlance -> [ ( True , [ slideHeading "First glance" , slideP "The goal of this exercise is to practice to get a first impression of code and act upon that. We all have different instincts and strategies for where to start when faced with a new piece of code. It doesn't matter how trivial you think the first and second things you noticed are." , timedHeading "1" "Independently" "Glance at the code" , slideP "It's important that what you use is your immediate reaction, don't overthink it!" , bullets [ bullet "Look at code for a few seconds. Note the first thing that catches your eye" , bullet "Then look again for a few more seconds. Note the second thing that catches your eye" , bullet "Now think about why you noticed those things first & note that down" ] , item (img [ src "example-first-glance.png", style "width" "120%", style "margin" "-10px 0 0 -10%" ] []) ] ) , ( True , [ slideHeading "First glance" , timedHeading "8" "Together" "Discuss" , slideP "Talk about why things might have jumped out for different people. It might be tempting for some people to start talking about the big picture; try to steer discussion back to individual details, rather than summaries." , bullets [ bullet "How do those initial observations help with deciding what to look at next?" , bullet "What lines or facts or concepts were chosen by everyone versus by only a few people?" ] , slideP "Reflect also on what kind of knowledge you used in this exercise." , bullets [ bullet "Knowledge of the domain, of the programming language? Of a framework?" , bullet "What knowledge do you think might be needed to better understand this code?" ] ] ) ] Syntax -> [ ( True , [ slideHeading "Syntax knowledge" , slideP "The goal of this exercise is to practice to make sure everyone in club is familiar with syntactic elements of the code." , timedHeading "5" "Independently" "Examine syntax" , slideP "Look at the code and examine syntactic elements. Do you know the meaning of all elements?" , slideP "You can use these questions as a guide:" , bullets [ bullet "Is it clear to you what the role of each block in the code is (function, condition, repetition etc)?" , bullet "Do you recognize all operators?" , bullet "Take the remainder of the time to think about what other things are unfamiliar." ] ] ) , ( True , [ slideHeading "Syntax knowledge" , timedHeading "5" "Together" "Discuss" , slideP "Talk about unfamiliar constructs." , slideP "Were there constructs that were unfamiliar?" , bullets [ bullet "If so, are there members of the group who know the meaning?" , bullet "If not, can you look up the constructs?" ] , slideP "Why are the syntactic constructs unfamiliar?" , slideP "Are they ideosyncratic to this language or code base?" ] ) ] AnnotateStructure { annotationLink, pdfLink } -> [ ( True , [ slideHeading "Code structure" , slideP "The goal of this exercise is to be a concrete thing to *do* when looking at new code for the first time. New code can be scary, doing something will help!" , timedHeading "8" "Independently" "Examine structure" , slideP "Highlight the places where they are defined a draw links to where they are used. Use 3 different colours." , item (img [ src "annotated-code.png", style "float" "right", style "height" "260px" ] []) , item (img [ src "scribbled-code.png", style "float" "right", style "height" "260px", style "margin" "-20px 20px 0 0" ] []) , bullets [ bulletLink "Code to annotate" annotationLink , if String.length pdfLink > 0 then bulletLink "Code pdf to download" pdfLink else item (text "") ] , bullets [ bullet "Variables" , bullet "Functions / Methods" , bullet "Classes / Instantiation" ] ] ) , ( True , [ slideHeading "Code structure" , timedHeading "10" "Together" "Discuss" , bullets [ bullet "Did anyone have trouble deciding what constituted a variable, function or class?" , bullet "What patterns are visible from the colors and links only?" , bullet "How does the data flow through the code?" , bullet "What parts of the code seem to warrant more attention?" ] ] ) ] ListNames -> [ ( True, [] ) ] RandomLine -> [ ( True , [ slideHeading "Random Line" , timedHeading "5" "Independently" "Examine the line" , slideP "Select a random line from the code in whatever way you like. It can be helpful to randomly pick 3 line numbers and have the facilitator choose from them, which they think will be most interesting to talk about; but surprisingly, even a blank line can generate some conversation!" , slideP "Debugging often starts with a line number." , slideP "Start by looking at the line itself, then think about how it relates to the code around it." , bullets [ bullet "What is the main idea of this line?" , bullet "What lines does it relate to and why?" , bullet "What strategies & prior knowlegde are you using to figure this out?" ] ] ) , ( True , [ slideHeading "The Line in Context" , timedHeading "8" "Together" "Discuss" , bullets [ bullet "What is the 'scope' of the random line?" , bullet "What part of the code was seen as related?" , bullet "How does the line fit into the rest of the code base?" ] , slideP "Take turns in the group, and let every member talk about the code for 30 seconds (could also be one sentence each). Try to add new information and not repeat things that have been said, and repeat until people do not know new things anymore or we run out of time.." ] ) ] ImportantLines -> [ ( True , [ slideHeading "Content" , timedHeading "5" "Independently" "Identify important lines" , slideP "Important can mean whatever you want it to. If it's helpful, try to think of it as a line that you might highlight when reading a text." , bullets [ bullet "Identify the 4 lines you consider most important" , bullet "Note those lines down on your board" , bullet "Think about why you chose them" ] , slideP "We'll dot vote our line numbers together and discuss choices in the next exercise" ] ) , ( True , [ slideHeading "Content" , timedHeading "8" "Together" "Discuss" , slideP "Discuss in the group:" , bullets [ bullet "lines covered by many people?" , bullet "lines named but not by a lot of people" , bullet "Agree less than 8 of the most important lines" ] , slideP "Take turns in the group, and let every member talk about the code for 30 seconds (could also be one sentence each). Try to add new information and not repeat things that have been said, and repeat until people do not know new things anymore." ] ) ] Summarise -> [ ( True , [ slideHeading "Summary" , timedHeading "5" "Independently" "Summarise" , slideP "The goal of this exercise is to think about the core purpose or function of this code." , bullets [ bullet "try to write down the essence of the code in a few sentences" ] ] ) , ( True , [ slideHeading "Summary" , timedHeading "8" "Together" "Discuss" , bullets [ bullet "topics covered by many vs few" , bullet "strategies used to create the summary (e.g. method names, documentation, variable names, prior knowledge of system)" ] ] ) ] -- Second Look RecapStructure importantLines -> [ ( True , [ slideHeading "Code structure" , timedHeading "5" "Independently" "Remember" , slideP "Look at the pieces that make up the code and how they connect or flow together. This exercise is meant as a recap of the first session on the code, and as a way to onboard people that might have missed the first session on this code snippet." , slideP "Looking at an annotated copy from the last session, make some notes about what parts of the code stand out and why. If you did not participate in the previous session, highlight the variables, methods and classes. Draw links between where they are instantiated and used." , bullets [ bullet "Study the patterns and think about what they tell you." ] , slideP "When we looked at this code last month, we talked about important lines together." , slideP ("These were chosen by a few people: " ++ String.join ", " (List.map String.fromInt importantLines)) ] ) , ( True , [ slideHeading "Code structure" , timedHeading "10" "Together" "Review & Summerise" , slideP "Someone who was in the previous session could summarise or where we got to or we could think about:" , bullets [ bullet "What direction does the code flow in?" , bullet "What parts stand out for lack, or excess, of links to other parts?" , bullet "What parts of the code seem to warrant more attention?" , bullet "Did anyone have trouble deciding what constituted a variable, function or class?" , bullet "What thoughts did you have when thinking about the structure?" ] ] ) ] CentralThemes -> [ ( True, [] ) ] CentralConcepts -> [ ( True, [] ) ] DecisionsMade -> [ ( True , [ slideHeading "The decisions made in the code" , timedHeading "5" "Independently" "Consider code choices" , slideP "Reexamine the code snippet and list decisions of the creator(s) of the code, for example a decision to use a certain design pattern or use a certain library or API." , bullets [ bullet "Try not to judge the decisions as good or bad" , bullet "Focus on what decisions the developer(s) had to make, not why they made them" ] , item (img [ src "example-code-decisions.png", style "height" "250px" ] []) ] ) , ( True , [ slideHeading "The decisions made in the code" , timedHeading "10" "Together" "Discuss" , bullets [ bullet "Decisions covered by many vs few" , bullet "Strategies used to decide (e.g. method names, documentation, variable names, prior knowledge of system)" ] ] ) ] DecisionsConsequences -> [ ( True , [ slideHeading "Consequences of the decisions" , timedHeading "5" "Independently" "Consider the consequences" , slideP "Think about the consequences of the decisions that were made. These could be the decisions you found yourself in the previous exercise or a decision someone else pointed out." , slideP "You might want to think consider the impact of the decisions this code on:" , bullets [ bullet "readability" , bullet "performance" , bullet "extendability" ] , item (img [ src "example-consequences.png", style "height" "210px" ] []) ] ) , ( True , [ slideHeading "Consequences of the decisions" , timedHeading "10" "Together" "Discuss" , bullets [ bullet "Consequences covered by many vs few" , bullet "Different types of consequence chosen (e.g. readability, extendability, performance)" , bullet "Pros of these decisions" , bullet "Possible cons of these decisions" ] ] ) ] DecisionsWhy -> [ ( True , [ slideHeading "The 'why' of the decisions" , timedHeading "10" "Together" "Make statements" , slideP "Can you understand why the code was designed this way?" , bullets [ bullet "What assumptions do these decisions rely on?" , bullet "Can you think of reasons these decisions might have been made?" , bullet "What alternatives would have been possible?" ] ] ) ] -- Markup helpers slideHeading : String -> CustomContent slideHeading title = item (h1 [] [ text title ]) slideHr : CustomContent slideHr = item (hr [] []) slideP : String -> CustomContent slideP paragraph = item (p [] [ text paragraph ]) slidePMarkdown : String -> CustomContent slidePMarkdown paragraph = item (Markdown.toHtml [] paragraph) timedHeading : String -> String -> String -> CustomContent timedHeading minutes who heading = let label = if minutes == "1" then " minute" else " minutes" in container (h2 []) [ item (text heading) , item (span [ class "who" ] [ text who ]) , item (span [ class "time" ] [ text (minutes ++ label) ]) ] bullets : List CustomContent -> CustomContent bullets = container (ul []) bullet : String -> CustomContent bullet str = item (li [] [ text str ]) bulletLink : String -> String -> CustomContent bulletLink str url = item (li [] [ a [ href url ] [ text str ] ]) {-| Custom slide that sets the padding and appends the custom content -} paddedSlide : ( Bool, List CustomContent ) -> CustomSlide paddedSlide ( showStopwatch, content ) = slide [ container (div [ class "slides", style "padding" "50px 100px" ]) (content ++ [ if showStopwatch then custom { displayTime = 0 , startTime = 0 , timerStarted = False } else item (img [ src "icon.png", class "stopwatch" ] []) , item (div [ class "footer" ] [ text "Slides for this workshop: https://runner.code-reading.org" ] ) ] ) ]
true
module Exercises exposing (..) import Html exposing (Html, a, button, div, h1, h2, hr, img, li, p, span, text, ul) import Html.Attributes exposing (class, href, src, style) import Html.Events exposing (onClick) import Markdown import SharedType exposing (AnnotateInfo, CustomContent, CustomSlide, EndInfo, StartInfo) import SliceShow.Content exposing (..) import SliceShow.Slide exposing (..) import Time exposing (Posix) type Section -- Information = SessionStartFirstClub StartInfo | SessionStart StartInfo | WhyDoingThis | SecondThoughts | Reflect | Feedback | SessionEnd EndInfo -- First Look | FirstGlance | Syntax | AnnotateStructure AnnotateInfo | ListNames | RandomLine | ImportantLines | Summarise -- Second Look | RecapStructure (List Int) | CentralThemes | CentralConcepts | DecisionsMade | DecisionsConsequences | DecisionsWhy slideContent : Section -> List ( Bool, List SharedType.CustomContent ) slideContent section = case section of SessionStartFirstClub { facilitatedBy, miroLink, annotationLink, pdfLink } -> [ ( False , [ slideHeading "Code Reading Club" , slideP ("Facilitators: " ++ facilitatedBy) , slideP "PI:EMAIL:<EMAIL>END_PI | https://code-reading.org" , slideHr , bullets [ bulletLink "Code of conduct" "https://code-reading.org/conduct" , bulletLink "Miro board" miroLink , bulletLink "Code in annotation tool" annotationLink , if String.length pdfLink > 0 then bulletLink "Code pdf to download" pdfLink else item (text "") ] , slideHr , bullets [ bullet "Hello! What is code reading? Why are we all here?" , bullet "Don't look at the code until we start the first exercise" , bullet "I'll keep the exercises & timer posted on my screenshare" , bullet "Join the miro and claim a board" , bullet "Make independent notes on your board" , bullet "After each exercise we'll copy any thoughts we want to share to a shared board" ] , item (h2 [ style "margin-top" "-20px" ] [ text "Any questions before we start?" ]) |> hide ] ) ] SessionStart { facilitatedBy, miroLink, annotationLink, pdfLink } -> [ ( False , [ slideHeading "Code Reading Club" , slideP ("Facilitators: " ++ facilitatedBy) , slideP "PI:EMAIL:<EMAIL>END_PI | https://code-reading.org" , slideHr , bullets [ bulletLink "Code of conduct" "https://code-reading.org/conduct" , bulletLink "Miro board" miroLink , bulletLink "Code in annotation tool" annotationLink , if String.length pdfLink > 0 then bulletLink "Example annotation" pdfLink else item (text "") ] , slideHr , bullets [ bullet "Grab a copy of the code" , bullet "I'll keep the exercises & timer posted on my screenshare" , bullet "Join the miro and claim a board" , bullet "Make independent notes on your board" , bullet "After each exercise we'll copy any thoughts we want to share to a shared board" ] , item (h2 [ style "margin-top" "-20px" ] [ text "Any questions before we start?" ]) |> hide ] ) ] WhyDoingThis -> [ ( True , [ slideHeading "Why are we doing this?" , slideP "Take a few minutes to talk about your motivation for doing the club. This is important because it will help you support each other and make it more likely that your group will feel that the club sessions have value for them." , container (div []) [ timedHeading "2" "Independently" "Note down one thing" , bullets [ bullet "that you are looking forward to or excited about", bullet "that you are worried or confused about" ] , item (img [ src "example-excited-worried.png", style "height" "250px" ] []) ] |> hide ] ) , ( True , [ slideHeading "Why are we doing this?" , container (div []) [ timedHeading "5" "Together" "Discuss" , bullets [ bullet "Give everyone a chance to read out their hopes and fears" , bullet "Discuss what you want to get out of the club" , bullet "Think about how to accommodate members with varying levels of experience and confidence" ] ] ] ) ] SecondThoughts -> [ ( True , [ slideHeading "Second thoughts?" , slideP "What's the most disorientating thing so far? This can be something about the Code Reading Club process or the code sample we are looking at." , slideP "Is something confusing or worrying you? Are you feeling excited or uneasy?" , container (div []) [ timedHeading "2" "Independently" "Note down 1 or 2 things" , item (img [ src "example-excited-worried.png", style "height" "250px" ] []) ] ] ) , ( True , [ slideHeading "Second thoughts?" , container (div []) [ timedHeading "5" "Together" "Discuss" , bullets [ bullet "Give everyone a chance share if they want to" , bullet "Discuss what you want to get out of the club" , bullet "Think about how to accommodate members with varying levels of experience and confidence" ] ] ] ) ] Reflect -> [ ( True , [ slideHeading "Reflect on the session" , slideP "If you have time, it's helpful to wrap up the session with a little reflection." , timedHeading "5" "Together" "Note down things" , bullets [ bullet "that went well or felt good" , bullet "you want to try to do differently next time because they didn't work or felt bad" ] ] ) ] Feedback -> [ ( True , [ slideHeading "Reflect on the session" , slideP "If you have time, it's helpful to wrap up the session with a little reflection." , timedHeading "5" "Together" "Note down things" , bullets [ bullet "Feedback we can act on - both good and bad is helpful" , bullet "Observations about the experience - in the club today or thoughts you've had between clubs" ] ] ) ] SessionEnd { codeDescription, codeLink } -> [ ( False , [ slideHeading "What now?" , slideP "Code used for this session..." , bullets [ bulletLink codeDescription codeLink ] , slideP "Code reading club resources: https://code-reading.org" , slideP "Read PI:NAME:<NAME>END_PIelienne's book! The Programmer's Brain" , slideP "Start a club" , slideP "Join a club" , slideP "Get in touch PI:EMAIL:<EMAIL>END_PI" ] ) ] -- First Look FirstGlance -> [ ( True , [ slideHeading "First glance" , slideP "The goal of this exercise is to practice to get a first impression of code and act upon that. We all have different instincts and strategies for where to start when faced with a new piece of code. It doesn't matter how trivial you think the first and second things you noticed are." , timedHeading "1" "Independently" "Glance at the code" , slideP "It's important that what you use is your immediate reaction, don't overthink it!" , bullets [ bullet "Look at code for a few seconds. Note the first thing that catches your eye" , bullet "Then look again for a few more seconds. Note the second thing that catches your eye" , bullet "Now think about why you noticed those things first & note that down" ] , item (img [ src "example-first-glance.png", style "width" "120%", style "margin" "-10px 0 0 -10%" ] []) ] ) , ( True , [ slideHeading "First glance" , timedHeading "8" "Together" "Discuss" , slideP "Talk about why things might have jumped out for different people. It might be tempting for some people to start talking about the big picture; try to steer discussion back to individual details, rather than summaries." , bullets [ bullet "How do those initial observations help with deciding what to look at next?" , bullet "What lines or facts or concepts were chosen by everyone versus by only a few people?" ] , slideP "Reflect also on what kind of knowledge you used in this exercise." , bullets [ bullet "Knowledge of the domain, of the programming language? Of a framework?" , bullet "What knowledge do you think might be needed to better understand this code?" ] ] ) ] Syntax -> [ ( True , [ slideHeading "Syntax knowledge" , slideP "The goal of this exercise is to practice to make sure everyone in club is familiar with syntactic elements of the code." , timedHeading "5" "Independently" "Examine syntax" , slideP "Look at the code and examine syntactic elements. Do you know the meaning of all elements?" , slideP "You can use these questions as a guide:" , bullets [ bullet "Is it clear to you what the role of each block in the code is (function, condition, repetition etc)?" , bullet "Do you recognize all operators?" , bullet "Take the remainder of the time to think about what other things are unfamiliar." ] ] ) , ( True , [ slideHeading "Syntax knowledge" , timedHeading "5" "Together" "Discuss" , slideP "Talk about unfamiliar constructs." , slideP "Were there constructs that were unfamiliar?" , bullets [ bullet "If so, are there members of the group who know the meaning?" , bullet "If not, can you look up the constructs?" ] , slideP "Why are the syntactic constructs unfamiliar?" , slideP "Are they ideosyncratic to this language or code base?" ] ) ] AnnotateStructure { annotationLink, pdfLink } -> [ ( True , [ slideHeading "Code structure" , slideP "The goal of this exercise is to be a concrete thing to *do* when looking at new code for the first time. New code can be scary, doing something will help!" , timedHeading "8" "Independently" "Examine structure" , slideP "Highlight the places where they are defined a draw links to where they are used. Use 3 different colours." , item (img [ src "annotated-code.png", style "float" "right", style "height" "260px" ] []) , item (img [ src "scribbled-code.png", style "float" "right", style "height" "260px", style "margin" "-20px 20px 0 0" ] []) , bullets [ bulletLink "Code to annotate" annotationLink , if String.length pdfLink > 0 then bulletLink "Code pdf to download" pdfLink else item (text "") ] , bullets [ bullet "Variables" , bullet "Functions / Methods" , bullet "Classes / Instantiation" ] ] ) , ( True , [ slideHeading "Code structure" , timedHeading "10" "Together" "Discuss" , bullets [ bullet "Did anyone have trouble deciding what constituted a variable, function or class?" , bullet "What patterns are visible from the colors and links only?" , bullet "How does the data flow through the code?" , bullet "What parts of the code seem to warrant more attention?" ] ] ) ] ListNames -> [ ( True, [] ) ] RandomLine -> [ ( True , [ slideHeading "Random Line" , timedHeading "5" "Independently" "Examine the line" , slideP "Select a random line from the code in whatever way you like. It can be helpful to randomly pick 3 line numbers and have the facilitator choose from them, which they think will be most interesting to talk about; but surprisingly, even a blank line can generate some conversation!" , slideP "Debugging often starts with a line number." , slideP "Start by looking at the line itself, then think about how it relates to the code around it." , bullets [ bullet "What is the main idea of this line?" , bullet "What lines does it relate to and why?" , bullet "What strategies & prior knowlegde are you using to figure this out?" ] ] ) , ( True , [ slideHeading "The Line in Context" , timedHeading "8" "Together" "Discuss" , bullets [ bullet "What is the 'scope' of the random line?" , bullet "What part of the code was seen as related?" , bullet "How does the line fit into the rest of the code base?" ] , slideP "Take turns in the group, and let every member talk about the code for 30 seconds (could also be one sentence each). Try to add new information and not repeat things that have been said, and repeat until people do not know new things anymore or we run out of time.." ] ) ] ImportantLines -> [ ( True , [ slideHeading "Content" , timedHeading "5" "Independently" "Identify important lines" , slideP "Important can mean whatever you want it to. If it's helpful, try to think of it as a line that you might highlight when reading a text." , bullets [ bullet "Identify the 4 lines you consider most important" , bullet "Note those lines down on your board" , bullet "Think about why you chose them" ] , slideP "We'll dot vote our line numbers together and discuss choices in the next exercise" ] ) , ( True , [ slideHeading "Content" , timedHeading "8" "Together" "Discuss" , slideP "Discuss in the group:" , bullets [ bullet "lines covered by many people?" , bullet "lines named but not by a lot of people" , bullet "Agree less than 8 of the most important lines" ] , slideP "Take turns in the group, and let every member talk about the code for 30 seconds (could also be one sentence each). Try to add new information and not repeat things that have been said, and repeat until people do not know new things anymore." ] ) ] Summarise -> [ ( True , [ slideHeading "Summary" , timedHeading "5" "Independently" "Summarise" , slideP "The goal of this exercise is to think about the core purpose or function of this code." , bullets [ bullet "try to write down the essence of the code in a few sentences" ] ] ) , ( True , [ slideHeading "Summary" , timedHeading "8" "Together" "Discuss" , bullets [ bullet "topics covered by many vs few" , bullet "strategies used to create the summary (e.g. method names, documentation, variable names, prior knowledge of system)" ] ] ) ] -- Second Look RecapStructure importantLines -> [ ( True , [ slideHeading "Code structure" , timedHeading "5" "Independently" "Remember" , slideP "Look at the pieces that make up the code and how they connect or flow together. This exercise is meant as a recap of the first session on the code, and as a way to onboard people that might have missed the first session on this code snippet." , slideP "Looking at an annotated copy from the last session, make some notes about what parts of the code stand out and why. If you did not participate in the previous session, highlight the variables, methods and classes. Draw links between where they are instantiated and used." , bullets [ bullet "Study the patterns and think about what they tell you." ] , slideP "When we looked at this code last month, we talked about important lines together." , slideP ("These were chosen by a few people: " ++ String.join ", " (List.map String.fromInt importantLines)) ] ) , ( True , [ slideHeading "Code structure" , timedHeading "10" "Together" "Review & Summerise" , slideP "Someone who was in the previous session could summarise or where we got to or we could think about:" , bullets [ bullet "What direction does the code flow in?" , bullet "What parts stand out for lack, or excess, of links to other parts?" , bullet "What parts of the code seem to warrant more attention?" , bullet "Did anyone have trouble deciding what constituted a variable, function or class?" , bullet "What thoughts did you have when thinking about the structure?" ] ] ) ] CentralThemes -> [ ( True, [] ) ] CentralConcepts -> [ ( True, [] ) ] DecisionsMade -> [ ( True , [ slideHeading "The decisions made in the code" , timedHeading "5" "Independently" "Consider code choices" , slideP "Reexamine the code snippet and list decisions of the creator(s) of the code, for example a decision to use a certain design pattern or use a certain library or API." , bullets [ bullet "Try not to judge the decisions as good or bad" , bullet "Focus on what decisions the developer(s) had to make, not why they made them" ] , item (img [ src "example-code-decisions.png", style "height" "250px" ] []) ] ) , ( True , [ slideHeading "The decisions made in the code" , timedHeading "10" "Together" "Discuss" , bullets [ bullet "Decisions covered by many vs few" , bullet "Strategies used to decide (e.g. method names, documentation, variable names, prior knowledge of system)" ] ] ) ] DecisionsConsequences -> [ ( True , [ slideHeading "Consequences of the decisions" , timedHeading "5" "Independently" "Consider the consequences" , slideP "Think about the consequences of the decisions that were made. These could be the decisions you found yourself in the previous exercise or a decision someone else pointed out." , slideP "You might want to think consider the impact of the decisions this code on:" , bullets [ bullet "readability" , bullet "performance" , bullet "extendability" ] , item (img [ src "example-consequences.png", style "height" "210px" ] []) ] ) , ( True , [ slideHeading "Consequences of the decisions" , timedHeading "10" "Together" "Discuss" , bullets [ bullet "Consequences covered by many vs few" , bullet "Different types of consequence chosen (e.g. readability, extendability, performance)" , bullet "Pros of these decisions" , bullet "Possible cons of these decisions" ] ] ) ] DecisionsWhy -> [ ( True , [ slideHeading "The 'why' of the decisions" , timedHeading "10" "Together" "Make statements" , slideP "Can you understand why the code was designed this way?" , bullets [ bullet "What assumptions do these decisions rely on?" , bullet "Can you think of reasons these decisions might have been made?" , bullet "What alternatives would have been possible?" ] ] ) ] -- Markup helpers slideHeading : String -> CustomContent slideHeading title = item (h1 [] [ text title ]) slideHr : CustomContent slideHr = item (hr [] []) slideP : String -> CustomContent slideP paragraph = item (p [] [ text paragraph ]) slidePMarkdown : String -> CustomContent slidePMarkdown paragraph = item (Markdown.toHtml [] paragraph) timedHeading : String -> String -> String -> CustomContent timedHeading minutes who heading = let label = if minutes == "1" then " minute" else " minutes" in container (h2 []) [ item (text heading) , item (span [ class "who" ] [ text who ]) , item (span [ class "time" ] [ text (minutes ++ label) ]) ] bullets : List CustomContent -> CustomContent bullets = container (ul []) bullet : String -> CustomContent bullet str = item (li [] [ text str ]) bulletLink : String -> String -> CustomContent bulletLink str url = item (li [] [ a [ href url ] [ text str ] ]) {-| Custom slide that sets the padding and appends the custom content -} paddedSlide : ( Bool, List CustomContent ) -> CustomSlide paddedSlide ( showStopwatch, content ) = slide [ container (div [ class "slides", style "padding" "50px 100px" ]) (content ++ [ if showStopwatch then custom { displayTime = 0 , startTime = 0 , timerStarted = False } else item (img [ src "icon.png", class "stopwatch" ] []) , item (div [ class "footer" ] [ text "Slides for this workshop: https://runner.code-reading.org" ] ) ] ) ]
elm
[ { "context": "lesheet for the JSMaze game.\n-- Copyright (c) 2018 Bill St. Clair <billstclair@gmail.com>\n-- Some rights reserved.\n", "end": 167, "score": 0.999868691, "start": 153, "tag": "NAME", "value": "Bill St. Clair" }, { "context": "SMaze game.\n-- Copyright (c) 2018 Bill St. Clair <billstclair@gmail.com>\n-- Some rights reserved.\n-- Distributed under th", "end": 190, "score": 0.9999281168, "start": 169, "tag": "EMAIL", "value": "billstclair@gmail.com" } ]
src/JSMaze/Styles.elm
billstclair/elm-jsmaze
6
---------------------------------------------------------------------- -- -- Styles.elm -- The CSS Stylesheet for the JSMaze game. -- Copyright (c) 2018 Bill St. Clair <billstclair@gmail.com> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE.txt -- ---------------------------------------------------------------------- module JSMaze.Styles exposing (SClass(..), class, classes, style) import Css exposing (Sel(..)) import Html.Attributes type SClass = Error -- SVG Classes | SvgBorder | SvgLine | Svg2dPlayer | SvgLabel | SvgLabelText | SvgCell | SvgCellColor | SvgCellText | SvgObjectColor | SvgEditorHighlight imports : List String imports = [] rule : a -> b -> { selectors : a, descriptor : b } rule selectors descriptor = { selectors = selectors , descriptor = descriptor } greenColor : String greenColor = "#E0FFE0" rules = [ rule [ Class Error ] [ ( "background-color", "red" ) , ( "color", "white" ) ] -- SVG classes , rule [ Class SvgLabel ] [ ( "padding", "2px" ) , ( "fill", "#ececec" ) , ( "stroke", "white" ) , ( "stroke-width", "1" ) ] , rule [ Class SvgLabelText ] [ ( "fill", "black" ) , ( "font-weight", "bold" ) ] , rule [ Class SvgCell ] [ ( "fill-opacity", "1.0" ) , ( "stroke", "black" ) , ( "stroke-width", "1px" ) ] , rule [ Class SvgBorder ] [ ( "fill-opacity", "1.0" ) , ( "stroke", "black" ) , ( "fill", "white" ) , ( "stroke-width", "2px" ) ] , rule [ Class SvgLine ] [ ( "stroke", "black" ) , ( "stroke-width", "2px" ) ] , rule [ Class Svg2dPlayer ] [ ( "stroke", "darkgray" ) , ( "stroke-width", "1px" ) , ( "fill", "darkgray" ) ] , rule [ Class SvgCellColor ] [ ( "fill", "white" ) ] , rule [ Class SvgObjectColor ] [ ( "fill", "gray" ) ] , rule [ Class SvgCellText ] [ ( "font-weight", "bold" ) ] , rule [ Class SvgEditorHighlight ] [ ( "stroke", "lightblue" ) , ( "fill", "lightblue" ) , ( "stroke-width", "1px" ) , ( "stroke-opacity", "0.1" ) , ( "fill-opacity", "0.1" ) ] ] stylesheet = Css.stylesheet imports rules -- This is for inclusion at the beginning of the Board div style = Css.style [ Html.Attributes.scoped True ] stylesheet -- For use in the attributes of Html elements class = stylesheet.class classes = stylesheet.classes
47269
---------------------------------------------------------------------- -- -- Styles.elm -- The CSS Stylesheet for the JSMaze game. -- Copyright (c) 2018 <NAME> <<EMAIL>> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE.txt -- ---------------------------------------------------------------------- module JSMaze.Styles exposing (SClass(..), class, classes, style) import Css exposing (Sel(..)) import Html.Attributes type SClass = Error -- SVG Classes | SvgBorder | SvgLine | Svg2dPlayer | SvgLabel | SvgLabelText | SvgCell | SvgCellColor | SvgCellText | SvgObjectColor | SvgEditorHighlight imports : List String imports = [] rule : a -> b -> { selectors : a, descriptor : b } rule selectors descriptor = { selectors = selectors , descriptor = descriptor } greenColor : String greenColor = "#E0FFE0" rules = [ rule [ Class Error ] [ ( "background-color", "red" ) , ( "color", "white" ) ] -- SVG classes , rule [ Class SvgLabel ] [ ( "padding", "2px" ) , ( "fill", "#ececec" ) , ( "stroke", "white" ) , ( "stroke-width", "1" ) ] , rule [ Class SvgLabelText ] [ ( "fill", "black" ) , ( "font-weight", "bold" ) ] , rule [ Class SvgCell ] [ ( "fill-opacity", "1.0" ) , ( "stroke", "black" ) , ( "stroke-width", "1px" ) ] , rule [ Class SvgBorder ] [ ( "fill-opacity", "1.0" ) , ( "stroke", "black" ) , ( "fill", "white" ) , ( "stroke-width", "2px" ) ] , rule [ Class SvgLine ] [ ( "stroke", "black" ) , ( "stroke-width", "2px" ) ] , rule [ Class Svg2dPlayer ] [ ( "stroke", "darkgray" ) , ( "stroke-width", "1px" ) , ( "fill", "darkgray" ) ] , rule [ Class SvgCellColor ] [ ( "fill", "white" ) ] , rule [ Class SvgObjectColor ] [ ( "fill", "gray" ) ] , rule [ Class SvgCellText ] [ ( "font-weight", "bold" ) ] , rule [ Class SvgEditorHighlight ] [ ( "stroke", "lightblue" ) , ( "fill", "lightblue" ) , ( "stroke-width", "1px" ) , ( "stroke-opacity", "0.1" ) , ( "fill-opacity", "0.1" ) ] ] stylesheet = Css.stylesheet imports rules -- This is for inclusion at the beginning of the Board div style = Css.style [ Html.Attributes.scoped True ] stylesheet -- For use in the attributes of Html elements class = stylesheet.class classes = stylesheet.classes
true
---------------------------------------------------------------------- -- -- Styles.elm -- The CSS Stylesheet for the JSMaze game. -- Copyright (c) 2018 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE.txt -- ---------------------------------------------------------------------- module JSMaze.Styles exposing (SClass(..), class, classes, style) import Css exposing (Sel(..)) import Html.Attributes type SClass = Error -- SVG Classes | SvgBorder | SvgLine | Svg2dPlayer | SvgLabel | SvgLabelText | SvgCell | SvgCellColor | SvgCellText | SvgObjectColor | SvgEditorHighlight imports : List String imports = [] rule : a -> b -> { selectors : a, descriptor : b } rule selectors descriptor = { selectors = selectors , descriptor = descriptor } greenColor : String greenColor = "#E0FFE0" rules = [ rule [ Class Error ] [ ( "background-color", "red" ) , ( "color", "white" ) ] -- SVG classes , rule [ Class SvgLabel ] [ ( "padding", "2px" ) , ( "fill", "#ececec" ) , ( "stroke", "white" ) , ( "stroke-width", "1" ) ] , rule [ Class SvgLabelText ] [ ( "fill", "black" ) , ( "font-weight", "bold" ) ] , rule [ Class SvgCell ] [ ( "fill-opacity", "1.0" ) , ( "stroke", "black" ) , ( "stroke-width", "1px" ) ] , rule [ Class SvgBorder ] [ ( "fill-opacity", "1.0" ) , ( "stroke", "black" ) , ( "fill", "white" ) , ( "stroke-width", "2px" ) ] , rule [ Class SvgLine ] [ ( "stroke", "black" ) , ( "stroke-width", "2px" ) ] , rule [ Class Svg2dPlayer ] [ ( "stroke", "darkgray" ) , ( "stroke-width", "1px" ) , ( "fill", "darkgray" ) ] , rule [ Class SvgCellColor ] [ ( "fill", "white" ) ] , rule [ Class SvgObjectColor ] [ ( "fill", "gray" ) ] , rule [ Class SvgCellText ] [ ( "font-weight", "bold" ) ] , rule [ Class SvgEditorHighlight ] [ ( "stroke", "lightblue" ) , ( "fill", "lightblue" ) , ( "stroke-width", "1px" ) , ( "stroke-opacity", "0.1" ) , ( "fill-opacity", "0.1" ) ] ] stylesheet = Css.stylesheet imports rules -- This is for inclusion at the beginning of the Board div style = Css.style [ Html.Attributes.scoped True ] stylesheet -- For use in the attributes of Html elements class = stylesheet.class classes = stylesheet.classes
elm
[ { "context": "Crests : List Crest\ninitCrests =\n [ Crest 1 0 \"Flames\" \"Occasionally restores HP equal to 30% of damage", "end": 270, "score": 0.9990583658, "start": 264, "tag": "NAME", "value": "Flames" }, { "context": "es Mt and stops counterattacks.\"\n , Crest 2 3 \"Blaiddyd\" \"Occasionally doubles Atk and weapon uses for co", "end": 397, "score": 0.9996300936, "start": 389, "tag": "NAME", "value": "Blaiddyd" }, { "context": "nd weapon uses for combat arts.\"\n , Crest 3 1 \"Charon\" \"Occasionally raises Mt when using combat arts.\"", "end": 482, "score": 0.9996002913, "start": 476, "tag": "NAME", "value": "Charon" }, { "context": "ises Mt when using combat arts.\"\n , Crest 4 6 \"Daphnel\" \"Sometimes raises Mt when using combat arts.\"\n ", "end": 557, "score": 0.999614954, "start": 550, "tag": "NAME", "value": "Daphnel" }, { "context": "ises Mt when using combat arts.\"\n , Crest 5 7 \"Dominic\" \"Occasionally conserves uses of attack magic.\"\n ", "end": 629, "score": 0.9995515943, "start": 622, "tag": "NAME", "value": "Dominic" }, { "context": "onserves uses of attack magic.\"\n , Crest 6 10 \"Fraldarius\" \"Sometimes raises Mt when using a weapon.\"\n ,", "end": 706, "score": 0.9996411204, "start": 696, "tag": "NAME", "value": "Fraldarius" }, { "context": " raises Mt when using a weapon.\"\n , Crest 7 5 \"Gautier\" \"Occasionally raises Mt when using combat arts.\"", "end": 775, "score": 0.9994199872, "start": 768, "tag": "NAME", "value": "Gautier" }, { "context": "ses Mt when using combat arts.\"\n , Crest 8 11 \"Gloucester\" \"Occasionally raises Mt during magic attacks.\"\n ", "end": 854, "score": 0.999450326, "start": 844, "tag": "NAME", "value": "Gloucester" }, { "context": "raises Mt during magic attacks.\"\n , Crest 9 8 \"Goneril\" \"Sometimes allows combat arts to prevent enemy c", "end": 927, "score": 0.9994599819, "start": 920, "tag": "NAME", "value": "Goneril" }, { "context": "prevent enemy counterattacks.\"\n , Crest 10 12 \"Lamine\" \"Occasionally conserves uses of recovery magic.\"", "end": 1018, "score": 0.9992883801, "start": 1012, "tag": "NAME", "value": "Lamine" }, { "context": "serves uses of recovery magic.\"\n , Crest 11 4 \"Riegan\" \"Sometimes restores HP equal to 30% of damage de", "end": 1093, "score": 0.9996447563, "start": 1087, "tag": "NAME", "value": "Riegan" }, { "context": "dealt when using combat arts.\"\n , Crest 12 13 \"Cethleann\" \"Sometimes raises Mt when using recovery magic.\"", "end": 1200, "score": 0.9994371533, "start": 1191, "tag": "NAME", "value": "Cethleann" }, { "context": "Mt when using recovery magic.\"\n , Crest 13 14 \"Cichol\" \"Sometimes lets combat arts prevent enemy counte", "end": 1276, "score": 0.9995259643, "start": 1270, "tag": "NAME", "value": "Cichol" }, { "context": "prevent enemy counterattacks.\"\n , Crest 14 15 \"Indech\" \"Occasionally allows weapon attacks to strike tw", "end": 1362, "score": 0.9948707223, "start": 1356, "tag": "NAME", "value": "Indech" }, { "context": "apon attacks to strike twice.\"\n , Crest 15 16 \"Macuil\" \"Occasionally raises Mt during magic attacks.\"\n ", "end": 1443, "score": 0.9984290004, "start": 1437, "tag": "NAME", "value": "Macuil" }, { "context": "aises Mt during magic attacks.\"\n , Crest 16 9 \"Maurice\" \"Sometimes raises Mt when using a weapon.\"\n ,", "end": 1517, "score": 0.9984865189, "start": 1510, "tag": "NAME", "value": "Maurice" } ]
src/model/Crest.elm
Mcdouglas/fe3h-team-builder
0
module Crest exposing (getCrest, initCrests) import CustomTypes exposing (Crest) getCrest : Int -> Maybe Crest getCrest val = initCrests |> List.filter (\e -> e.id == val) |> List.head initCrests : List Crest initCrests = [ Crest 1 0 "Flames" "Occasionally restores HP equal to 30% of damage dealt. Rarely raises Mt and stops counterattacks." , Crest 2 3 "Blaiddyd" "Occasionally doubles Atk and weapon uses for combat arts." , Crest 3 1 "Charon" "Occasionally raises Mt when using combat arts." , Crest 4 6 "Daphnel" "Sometimes raises Mt when using combat arts." , Crest 5 7 "Dominic" "Occasionally conserves uses of attack magic." , Crest 6 10 "Fraldarius" "Sometimes raises Mt when using a weapon." , Crest 7 5 "Gautier" "Occasionally raises Mt when using combat arts." , Crest 8 11 "Gloucester" "Occasionally raises Mt during magic attacks." , Crest 9 8 "Goneril" "Sometimes allows combat arts to prevent enemy counterattacks." , Crest 10 12 "Lamine" "Occasionally conserves uses of recovery magic." , Crest 11 4 "Riegan" "Sometimes restores HP equal to 30% of damage dealt when using combat arts." , Crest 12 13 "Cethleann" "Sometimes raises Mt when using recovery magic." , Crest 13 14 "Cichol" "Sometimes lets combat arts prevent enemy counterattacks." , Crest 14 15 "Indech" "Occasionally allows weapon attacks to strike twice." , Crest 15 16 "Macuil" "Occasionally raises Mt during magic attacks." , Crest 16 9 "Maurice" "Sometimes raises Mt when using a weapon." , Crest 17 2 "Seiros" "Occasionally raises Mt when using combat arts." ]
3799
module Crest exposing (getCrest, initCrests) import CustomTypes exposing (Crest) getCrest : Int -> Maybe Crest getCrest val = initCrests |> List.filter (\e -> e.id == val) |> List.head initCrests : List Crest initCrests = [ Crest 1 0 "<NAME>" "Occasionally restores HP equal to 30% of damage dealt. Rarely raises Mt and stops counterattacks." , Crest 2 3 "<NAME>" "Occasionally doubles Atk and weapon uses for combat arts." , Crest 3 1 "<NAME>" "Occasionally raises Mt when using combat arts." , Crest 4 6 "<NAME>" "Sometimes raises Mt when using combat arts." , Crest 5 7 "<NAME>" "Occasionally conserves uses of attack magic." , Crest 6 10 "<NAME>" "Sometimes raises Mt when using a weapon." , Crest 7 5 "<NAME>" "Occasionally raises Mt when using combat arts." , Crest 8 11 "<NAME>" "Occasionally raises Mt during magic attacks." , Crest 9 8 "<NAME>" "Sometimes allows combat arts to prevent enemy counterattacks." , Crest 10 12 "<NAME>" "Occasionally conserves uses of recovery magic." , Crest 11 4 "<NAME>" "Sometimes restores HP equal to 30% of damage dealt when using combat arts." , Crest 12 13 "<NAME>" "Sometimes raises Mt when using recovery magic." , Crest 13 14 "<NAME>" "Sometimes lets combat arts prevent enemy counterattacks." , Crest 14 15 "<NAME>" "Occasionally allows weapon attacks to strike twice." , Crest 15 16 "<NAME>" "Occasionally raises Mt during magic attacks." , Crest 16 9 "<NAME>" "Sometimes raises Mt when using a weapon." , Crest 17 2 "Seiros" "Occasionally raises Mt when using combat arts." ]
true
module Crest exposing (getCrest, initCrests) import CustomTypes exposing (Crest) getCrest : Int -> Maybe Crest getCrest val = initCrests |> List.filter (\e -> e.id == val) |> List.head initCrests : List Crest initCrests = [ Crest 1 0 "PI:NAME:<NAME>END_PI" "Occasionally restores HP equal to 30% of damage dealt. Rarely raises Mt and stops counterattacks." , Crest 2 3 "PI:NAME:<NAME>END_PI" "Occasionally doubles Atk and weapon uses for combat arts." , Crest 3 1 "PI:NAME:<NAME>END_PI" "Occasionally raises Mt when using combat arts." , Crest 4 6 "PI:NAME:<NAME>END_PI" "Sometimes raises Mt when using combat arts." , Crest 5 7 "PI:NAME:<NAME>END_PI" "Occasionally conserves uses of attack magic." , Crest 6 10 "PI:NAME:<NAME>END_PI" "Sometimes raises Mt when using a weapon." , Crest 7 5 "PI:NAME:<NAME>END_PI" "Occasionally raises Mt when using combat arts." , Crest 8 11 "PI:NAME:<NAME>END_PI" "Occasionally raises Mt during magic attacks." , Crest 9 8 "PI:NAME:<NAME>END_PI" "Sometimes allows combat arts to prevent enemy counterattacks." , Crest 10 12 "PI:NAME:<NAME>END_PI" "Occasionally conserves uses of recovery magic." , Crest 11 4 "PI:NAME:<NAME>END_PI" "Sometimes restores HP equal to 30% of damage dealt when using combat arts." , Crest 12 13 "PI:NAME:<NAME>END_PI" "Sometimes raises Mt when using recovery magic." , Crest 13 14 "PI:NAME:<NAME>END_PI" "Sometimes lets combat arts prevent enemy counterattacks." , Crest 14 15 "PI:NAME:<NAME>END_PI" "Occasionally allows weapon attacks to strike twice." , Crest 15 16 "PI:NAME:<NAME>END_PI" "Occasionally raises Mt during magic attacks." , Crest 16 9 "PI:NAME:<NAME>END_PI" "Sometimes raises Mt when using a weapon." , Crest 17 2 "Seiros" "Occasionally raises Mt when using combat arts." ]
elm
[ { "context": " , sourceCode = Just \"https://github.com/material-components/material-components-web/tree/master/pac", "end": 953, "score": 0.748102963, "start": 953, "tag": "USERNAME", "value": "" }, { "context": "\" \"0\"\n ]\n [ text \"by Kurt Wagner\" ]\n ]\n\n\ndemoBody : Card.Block msg\ndemo", "end": 3336, "score": 0.9996701479, "start": 3325, "tag": "NAME", "value": "Kurt Wagner" } ]
demo/src/Demo/Cards.elm
alexanderkiel/material-components-web-elm
0
module Demo.Cards exposing (Model, Msg(..), defaultModel, update, view) import Demo.CatalogPage exposing (CatalogPage) import Html exposing (Html, text) import Html.Attributes exposing (style) import Material.Button as Button import Material.Card as Card import Material.IconButton as IconButton import Material.Theme as Theme import Material.Typography as Typography type alias Model = {} defaultModel : Model defaultModel = {} type Msg = NoOp update : Msg -> Model -> Model update msg model = model view : Model -> CatalogPage Msg view model = { title = "Card" , prelude = "Cards contain content and actions about a single subject." , resources = { materialDesignGuidelines = Just "https://material.io/go/design-cards" , documentation = Just "https://package.elm-lang.org/packages/aforemny/material-components-web-elm/latest/Material-Card" , sourceCode = Just "https://github.com/material-components/material-components-web/tree/master/packages/mdc-card" } , hero = heroCard , content = [ exampleCard1 , exampleCard2 , exampleCard3 ] } heroCard : List (Html msg) heroCard = [ Card.card (Card.config |> Card.setAttributes [ style "width" "350px" ] ) { blocks = Card.primaryAction [] [ demoMedia , demoTitle , demoBody ] , actions = Just demoActions } ] exampleCard1 : Html msg exampleCard1 = Card.card (Card.config |> Card.setAttributes [ style "margin" "48px 0" , style "width" "350px" ] ) { blocks = Card.primaryAction [] [ demoMedia , demoTitle , demoBody ] , actions = Nothing } exampleCard2 : Html msg exampleCard2 = Card.card (Card.config |> Card.setAttributes [ style "margin" "48px 0" , style "width" "350px" ] ) { blocks = Card.primaryAction [] [ demoTitle , demoBody ] , actions = Just demoActions } exampleCard3 : Html msg exampleCard3 = Card.card (Card.config |> Card.setAttributes [ style "margin" "48px 0" , style "width" "350px" , style "border-radius" "24px 8px" ] ) { blocks = Card.primaryAction [] [ demoTitle , demoBody ] , actions = Just demoActions } demoMedia : Card.Block msg demoMedia = Card.sixteenToNineMedia [] "images/photos/3x2/2.jpg" demoTitle : Card.Block msg demoTitle = Card.block <| Html.div [ style "padding" "1rem" ] [ Html.h2 [ Typography.headline6 , style "margin" "0" ] [ text "Our Changing Planet" ] , Html.h3 [ Typography.subtitle2 , Theme.textSecondaryOnBackground , style "margin" "0" ] [ text "by Kurt Wagner" ] ] demoBody : Card.Block msg demoBody = Card.block <| Html.div [ Typography.body2 , Theme.textSecondaryOnBackground , style "padding" "0 1rem 0.5rem 1rem" ] [ text """ Visit ten places on our planet that are undergoing the biggest changes today. """ ] demoActions : Card.Actions msg demoActions = Card.actions { buttons = [ Card.button Button.config "Read" , Card.button Button.config "Bookmark" ] , icons = [ Card.icon IconButton.config "favorite_border" , Card.icon IconButton.config "share" , Card.icon IconButton.config "more_vert" ] }
55337
module Demo.Cards exposing (Model, Msg(..), defaultModel, update, view) import Demo.CatalogPage exposing (CatalogPage) import Html exposing (Html, text) import Html.Attributes exposing (style) import Material.Button as Button import Material.Card as Card import Material.IconButton as IconButton import Material.Theme as Theme import Material.Typography as Typography type alias Model = {} defaultModel : Model defaultModel = {} type Msg = NoOp update : Msg -> Model -> Model update msg model = model view : Model -> CatalogPage Msg view model = { title = "Card" , prelude = "Cards contain content and actions about a single subject." , resources = { materialDesignGuidelines = Just "https://material.io/go/design-cards" , documentation = Just "https://package.elm-lang.org/packages/aforemny/material-components-web-elm/latest/Material-Card" , sourceCode = Just "https://github.com/material-components/material-components-web/tree/master/packages/mdc-card" } , hero = heroCard , content = [ exampleCard1 , exampleCard2 , exampleCard3 ] } heroCard : List (Html msg) heroCard = [ Card.card (Card.config |> Card.setAttributes [ style "width" "350px" ] ) { blocks = Card.primaryAction [] [ demoMedia , demoTitle , demoBody ] , actions = Just demoActions } ] exampleCard1 : Html msg exampleCard1 = Card.card (Card.config |> Card.setAttributes [ style "margin" "48px 0" , style "width" "350px" ] ) { blocks = Card.primaryAction [] [ demoMedia , demoTitle , demoBody ] , actions = Nothing } exampleCard2 : Html msg exampleCard2 = Card.card (Card.config |> Card.setAttributes [ style "margin" "48px 0" , style "width" "350px" ] ) { blocks = Card.primaryAction [] [ demoTitle , demoBody ] , actions = Just demoActions } exampleCard3 : Html msg exampleCard3 = Card.card (Card.config |> Card.setAttributes [ style "margin" "48px 0" , style "width" "350px" , style "border-radius" "24px 8px" ] ) { blocks = Card.primaryAction [] [ demoTitle , demoBody ] , actions = Just demoActions } demoMedia : Card.Block msg demoMedia = Card.sixteenToNineMedia [] "images/photos/3x2/2.jpg" demoTitle : Card.Block msg demoTitle = Card.block <| Html.div [ style "padding" "1rem" ] [ Html.h2 [ Typography.headline6 , style "margin" "0" ] [ text "Our Changing Planet" ] , Html.h3 [ Typography.subtitle2 , Theme.textSecondaryOnBackground , style "margin" "0" ] [ text "by <NAME>" ] ] demoBody : Card.Block msg demoBody = Card.block <| Html.div [ Typography.body2 , Theme.textSecondaryOnBackground , style "padding" "0 1rem 0.5rem 1rem" ] [ text """ Visit ten places on our planet that are undergoing the biggest changes today. """ ] demoActions : Card.Actions msg demoActions = Card.actions { buttons = [ Card.button Button.config "Read" , Card.button Button.config "Bookmark" ] , icons = [ Card.icon IconButton.config "favorite_border" , Card.icon IconButton.config "share" , Card.icon IconButton.config "more_vert" ] }
true
module Demo.Cards exposing (Model, Msg(..), defaultModel, update, view) import Demo.CatalogPage exposing (CatalogPage) import Html exposing (Html, text) import Html.Attributes exposing (style) import Material.Button as Button import Material.Card as Card import Material.IconButton as IconButton import Material.Theme as Theme import Material.Typography as Typography type alias Model = {} defaultModel : Model defaultModel = {} type Msg = NoOp update : Msg -> Model -> Model update msg model = model view : Model -> CatalogPage Msg view model = { title = "Card" , prelude = "Cards contain content and actions about a single subject." , resources = { materialDesignGuidelines = Just "https://material.io/go/design-cards" , documentation = Just "https://package.elm-lang.org/packages/aforemny/material-components-web-elm/latest/Material-Card" , sourceCode = Just "https://github.com/material-components/material-components-web/tree/master/packages/mdc-card" } , hero = heroCard , content = [ exampleCard1 , exampleCard2 , exampleCard3 ] } heroCard : List (Html msg) heroCard = [ Card.card (Card.config |> Card.setAttributes [ style "width" "350px" ] ) { blocks = Card.primaryAction [] [ demoMedia , demoTitle , demoBody ] , actions = Just demoActions } ] exampleCard1 : Html msg exampleCard1 = Card.card (Card.config |> Card.setAttributes [ style "margin" "48px 0" , style "width" "350px" ] ) { blocks = Card.primaryAction [] [ demoMedia , demoTitle , demoBody ] , actions = Nothing } exampleCard2 : Html msg exampleCard2 = Card.card (Card.config |> Card.setAttributes [ style "margin" "48px 0" , style "width" "350px" ] ) { blocks = Card.primaryAction [] [ demoTitle , demoBody ] , actions = Just demoActions } exampleCard3 : Html msg exampleCard3 = Card.card (Card.config |> Card.setAttributes [ style "margin" "48px 0" , style "width" "350px" , style "border-radius" "24px 8px" ] ) { blocks = Card.primaryAction [] [ demoTitle , demoBody ] , actions = Just demoActions } demoMedia : Card.Block msg demoMedia = Card.sixteenToNineMedia [] "images/photos/3x2/2.jpg" demoTitle : Card.Block msg demoTitle = Card.block <| Html.div [ style "padding" "1rem" ] [ Html.h2 [ Typography.headline6 , style "margin" "0" ] [ text "Our Changing Planet" ] , Html.h3 [ Typography.subtitle2 , Theme.textSecondaryOnBackground , style "margin" "0" ] [ text "by PI:NAME:<NAME>END_PI" ] ] demoBody : Card.Block msg demoBody = Card.block <| Html.div [ Typography.body2 , Theme.textSecondaryOnBackground , style "padding" "0 1rem 0.5rem 1rem" ] [ text """ Visit ten places on our planet that are undergoing the biggest changes today. """ ] demoActions : Card.Actions msg demoActions = Card.actions { buttons = [ Card.button Button.config "Read" , Card.button Button.config "Bookmark" ] , icons = [ Card.icon IconButton.config "favorite_border" , Card.icon IconButton.config "share" , Card.icon IconButton.config "more_vert" ] }
elm
[ { "context": "at\n ]\n , test \"E Dorian\" <|\n \\() ->\n Ex", "end": 3091, "score": 0.647969842, "start": 3085, "tag": "NAME", "value": "Dorian" }, { "context": "arp\n ]\n , test \"Fb Dorian\" <|\n \\() ->\n Ex", "end": 3999, "score": 0.7633854747, "start": 3990, "tag": "NAME", "value": "Fb Dorian" }, { "context": "at\n ]\n , test \"F Dorian\" <|\n \\() ->\n Ex", "end": 4445, "score": 0.652118504, "start": 4439, "tag": "NAME", "value": "Dorian" }, { "context": " ]\n , test \"F# Dorian\" <|\n \\() ->\n Ex", "end": 4895, "score": 0.4735044837, "start": 4890, "tag": "NAME", "value": "orian" }, { "context": "l\n ]\n , test \"Gb Dorian\" <|\n \\() ->\n Ex", "end": 5344, "score": 0.6218290925, "start": 5338, "tag": "NAME", "value": "Dorian" }, { "context": "\n ]\n , test \"G Dorian\" <|\n \\() ->\n Ex", "end": 5782, "score": 0.5593695045, "start": 5777, "tag": "NAME", "value": "orian" }, { "context": "l\n ]\n , test \"G# Dorian\" <|\n \\() ->\n Ex", "end": 6238, "score": 0.7810356617, "start": 6232, "tag": "NAME", "value": "Dorian" }, { "context": "arp\n ]\n , test \"Ab Dorian\" <|\n \\() ->\n Ex", "end": 6683, "score": 0.8313353062, "start": 6674, "tag": "NAME", "value": "Ab Dorian" }, { "context": "at\n ]\n , test \"A Dorian\" <|\n \\() ->\n Ex", "end": 7120, "score": 0.7189486027, "start": 7114, "tag": "NAME", "value": "Dorian" }, { "context": "l\n ]\n , test \"A# Dorian\" <|\n \\() ->\n Ex", "end": 7577, "score": 0.708444953, "start": 7571, "tag": "NAME", "value": "Dorian" }, { "context": "p\n ]\n , test \"Bb Dorian\" <|\n \\() ->\n Ex", "end": 8025, "score": 0.7268033624, "start": 8019, "tag": "NAME", "value": "Dorian" }, { "context": "at\n ]\n , test \"B Dorian\" <|\n \\() ->\n Ex", "end": 8468, "score": 0.6819266081, "start": 8462, "tag": "NAME", "value": "Dorian" }, { "context": " ]\n , test \"B# Dorian\" <|\n \\() ->\n Ex", "end": 8921, "score": 0.6211068034, "start": 8916, "tag": "NAME", "value": "orian" } ]
tests/Scale/DorianTests.elm
rpmessner/elm-maestro
1
module Scale.DorianTests exposing (all) import Maestro.Note exposing (Note) import Maestro.Tone exposing (Key(..), Adjustment(..), newTone) import Maestro.Interval exposing (Interval(..), Degree(..)) import Maestro.Scale exposing (Scale, Mode(..), scale) import Test exposing (..) import Expect all : Test all = describe "Dorian test suite" [ describe "dorian mode tests" [ test "C Dorian" <| \() -> Expect.equal (scale (newTone C Natural) Dorian) [ newTone C Natural , newTone D Natural , newTone E Flat , newTone F Natural , newTone G Natural , newTone A Natural , newTone B Flat ] , test "C# Dorian" <| \() -> Expect.equal (scale (newTone C Sharp) Dorian) [ newTone C Sharp , newTone D Sharp , newTone E Natural , newTone F Sharp , newTone G Sharp , newTone A Sharp , newTone B Natural ] , test "Db Dorian" <| \() -> Expect.equal (scale (newTone D Flat) Dorian) [ newTone D Flat , newTone E Flat , newTone F Flat , newTone G Flat , newTone A Flat , newTone B Flat , newTone C Flat ] , test "D Dorian" <| \() -> Expect.equal (scale (newTone D Natural) Dorian) [ newTone D Natural , newTone E Natural , newTone F Natural , newTone G Natural , newTone A Natural , newTone B Natural , newTone C Natural ] , test "D# Dorian" <| \() -> Expect.equal (scale (newTone D Sharp) Dorian) [ newTone D Sharp , newTone E Sharp , newTone F Sharp , newTone G Sharp , newTone A Sharp , newTone B Sharp , newTone C Sharp ] , test "Eb Dorian" <| \() -> Expect.equal (scale (newTone E Flat) Dorian) [ newTone E Flat , newTone F Natural , newTone G Flat , newTone A Flat , newTone B Flat , newTone C Natural , newTone D Flat ] , test "E Dorian" <| \() -> Expect.equal (scale (newTone E Natural) Dorian) [ newTone E Natural , newTone F Sharp , newTone G Natural , newTone A Natural , newTone B Natural , newTone C Sharp , newTone D Natural ] , test "E# Dorian" <| \() -> Expect.equal (scale (newTone E Sharp) Dorian) [ newTone E Sharp , newTone F SharpSharp , newTone G Sharp , newTone A Sharp , newTone B Sharp , newTone C SharpSharp , newTone D Sharp ] , test "Fb Dorian" <| \() -> Expect.equal (scale (newTone F Flat) Dorian) [ newTone F Flat , newTone G Flat , newTone A FlatFlat , newTone B FlatFlat , newTone C Flat , newTone D Flat , newTone E FlatFlat ] , test "F Dorian" <| \() -> Expect.equal (scale (newTone F Natural) Dorian) [ newTone F Natural , newTone G Natural , newTone A Flat , newTone B Flat , newTone C Natural , newTone D Natural , newTone E Flat ] , test "F# Dorian" <| \() -> Expect.equal (scale (newTone F Sharp) Dorian) [ newTone F Sharp , newTone G Sharp , newTone A Natural , newTone B Natural , newTone C Sharp , newTone D Sharp , newTone E Natural ] , test "Gb Dorian" <| \() -> Expect.equal (scale (newTone G Flat) Dorian) [ newTone G Flat , newTone A Flat , newTone B FlatFlat , newTone C Flat , newTone D Flat , newTone E Flat , newTone F Flat ] , test "G Dorian" <| \() -> Expect.equal (scale (newTone G Natural) Dorian) [ newTone G Natural , newTone A Natural , newTone B Flat , newTone C Natural , newTone D Natural , newTone E Natural , newTone F Natural ] , test "G# Dorian" <| \() -> Expect.equal (scale (newTone G Sharp) Dorian) [ newTone G Sharp , newTone A Sharp , newTone B Natural , newTone C Sharp , newTone D Sharp , newTone E Sharp , newTone F Sharp ] , test "Ab Dorian" <| \() -> Expect.equal (scale (newTone A Flat) Dorian) [ newTone A Flat , newTone B Flat , newTone C Flat , newTone D Flat , newTone E Flat , newTone F Natural , newTone G Flat ] , test "A Dorian" <| \() -> Expect.equal (scale (newTone A Natural) Dorian) [ newTone A Natural , newTone B Natural , newTone C Natural , newTone D Natural , newTone E Natural , newTone F Sharp , newTone G Natural ] , test "A# Dorian" <| \() -> Expect.equal (scale (newTone A Sharp) Dorian) [ newTone A Sharp , newTone B Sharp , newTone C Sharp , newTone D Sharp , newTone E Sharp , newTone F SharpSharp , newTone G Sharp ] , test "Bb Dorian" <| \() -> Expect.equal (scale (newTone B Flat) Dorian) [ newTone B Flat , newTone C Natural , newTone D Flat , newTone E Flat , newTone F Natural , newTone G Natural , newTone A Flat ] , test "B Dorian" <| \() -> Expect.equal (scale (newTone B Natural) Dorian) [ newTone B Natural , newTone C Sharp , newTone D Natural , newTone E Natural , newTone F Sharp , newTone G Sharp , newTone A Natural ] , test "B# Dorian" <| \() -> Expect.equal (scale (newTone B Sharp) Dorian) [ newTone B Sharp , newTone C SharpSharp , newTone D Sharp , newTone E Sharp , newTone F SharpSharp , newTone G SharpSharp , newTone A Sharp ] ] ]
35834
module Scale.DorianTests exposing (all) import Maestro.Note exposing (Note) import Maestro.Tone exposing (Key(..), Adjustment(..), newTone) import Maestro.Interval exposing (Interval(..), Degree(..)) import Maestro.Scale exposing (Scale, Mode(..), scale) import Test exposing (..) import Expect all : Test all = describe "Dorian test suite" [ describe "dorian mode tests" [ test "C Dorian" <| \() -> Expect.equal (scale (newTone C Natural) Dorian) [ newTone C Natural , newTone D Natural , newTone E Flat , newTone F Natural , newTone G Natural , newTone A Natural , newTone B Flat ] , test "C# Dorian" <| \() -> Expect.equal (scale (newTone C Sharp) Dorian) [ newTone C Sharp , newTone D Sharp , newTone E Natural , newTone F Sharp , newTone G Sharp , newTone A Sharp , newTone B Natural ] , test "Db Dorian" <| \() -> Expect.equal (scale (newTone D Flat) Dorian) [ newTone D Flat , newTone E Flat , newTone F Flat , newTone G Flat , newTone A Flat , newTone B Flat , newTone C Flat ] , test "D Dorian" <| \() -> Expect.equal (scale (newTone D Natural) Dorian) [ newTone D Natural , newTone E Natural , newTone F Natural , newTone G Natural , newTone A Natural , newTone B Natural , newTone C Natural ] , test "D# Dorian" <| \() -> Expect.equal (scale (newTone D Sharp) Dorian) [ newTone D Sharp , newTone E Sharp , newTone F Sharp , newTone G Sharp , newTone A Sharp , newTone B Sharp , newTone C Sharp ] , test "Eb Dorian" <| \() -> Expect.equal (scale (newTone E Flat) Dorian) [ newTone E Flat , newTone F Natural , newTone G Flat , newTone A Flat , newTone B Flat , newTone C Natural , newTone D Flat ] , test "E <NAME>" <| \() -> Expect.equal (scale (newTone E Natural) Dorian) [ newTone E Natural , newTone F Sharp , newTone G Natural , newTone A Natural , newTone B Natural , newTone C Sharp , newTone D Natural ] , test "E# Dorian" <| \() -> Expect.equal (scale (newTone E Sharp) Dorian) [ newTone E Sharp , newTone F SharpSharp , newTone G Sharp , newTone A Sharp , newTone B Sharp , newTone C SharpSharp , newTone D Sharp ] , test "<NAME>" <| \() -> Expect.equal (scale (newTone F Flat) Dorian) [ newTone F Flat , newTone G Flat , newTone A FlatFlat , newTone B FlatFlat , newTone C Flat , newTone D Flat , newTone E FlatFlat ] , test "F <NAME>" <| \() -> Expect.equal (scale (newTone F Natural) Dorian) [ newTone F Natural , newTone G Natural , newTone A Flat , newTone B Flat , newTone C Natural , newTone D Natural , newTone E Flat ] , test "F# D<NAME>" <| \() -> Expect.equal (scale (newTone F Sharp) Dorian) [ newTone F Sharp , newTone G Sharp , newTone A Natural , newTone B Natural , newTone C Sharp , newTone D Sharp , newTone E Natural ] , test "Gb <NAME>" <| \() -> Expect.equal (scale (newTone G Flat) Dorian) [ newTone G Flat , newTone A Flat , newTone B FlatFlat , newTone C Flat , newTone D Flat , newTone E Flat , newTone F Flat ] , test "G D<NAME>" <| \() -> Expect.equal (scale (newTone G Natural) Dorian) [ newTone G Natural , newTone A Natural , newTone B Flat , newTone C Natural , newTone D Natural , newTone E Natural , newTone F Natural ] , test "G# <NAME>" <| \() -> Expect.equal (scale (newTone G Sharp) Dorian) [ newTone G Sharp , newTone A Sharp , newTone B Natural , newTone C Sharp , newTone D Sharp , newTone E Sharp , newTone F Sharp ] , test "<NAME>" <| \() -> Expect.equal (scale (newTone A Flat) Dorian) [ newTone A Flat , newTone B Flat , newTone C Flat , newTone D Flat , newTone E Flat , newTone F Natural , newTone G Flat ] , test "A <NAME>" <| \() -> Expect.equal (scale (newTone A Natural) Dorian) [ newTone A Natural , newTone B Natural , newTone C Natural , newTone D Natural , newTone E Natural , newTone F Sharp , newTone G Natural ] , test "A# <NAME>" <| \() -> Expect.equal (scale (newTone A Sharp) Dorian) [ newTone A Sharp , newTone B Sharp , newTone C Sharp , newTone D Sharp , newTone E Sharp , newTone F SharpSharp , newTone G Sharp ] , test "Bb <NAME>" <| \() -> Expect.equal (scale (newTone B Flat) Dorian) [ newTone B Flat , newTone C Natural , newTone D Flat , newTone E Flat , newTone F Natural , newTone G Natural , newTone A Flat ] , test "B <NAME>" <| \() -> Expect.equal (scale (newTone B Natural) Dorian) [ newTone B Natural , newTone C Sharp , newTone D Natural , newTone E Natural , newTone F Sharp , newTone G Sharp , newTone A Natural ] , test "B# D<NAME>" <| \() -> Expect.equal (scale (newTone B Sharp) Dorian) [ newTone B Sharp , newTone C SharpSharp , newTone D Sharp , newTone E Sharp , newTone F SharpSharp , newTone G SharpSharp , newTone A Sharp ] ] ]
true
module Scale.DorianTests exposing (all) import Maestro.Note exposing (Note) import Maestro.Tone exposing (Key(..), Adjustment(..), newTone) import Maestro.Interval exposing (Interval(..), Degree(..)) import Maestro.Scale exposing (Scale, Mode(..), scale) import Test exposing (..) import Expect all : Test all = describe "Dorian test suite" [ describe "dorian mode tests" [ test "C Dorian" <| \() -> Expect.equal (scale (newTone C Natural) Dorian) [ newTone C Natural , newTone D Natural , newTone E Flat , newTone F Natural , newTone G Natural , newTone A Natural , newTone B Flat ] , test "C# Dorian" <| \() -> Expect.equal (scale (newTone C Sharp) Dorian) [ newTone C Sharp , newTone D Sharp , newTone E Natural , newTone F Sharp , newTone G Sharp , newTone A Sharp , newTone B Natural ] , test "Db Dorian" <| \() -> Expect.equal (scale (newTone D Flat) Dorian) [ newTone D Flat , newTone E Flat , newTone F Flat , newTone G Flat , newTone A Flat , newTone B Flat , newTone C Flat ] , test "D Dorian" <| \() -> Expect.equal (scale (newTone D Natural) Dorian) [ newTone D Natural , newTone E Natural , newTone F Natural , newTone G Natural , newTone A Natural , newTone B Natural , newTone C Natural ] , test "D# Dorian" <| \() -> Expect.equal (scale (newTone D Sharp) Dorian) [ newTone D Sharp , newTone E Sharp , newTone F Sharp , newTone G Sharp , newTone A Sharp , newTone B Sharp , newTone C Sharp ] , test "Eb Dorian" <| \() -> Expect.equal (scale (newTone E Flat) Dorian) [ newTone E Flat , newTone F Natural , newTone G Flat , newTone A Flat , newTone B Flat , newTone C Natural , newTone D Flat ] , test "E PI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone E Natural) Dorian) [ newTone E Natural , newTone F Sharp , newTone G Natural , newTone A Natural , newTone B Natural , newTone C Sharp , newTone D Natural ] , test "E# Dorian" <| \() -> Expect.equal (scale (newTone E Sharp) Dorian) [ newTone E Sharp , newTone F SharpSharp , newTone G Sharp , newTone A Sharp , newTone B Sharp , newTone C SharpSharp , newTone D Sharp ] , test "PI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone F Flat) Dorian) [ newTone F Flat , newTone G Flat , newTone A FlatFlat , newTone B FlatFlat , newTone C Flat , newTone D Flat , newTone E FlatFlat ] , test "F PI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone F Natural) Dorian) [ newTone F Natural , newTone G Natural , newTone A Flat , newTone B Flat , newTone C Natural , newTone D Natural , newTone E Flat ] , test "F# DPI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone F Sharp) Dorian) [ newTone F Sharp , newTone G Sharp , newTone A Natural , newTone B Natural , newTone C Sharp , newTone D Sharp , newTone E Natural ] , test "Gb PI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone G Flat) Dorian) [ newTone G Flat , newTone A Flat , newTone B FlatFlat , newTone C Flat , newTone D Flat , newTone E Flat , newTone F Flat ] , test "G DPI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone G Natural) Dorian) [ newTone G Natural , newTone A Natural , newTone B Flat , newTone C Natural , newTone D Natural , newTone E Natural , newTone F Natural ] , test "G# PI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone G Sharp) Dorian) [ newTone G Sharp , newTone A Sharp , newTone B Natural , newTone C Sharp , newTone D Sharp , newTone E Sharp , newTone F Sharp ] , test "PI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone A Flat) Dorian) [ newTone A Flat , newTone B Flat , newTone C Flat , newTone D Flat , newTone E Flat , newTone F Natural , newTone G Flat ] , test "A PI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone A Natural) Dorian) [ newTone A Natural , newTone B Natural , newTone C Natural , newTone D Natural , newTone E Natural , newTone F Sharp , newTone G Natural ] , test "A# PI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone A Sharp) Dorian) [ newTone A Sharp , newTone B Sharp , newTone C Sharp , newTone D Sharp , newTone E Sharp , newTone F SharpSharp , newTone G Sharp ] , test "Bb PI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone B Flat) Dorian) [ newTone B Flat , newTone C Natural , newTone D Flat , newTone E Flat , newTone F Natural , newTone G Natural , newTone A Flat ] , test "B PI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone B Natural) Dorian) [ newTone B Natural , newTone C Sharp , newTone D Natural , newTone E Natural , newTone F Sharp , newTone G Sharp , newTone A Natural ] , test "B# DPI:NAME:<NAME>END_PI" <| \() -> Expect.equal (scale (newTone B Sharp) Dorian) [ newTone B Sharp , newTone C SharpSharp , newTone D Sharp , newTone E Sharp , newTone F SharpSharp , newTone G SharpSharp , newTone A Sharp ] ] ]
elm
[ { "context": "\n\r\ntitleSlide = \"\"\"\r\n\r\n# Lunch-dragning om Elm\r\n\r\nJohan Strand\r\n\r\n2016-11-15\r\n\r\n\"\"\"\r\n\r\nslideStyles = style [\r\n ", "end": 146, "score": 0.9998968244, "start": 134, "tag": "NAME", "value": "Johan Strand" } ]
Step4/Presentation.elm
jstrand/elm-lunch
0
import Html exposing (..) import Html.Attributes exposing (style) import Markdown titleSlide = """ # Lunch-dragning om Elm Johan Strand 2016-11-15 """ slideStyles = style [ ("width", "40em") , ("margin", "auto") , ("margin-top", "4em") , ("font-family", "Helvetica") , ("font-size", "18pt") ] main = Markdown.toHtml [slideStyles] titleSlide
52519
import Html exposing (..) import Html.Attributes exposing (style) import Markdown titleSlide = """ # Lunch-dragning om Elm <NAME> 2016-11-15 """ slideStyles = style [ ("width", "40em") , ("margin", "auto") , ("margin-top", "4em") , ("font-family", "Helvetica") , ("font-size", "18pt") ] main = Markdown.toHtml [slideStyles] titleSlide
true
import Html exposing (..) import Html.Attributes exposing (style) import Markdown titleSlide = """ # Lunch-dragning om Elm PI:NAME:<NAME>END_PI 2016-11-15 """ slideStyles = style [ ("width", "40em") , ("margin", "auto") , ("margin-top", "4em") , ("font-family", "Helvetica") , ("font-size", "18pt") ] main = Markdown.toHtml [slideStyles] titleSlide
elm
[ { "context": "object\n [ ( \"name\", Encode.string \"Dummy\" )\n , ( \"nickname\", Encode.string ", "end": 1746, "score": 0.7635791898, "start": 1741, "tag": "NAME", "value": "Dummy" }, { "context": "]\n )\n , ( \"token\", Encode.string \"SiM_0L{vErI0\" )\n ]\n\n\nauthFlow : Test\nauthFlow =", "end": 2002, "score": 0.8021378517, "start": 1998, "tag": "PASSWORD", "value": "SiM_" } ]
example/tests/Example.elm
PaackEng/frontend-elm-kit
7
module Example exposing (authFlow) import Iso8601 import Json.Encode as Encode import Main.Model exposing (Flags, Model, authConfig) import Main.Msg as Msg exposing (Msg) import Paack.Auth.Main as Auth import Paack.Auth.User as User import Paack.Effects exposing (Effects) import Paack.Effects.Simulator exposing (simulator) import Paack.ProgramTest as Paack exposing (ProgramDefinition) import ProgramTest exposing (ProgramTest, expectViewHas) import SimulatedEffect.Ports import Test exposing (..) import Test.Html.Selector exposing (text) import Time start : ProgramTest Model Msg (Effects Msg) start = programDefinition |> ProgramTest.withBaseUrl "http://localhost:1234/" |> ProgramTest.withSimulatedEffects simulator |> ProgramTest.withSimulatedSubscriptions simulateSubscriptions |> ProgramTest.start mockFlags mockFlags : Flags mockFlags = { innerWidth = 1920 , innerHeight = 1080 , randomSeed1 = -1 , randomSeed2 = -1 , randomSeed3 = -1 , randomSeed4 = -1 , rollbarToken = "" , mixpanelToken = "" , mixpanelAnonId = Nothing } programDefinition : ProgramDefinition programDefinition = Paack.createApplication { onUrlRequest = Msg.LinkClicked , onUrlChange = Msg.UrlChanged , getRenderConfig = .appConfig >> .renderConfig , getPage = .page } simulateSubscriptions : Model -> ProgramTest.SimulatedSub Msg simulateSubscriptions _ = SimulatedEffect.Ports.subscribe "authResult" User.decoder (always <| Auth.mockResult authConfig mockLogin) mockLogin : Encode.Value mockLogin = Encode.object [ ( "userData" , Encode.object [ ( "name", Encode.string "Dummy" ) , ( "nickname", Encode.string "Dummy" ) , ( "sub", Encode.string "dummy" ) , ( "updated_at", Iso8601.encode <| Time.millisToPosix 0 ) ] ) , ( "token", Encode.string "SiM_0L{vErI0" ) ] authFlow : Test authFlow = describe "Auth flow" [ test "Shows loading indicator" <| \() -> start |> expectViewHas [ text "Authenticating" ] , test "Shows user name" <| \() -> start |> ProgramTest.simulateIncomingPort "authResult" mockLogin |> expectViewHas [ text "Dummy" ] ]
23005
module Example exposing (authFlow) import Iso8601 import Json.Encode as Encode import Main.Model exposing (Flags, Model, authConfig) import Main.Msg as Msg exposing (Msg) import Paack.Auth.Main as Auth import Paack.Auth.User as User import Paack.Effects exposing (Effects) import Paack.Effects.Simulator exposing (simulator) import Paack.ProgramTest as Paack exposing (ProgramDefinition) import ProgramTest exposing (ProgramTest, expectViewHas) import SimulatedEffect.Ports import Test exposing (..) import Test.Html.Selector exposing (text) import Time start : ProgramTest Model Msg (Effects Msg) start = programDefinition |> ProgramTest.withBaseUrl "http://localhost:1234/" |> ProgramTest.withSimulatedEffects simulator |> ProgramTest.withSimulatedSubscriptions simulateSubscriptions |> ProgramTest.start mockFlags mockFlags : Flags mockFlags = { innerWidth = 1920 , innerHeight = 1080 , randomSeed1 = -1 , randomSeed2 = -1 , randomSeed3 = -1 , randomSeed4 = -1 , rollbarToken = "" , mixpanelToken = "" , mixpanelAnonId = Nothing } programDefinition : ProgramDefinition programDefinition = Paack.createApplication { onUrlRequest = Msg.LinkClicked , onUrlChange = Msg.UrlChanged , getRenderConfig = .appConfig >> .renderConfig , getPage = .page } simulateSubscriptions : Model -> ProgramTest.SimulatedSub Msg simulateSubscriptions _ = SimulatedEffect.Ports.subscribe "authResult" User.decoder (always <| Auth.mockResult authConfig mockLogin) mockLogin : Encode.Value mockLogin = Encode.object [ ( "userData" , Encode.object [ ( "name", Encode.string "<NAME>" ) , ( "nickname", Encode.string "Dummy" ) , ( "sub", Encode.string "dummy" ) , ( "updated_at", Iso8601.encode <| Time.millisToPosix 0 ) ] ) , ( "token", Encode.string "<PASSWORD>0L{vErI0" ) ] authFlow : Test authFlow = describe "Auth flow" [ test "Shows loading indicator" <| \() -> start |> expectViewHas [ text "Authenticating" ] , test "Shows user name" <| \() -> start |> ProgramTest.simulateIncomingPort "authResult" mockLogin |> expectViewHas [ text "Dummy" ] ]
true
module Example exposing (authFlow) import Iso8601 import Json.Encode as Encode import Main.Model exposing (Flags, Model, authConfig) import Main.Msg as Msg exposing (Msg) import Paack.Auth.Main as Auth import Paack.Auth.User as User import Paack.Effects exposing (Effects) import Paack.Effects.Simulator exposing (simulator) import Paack.ProgramTest as Paack exposing (ProgramDefinition) import ProgramTest exposing (ProgramTest, expectViewHas) import SimulatedEffect.Ports import Test exposing (..) import Test.Html.Selector exposing (text) import Time start : ProgramTest Model Msg (Effects Msg) start = programDefinition |> ProgramTest.withBaseUrl "http://localhost:1234/" |> ProgramTest.withSimulatedEffects simulator |> ProgramTest.withSimulatedSubscriptions simulateSubscriptions |> ProgramTest.start mockFlags mockFlags : Flags mockFlags = { innerWidth = 1920 , innerHeight = 1080 , randomSeed1 = -1 , randomSeed2 = -1 , randomSeed3 = -1 , randomSeed4 = -1 , rollbarToken = "" , mixpanelToken = "" , mixpanelAnonId = Nothing } programDefinition : ProgramDefinition programDefinition = Paack.createApplication { onUrlRequest = Msg.LinkClicked , onUrlChange = Msg.UrlChanged , getRenderConfig = .appConfig >> .renderConfig , getPage = .page } simulateSubscriptions : Model -> ProgramTest.SimulatedSub Msg simulateSubscriptions _ = SimulatedEffect.Ports.subscribe "authResult" User.decoder (always <| Auth.mockResult authConfig mockLogin) mockLogin : Encode.Value mockLogin = Encode.object [ ( "userData" , Encode.object [ ( "name", Encode.string "PI:NAME:<NAME>END_PI" ) , ( "nickname", Encode.string "Dummy" ) , ( "sub", Encode.string "dummy" ) , ( "updated_at", Iso8601.encode <| Time.millisToPosix 0 ) ] ) , ( "token", Encode.string "PI:PASSWORD:<PASSWORD>END_PI0L{vErI0" ) ] authFlow : Test authFlow = describe "Auth flow" [ test "Shows loading indicator" <| \() -> start |> expectViewHas [ text "Authenticating" ] , test "Shows user name" <| \() -> start |> ProgramTest.simulateIncomingPort "authResult" mockLogin |> expectViewHas [ text "Dummy" ] ]
elm
[ { "context": "name\n\n\nmain =\n let\n name =\n \"James Moore\"\n\n length =\n String.length name", "end": 232, "score": 0.9990938902, "start": 221, "tag": "NAME", "value": "James Moore" } ]
Exercise2.elm
alejandronanez/elm-exercises
0
module Main exposing (..) import Html import String capitalize maxLength name = if String.length name > maxLength then String.toUpper name else name main = let name = "James Moore" length = String.length name in (capitalize 10 name) ++ " - name length: " ++ (toString length) |> Html.text
59702
module Main exposing (..) import Html import String capitalize maxLength name = if String.length name > maxLength then String.toUpper name else name main = let name = "<NAME>" length = String.length name in (capitalize 10 name) ++ " - name length: " ++ (toString length) |> Html.text
true
module Main exposing (..) import Html import String capitalize maxLength name = if String.length name > maxLength then String.toUpper name else name main = let name = "PI:NAME:<NAME>END_PI" length = String.length name in (capitalize 10 name) ++ " - name length: " ++ (toString length) |> Html.text
elm
[ { "context": "s, DarkForest ] Fall PhantomBeast\n , Monster \"Kamaitachi\" 2 [ Grassland, Wasteland, RockyTerrain ] Winter ", "end": 648, "score": 0.683288455, "start": 639, "tag": "NAME", "value": "amaitachi" }, { "context": "s, Wasteland ] Winter PhantomBeast\n , Monster \"Zordfish\" 4 [ River, Swamp ] Winter PhantomBeast\n , Mon", "end": 1481, "score": 0.9749765396, "start": 1473, "tag": "NAME", "value": "Zordfish" }, { "context": "River, Swamp ] Winter PhantomBeast\n , Monster \"Hellhound\" 5 [ Wasteland, Woods, Mountain ] Winter PhantomB", "end": 1546, "score": 0.9864092469, "start": 1537, "tag": "NAME", "value": "Hellhound" }, { "context": "ds, Mountain ] Winter PhantomBeast\n , Monster \"Demoncat\" 5 [ Woods, DarkForest, Jungle, Mountain ] Winter", "end": 1624, "score": 0.9812412262, "start": 1616, "tag": "NAME", "value": "Demoncat" }, { "context": "le, Mountain ] Winter PhantomBeast\n , Monster \"Maximillion Kabuto\" 5 [ DarkForest, Woods, Mountain ] Summer Phantom", "end": 1721, "score": 0.9914516807, "start": 1703, "tag": "NAME", "value": "Maximillion Kabuto" }, { "context": "ds, Mountain ] Summer PhantomBeast\n , Monster \"Tumbling Nest\" 5 [ Grassland, Wasteland, Highlands ] Fall Phant", "end": 1805, "score": 0.7265526056, "start": 1792, "tag": "NAME", "value": "Tumbling Nest" }, { "context": "and, Highlands ] Fall PhantomBeast\n , Monster \"Chimaera\" 6 [ Wasteland, DarkForest, Mountain, Jungle ] Su", "end": 1886, "score": 0.9516320229, "start": 1878, "tag": "NAME", "value": "Chimaera" }, { "context": "tain, Jungle ] Summer PhantomBeast\n , Monster \"Milk Maid\" 6 [ Sea ] Spring PhantomBeast\n , Monster \"Bas", "end": 1978, "score": 0.8909858465, "start": 1969, "tag": "NAME", "value": "Milk Maid" }, { "context": "aid\" 6 [ Sea ] Spring PhantomBeast\n , Monster \"Basilisk\" 7 [ Desert, Wasteland, Mountain, RockyTerrain ] ", "end": 2033, "score": 0.9285462499, "start": 2025, "tag": "NAME", "value": "Basilisk" }, { "context": ", RockyTerrain ] Fall PhantomBeast\n , Monster \"Garden Tortoise\" 10 [ DarkForest, Jungle, Mountain, Alpine ] Summ", "end": 2131, "score": 0.6519795656, "start": 2116, "tag": "NAME", "value": "Garden Tortoise" }, { "context": " Alpine ] Summer PhantomBeast\n , Monster \"Ghost Beast\" 12 [ Alpine, Desert, Sea, AllHighLevelTerrain ] ", "end": 2223, "score": 0.6485095024, "start": 2218, "tag": "NAME", "value": "Beast" }, { "context": "LevelTerrain ] Spring PhantomBeast\n , Monster \"Napalm Palm\" 2 [ Desert, Wasteland, Mountain ] Winter Phantom", "end": 2319, "score": 0.9204667807, "start": 2308, "tag": "NAME", "value": "Napalm Palm" }, { "context": "nd, Mountain ] Winter PhantomPlant\n , Monster \"Myconid\" 2 [ Woods, DarkForest, Jungle ] Fall PhantomPlan", "end": 2397, "score": 0.9385791421, "start": 2390, "tag": "NAME", "value": "Myconid" }, { "context": "Forest, Jungle ] Fall PhantomPlant\n , Monster \"Tyrant Rose\" 3 [ Woods, DarkForest, Highlands, Grassland, Was", "end": 2475, "score": 0.9321255684, "start": 2464, "tag": "NAME", "value": "Tyrant Rose" }, { "context": "Wasteland ] Spring PhantomPlant\n , Monster \"Parasite Eggplant\" 3 [ Woods, DarkForest, Jungle ] Spring PhantomPl", "end": 2586, "score": 0.5967600942, "start": 2572, "tag": "NAME", "value": "asite Eggplant" }, { "context": "rest, Jungle ] Spring PhantomPlant\n , Monster \"Charming Rafflesia\" 4 [ Grassland, Wasteland, Woods ] Spring Phantom", "end": 2673, "score": 0.9539020061, "start": 2655, "tag": "NAME", "value": "Charming Rafflesia" }, { "context": ", Woods ] Spring PhantomPlant\n , Monster \"Death Grass\" 5 [ Grassland, Swamp ] Spring PhantomPlant\n ,", "end": 2755, "score": 0.7093073726, "start": 2750, "tag": "NAME", "value": "Grass" }, { "context": " LowAlpines ] Summer PhantomPlant\n , Monster \"Koneko-goblin\" 2 [ AllTerrain ] Spring Nekogoblin\n ", "end": 3208, "score": 0.6216418147, "start": 3205, "tag": "NAME", "value": "one" }, { "context": "es ] Summer PhantomPlant\n , Monster \"Koneko-goblin\" 2 [ AllTerrain ] Spring Nekogoblin\n , Monster", "end": 3217, "score": 0.5614578128, "start": 3214, "tag": "NAME", "value": "lin" }, { "context": " [ AllTerrain ] Spring Nekogoblin\n , Monster \"Neko-goblin\" 3 [ AllTerrain ] Spring Nekogoblin\n ,", "end": 3272, "score": 0.5150073767, "start": 3270, "tag": "NAME", "value": "ek" }, { "context": " [ AllTerrain ] Spring Nekogoblin\n , Monster \"Hobneko-goblin\" 5 [ AllTerrain ] Spring Nekogoblin\n ", "end": 3335, "score": 0.5149735808, "start": 3333, "tag": "NAME", "value": "ob" }, { "context": "in, Desert ] NoSeason Demonstone\n , Monster \"Moai\" 5 [ AllTerrain ] NoSeason Demonstone\n , Monst", "end": 3634, "score": 0.514870584, "start": 3632, "tag": "NAME", "value": "ai" }, { "context": "es\" 6 [ AllTerrain ] Summer Undead\n , Monster \"Vampire\" 7 [ AllTerrain ] Summer Undead\n , Monster \"La", "end": 4291, "score": 0.5303438902, "start": 4284, "tag": "NAME", "value": "Vampire" }, { "context": "e\" 7 [ AllTerrain ] Summer Undead\n , Monster \"Lady Saucer\" 9 [ AllTerrain ] Fall Undead\n , Monste", "end": 4343, "score": 0.5226092935, "start": 4340, "tag": "NAME", "value": "ady" }, { "context": " AllTerrain ] Summer Undead\n , Monster \"Lady Saucer\" 9 [ AllTerrain ] Fall Undead\n , Monster \"Dula", "end": 4350, "score": 0.6433844566, "start": 4346, "tag": "NAME", "value": "ucer" }, { "context": "ucer\" 9 [ AllTerrain ] Fall Undead\n , Monster \"Dulahan\" 9 [ AllTerrain ] Summer Undead\n , Monster \"Ha", "end": 4403, "score": 0.6946344376, "start": 4396, "tag": "NAME", "value": "Dulahan" }, { "context": "an\" 9 [ AllTerrain ] Summer Undead\n , Monster \"Halloween March\" 10 [ AllTerrain ] Fall Undead\n , Mon", "end": 4457, "score": 0.8209655881, "start": 4451, "tag": "NAME", "value": "Hallow" }, { "context": "rch\" 10 [ AllTerrain ] Fall Undead\n , Monster \"Lich\" 11 [ AllTerrain ] Summer Undead\n , Monster \"G", "end": 4517, "score": 0.6814622879, "start": 4513, "tag": "NAME", "value": "Lich" }, { "context": "\" 8 [ AllTerrain ] Summer Gobroach\n , Monster \"Evil Soul\" 1 [ AllTerrain ] Spring Demon\n , Monster \"Poi", "end": 4765, "score": 0.8235839605, "start": 4756, "tag": "NAME", "value": "Evil Soul" }, { "context": "\" 2 [ AllTerrain ] Summer Demon\n , Monster \"Decayter\" 3 [ AllTerrain ] Summer Demon\n , Monster \"", "end": 4875, "score": 0.6848013997, "start": 4873, "tag": "NAME", "value": "ay" }, { "context": " 3 [ AllTerrain ] Summer Demon\n , Monster \"Meta Gnoll\" 4 [ AllTerrain ] Summer Demon\n , Monster \"Dra", "end": 4935, "score": 0.7823732495, "start": 4930, "tag": "NAME", "value": "Gnoll" }, { "context": "[ AllTerrain ] NoSeason Demon\n , Monster \"Red Demon\" 11 [ AllTerrain ] NoSeason Demon\n , Monster \"", "end": 5119, "score": 0.5068005323, "start": 5115, "tag": "NAME", "value": "emon" }, { "context": "11 [ AllTerrain ] NoSeason Demon\n , Monster \"Toy Soldier\" 1 [ AllTerrain ] NoSeason Magical\n , ", "end": 5172, "score": 0.5065762401, "start": 5171, "tag": "NAME", "value": "y" }, { "context": "1 [ AllTerrain ] NoSeason Magical\n , Monster \"Slime\" 3 [ AllTerrain ] Summer Magical\n , Monster \"M", "end": 5236, "score": 0.7043315172, "start": 5232, "tag": "NAME", "value": "lime" }, { "context": " 3 [ AllTerrain ] NoSeason Magical\n , Monster \"Coppelia\" 5 [ AllTerrain ] NoSeason Magical\n , Monster ", "end": 5354, "score": 0.9480541348, "start": 5346, "tag": "NAME", "value": "Coppelia" }, { "context": " 5 [ AllTerrain ] NoSeason Magical\n , Monster \"Haniwa Golem\" 5 [ AllTerrain ] NoSeason Magical\n , Monster ", "end": 5417, "score": 0.9930511713, "start": 5405, "tag": "NAME", "value": "Haniwa Golem" }, { "context": " 5 [ AllTerrain ] NoSeason Magical\n , Monster \"Mimic Hut\" 6 [ AllTerrain ] NoSeason Magical\n , Monster ", "end": 5477, "score": 0.8725963831, "start": 5468, "tag": "NAME", "value": "Mimic Hut" }, { "context": "dit\" 5\n , Npc \"High-level Bandit\" 7\n , Npc \"Militia\" 4\n , Npc \"Knight\" 7\n , Npc \"Mid-level magi", "end": 5949, "score": 0.6121825576, "start": 5942, "tag": "NAME", "value": "Militia" } ]
src/Draconica/Monsters.elm
dragonfi/draconica
0
module Draconica.Monsters exposing (allMonsters) import Draconica.Monster exposing (Monster, Season(..), Terrain(..), MonsterType(..)) allMonsters : List Monster allMonsters = [ Monster "Walking Egg" 1 [ AllTerrain ] Spring Egg , Monster "Running Egg" 3 [ Wasteland, RockyTerrain, Woods ] Winter Egg , Monster "Riding Egg" 5 [ Grassland, Desert ] Fall Egg , Monster "Mob Beast" 1 [ Grassland, Wasteland, DarkForest ] Spring PhantomBeast , Monster "Giant Ant" 2 [ Grassland, Wasteland, RockyTerrain ] Spring PhantomBeast , Monster "Cockatrice" 2 [ Grassland, Woods, DarkForest ] Fall PhantomBeast , Monster "Kamaitachi" 2 [ Grassland, Wasteland, RockyTerrain ] Winter PhantomBeast , Monster "High Roadrunner" 3 [ Grassland, Wasteland, Desert ] Spring PhantomBeast , Monster "Speckled Bee" 3 [ Wasteland, Woods, DarkForest ] Summer PhantomBeast , Monster "Pegasus" 3 [ Grassland, Highlands, Woods, Mountain ] Spring PhantomBeast , Monster "False Egg" 3 [ Grassland, Desert, Wasteland, Woods ] Fall PhantomBeast , Monster "Anaconda" 3 [ Grassland, Swamp, DarkForest, Woods, Pond ] Summer PhantomBeast , Monster "Unicorn" 3 [ DarkForest, Jungle, Mountain ] Spring PhantomBeast , Monster "Griffon" 4 [ Grassland, Wasteland, Mountain ] Spring PhantomBeast , Monster "Loyal Dog" 4 [ AllTerrain ] Spring PhantomBeast , Monster "Hungry Mole" 4 [ Grassland, Highlands, Wasteland ] Winter PhantomBeast , Monster "Zordfish" 4 [ River, Swamp ] Winter PhantomBeast , Monster "Hellhound" 5 [ Wasteland, Woods, Mountain ] Winter PhantomBeast , Monster "Demoncat" 5 [ Woods, DarkForest, Jungle, Mountain ] Winter PhantomBeast , Monster "Maximillion Kabuto" 5 [ DarkForest, Woods, Mountain ] Summer PhantomBeast , Monster "Tumbling Nest" 5 [ Grassland, Wasteland, Highlands ] Fall PhantomBeast , Monster "Chimaera" 6 [ Wasteland, DarkForest, Mountain, Jungle ] Summer PhantomBeast , Monster "Milk Maid" 6 [ Sea ] Spring PhantomBeast , Monster "Basilisk" 7 [ Desert, Wasteland, Mountain, RockyTerrain ] Fall PhantomBeast , Monster "Garden Tortoise" 10 [ DarkForest, Jungle, Mountain, Alpine ] Summer PhantomBeast , Monster "Ghost Beast" 12 [ Alpine, Desert, Sea, AllHighLevelTerrain ] Spring PhantomBeast , Monster "Napalm Palm" 2 [ Desert, Wasteland, Mountain ] Winter PhantomPlant , Monster "Myconid" 2 [ Woods, DarkForest, Jungle ] Fall PhantomPlant , Monster "Tyrant Rose" 3 [ Woods, DarkForest, Highlands, Grassland, Wasteland ] Spring PhantomPlant , Monster "Parasite Eggplant" 3 [ Woods, DarkForest, Jungle ] Spring PhantomPlant , Monster "Charming Rafflesia" 4 [ Grassland, Wasteland, Woods ] Spring PhantomPlant , Monster "Death Grass" 5 [ Grassland, Swamp ] Spring PhantomPlant , Monster "Plantimal" 5 [ AllTerrain ] Fall PhantomPlant , Monster "Earth Tiger" 5 [ Desert, Wasteland, Mountain ] Winter PhantomPlant , Monster "Pseudo Parasol" 6 [ DarkForest, Jungle, Mountain ] Summer PhantomPlant , Monster "Lightstalk" 7 [ LowAlpines, DarkForest ] Fall PhantomPlant , Monster "Brave Bamboo" 9 [ DarkForest, Jungle, LowAlpines ] Summer PhantomPlant , Monster "Koneko-goblin" 2 [ AllTerrain ] Spring Nekogoblin , Monster "Neko-goblin" 3 [ AllTerrain ] Spring Nekogoblin , Monster "Hobneko-goblin" 5 [ AllTerrain ] Spring Nekogoblin , Monster "Meteoric Iron" 3 [ AllTerrain ] NoSeason Demonstone , Monster "Symhonic Crystal" 3 [ AllTerrain ] NoSeason Demonstone , Monster "Rock Eater" 4 [ Wasteland, RockyTerrain, Mountain, Desert ] NoSeason Demonstone , Monster "Moai" 5 [ AllTerrain ] NoSeason Demonstone , Monster "Frozen Statue" 6 [ Mountain, Alpine ] Winter Demonstone , Monster "Petrified Fossil" 7 [ Wasteland, RockyTerrain, Mountain, Desert, Alpine ] NoSeason Demonstone , Monster "Leeme Alone" 8 [ Mountain, Desert, Alpine ] NoSeason Demonstone , Monster "Zombie" 1 [ AllTerrain ] Summer Undead , Monster "Calacassa" 2 [ AllTerrain ] Summer Undead , Monster "Skeleton" 3 [ AllTerrain ] Fall Undead , Monster "Foxphorous" 4 [ AllTerrain ] Spring Undead , Monster "Mummy" 5 [ AllTerrain ] Summer Undead , Monster "Thousandbones" 6 [ AllTerrain ] Summer Undead , Monster "Vampire" 7 [ AllTerrain ] Summer Undead , Monster "Lady Saucer" 9 [ AllTerrain ] Fall Undead , Monster "Dulahan" 9 [ AllTerrain ] Summer Undead , Monster "Halloween March" 10 [ AllTerrain ] Fall Undead , Monster "Lich" 11 [ AllTerrain ] Summer Undead , Monster "Gobroach" 4 [ AllTerrain ] Summer Gobroach , Monster "Sky Gobroach" 5 [ AllTerrain ] Summer Gobroach , Monster "Radioactive Gobroach" 8 [ AllTerrain ] Summer Gobroach , Monster "Evil Soul" 1 [ AllTerrain ] Spring Demon , Monster "Poison Toad" 2 [ AllTerrain ] Summer Demon , Monster "Decayter" 3 [ AllTerrain ] Summer Demon , Monster "Meta Gnoll" 4 [ AllTerrain ] Summer Demon , Monster "Dragon Madder" 5 [ AllTerrain ] NoSeason Demon , Monster "Black Death Skull" 8 [ AllTerrain ] NoSeason Demon , Monster "Red Demon" 11 [ AllTerrain ] NoSeason Demon , Monster "Toy Soldier" 1 [ AllTerrain ] NoSeason Magical , Monster "Slime" 3 [ AllTerrain ] Summer Magical , Monster "Magic Hand" 3 [ AllTerrain ] NoSeason Magical , Monster "Coppelia" 5 [ AllTerrain ] NoSeason Magical , Monster "Haniwa Golem" 5 [ AllTerrain ] NoSeason Magical , Monster "Mimic Hut" 6 [ AllTerrain ] NoSeason Magical , Monster "Factory" 9 [ AllTerrain ] NoSeason Magical , Monster "Low-level Dragon" 4 [ AllTerrain ] Spring WildDragon , Monster "Mid-level Dragon" 7 [ AllTerrain ] Spring WildDragon , Monster "High-level Dragon" 9 [ AllTerrain ] Spring WildDragon ] type alias Npc = { name : String, level : Int } other = [ Npc "Hoodlum" 3 , Npc "Low-level Bandit" 5 , Npc "High-level Bandit" 7 , Npc "Militia" 4 , Npc "Knight" 7 , Npc "Mid-level magician" 5 , Npc "High-level magician" 7 , Npc "Animal" 0 ]
37140
module Draconica.Monsters exposing (allMonsters) import Draconica.Monster exposing (Monster, Season(..), Terrain(..), MonsterType(..)) allMonsters : List Monster allMonsters = [ Monster "Walking Egg" 1 [ AllTerrain ] Spring Egg , Monster "Running Egg" 3 [ Wasteland, RockyTerrain, Woods ] Winter Egg , Monster "Riding Egg" 5 [ Grassland, Desert ] Fall Egg , Monster "Mob Beast" 1 [ Grassland, Wasteland, DarkForest ] Spring PhantomBeast , Monster "Giant Ant" 2 [ Grassland, Wasteland, RockyTerrain ] Spring PhantomBeast , Monster "Cockatrice" 2 [ Grassland, Woods, DarkForest ] Fall PhantomBeast , Monster "K<NAME>" 2 [ Grassland, Wasteland, RockyTerrain ] Winter PhantomBeast , Monster "High Roadrunner" 3 [ Grassland, Wasteland, Desert ] Spring PhantomBeast , Monster "Speckled Bee" 3 [ Wasteland, Woods, DarkForest ] Summer PhantomBeast , Monster "Pegasus" 3 [ Grassland, Highlands, Woods, Mountain ] Spring PhantomBeast , Monster "False Egg" 3 [ Grassland, Desert, Wasteland, Woods ] Fall PhantomBeast , Monster "Anaconda" 3 [ Grassland, Swamp, DarkForest, Woods, Pond ] Summer PhantomBeast , Monster "Unicorn" 3 [ DarkForest, Jungle, Mountain ] Spring PhantomBeast , Monster "Griffon" 4 [ Grassland, Wasteland, Mountain ] Spring PhantomBeast , Monster "Loyal Dog" 4 [ AllTerrain ] Spring PhantomBeast , Monster "Hungry Mole" 4 [ Grassland, Highlands, Wasteland ] Winter PhantomBeast , Monster "<NAME>" 4 [ River, Swamp ] Winter PhantomBeast , Monster "<NAME>" 5 [ Wasteland, Woods, Mountain ] Winter PhantomBeast , Monster "<NAME>" 5 [ Woods, DarkForest, Jungle, Mountain ] Winter PhantomBeast , Monster "<NAME>" 5 [ DarkForest, Woods, Mountain ] Summer PhantomBeast , Monster "<NAME>" 5 [ Grassland, Wasteland, Highlands ] Fall PhantomBeast , Monster "<NAME>" 6 [ Wasteland, DarkForest, Mountain, Jungle ] Summer PhantomBeast , Monster "<NAME>" 6 [ Sea ] Spring PhantomBeast , Monster "<NAME>" 7 [ Desert, Wasteland, Mountain, RockyTerrain ] Fall PhantomBeast , Monster "<NAME>" 10 [ DarkForest, Jungle, Mountain, Alpine ] Summer PhantomBeast , Monster "Ghost <NAME>" 12 [ Alpine, Desert, Sea, AllHighLevelTerrain ] Spring PhantomBeast , Monster "<NAME>" 2 [ Desert, Wasteland, Mountain ] Winter PhantomPlant , Monster "<NAME>" 2 [ Woods, DarkForest, Jungle ] Fall PhantomPlant , Monster "<NAME>" 3 [ Woods, DarkForest, Highlands, Grassland, Wasteland ] Spring PhantomPlant , Monster "Par<NAME>" 3 [ Woods, DarkForest, Jungle ] Spring PhantomPlant , Monster "<NAME>" 4 [ Grassland, Wasteland, Woods ] Spring PhantomPlant , Monster "Death <NAME>" 5 [ Grassland, Swamp ] Spring PhantomPlant , Monster "Plantimal" 5 [ AllTerrain ] Fall PhantomPlant , Monster "Earth Tiger" 5 [ Desert, Wasteland, Mountain ] Winter PhantomPlant , Monster "Pseudo Parasol" 6 [ DarkForest, Jungle, Mountain ] Summer PhantomPlant , Monster "Lightstalk" 7 [ LowAlpines, DarkForest ] Fall PhantomPlant , Monster "Brave Bamboo" 9 [ DarkForest, Jungle, LowAlpines ] Summer PhantomPlant , Monster "K<NAME>ko-gob<NAME>" 2 [ AllTerrain ] Spring Nekogoblin , Monster "N<NAME>o-goblin" 3 [ AllTerrain ] Spring Nekogoblin , Monster "H<NAME>neko-goblin" 5 [ AllTerrain ] Spring Nekogoblin , Monster "Meteoric Iron" 3 [ AllTerrain ] NoSeason Demonstone , Monster "Symhonic Crystal" 3 [ AllTerrain ] NoSeason Demonstone , Monster "Rock Eater" 4 [ Wasteland, RockyTerrain, Mountain, Desert ] NoSeason Demonstone , Monster "Mo<NAME>" 5 [ AllTerrain ] NoSeason Demonstone , Monster "Frozen Statue" 6 [ Mountain, Alpine ] Winter Demonstone , Monster "Petrified Fossil" 7 [ Wasteland, RockyTerrain, Mountain, Desert, Alpine ] NoSeason Demonstone , Monster "Leeme Alone" 8 [ Mountain, Desert, Alpine ] NoSeason Demonstone , Monster "Zombie" 1 [ AllTerrain ] Summer Undead , Monster "Calacassa" 2 [ AllTerrain ] Summer Undead , Monster "Skeleton" 3 [ AllTerrain ] Fall Undead , Monster "Foxphorous" 4 [ AllTerrain ] Spring Undead , Monster "Mummy" 5 [ AllTerrain ] Summer Undead , Monster "Thousandbones" 6 [ AllTerrain ] Summer Undead , Monster "<NAME>" 7 [ AllTerrain ] Summer Undead , Monster "L<NAME> Sa<NAME>" 9 [ AllTerrain ] Fall Undead , Monster "<NAME>" 9 [ AllTerrain ] Summer Undead , Monster "<NAME>een March" 10 [ AllTerrain ] Fall Undead , Monster "<NAME>" 11 [ AllTerrain ] Summer Undead , Monster "Gobroach" 4 [ AllTerrain ] Summer Gobroach , Monster "Sky Gobroach" 5 [ AllTerrain ] Summer Gobroach , Monster "Radioactive Gobroach" 8 [ AllTerrain ] Summer Gobroach , Monster "<NAME>" 1 [ AllTerrain ] Spring Demon , Monster "Poison Toad" 2 [ AllTerrain ] Summer Demon , Monster "Dec<NAME>ter" 3 [ AllTerrain ] Summer Demon , Monster "Meta <NAME>" 4 [ AllTerrain ] Summer Demon , Monster "Dragon Madder" 5 [ AllTerrain ] NoSeason Demon , Monster "Black Death Skull" 8 [ AllTerrain ] NoSeason Demon , Monster "Red D<NAME>" 11 [ AllTerrain ] NoSeason Demon , Monster "To<NAME> Soldier" 1 [ AllTerrain ] NoSeason Magical , Monster "S<NAME>" 3 [ AllTerrain ] Summer Magical , Monster "Magic Hand" 3 [ AllTerrain ] NoSeason Magical , Monster "<NAME>" 5 [ AllTerrain ] NoSeason Magical , Monster "<NAME>" 5 [ AllTerrain ] NoSeason Magical , Monster "<NAME>" 6 [ AllTerrain ] NoSeason Magical , Monster "Factory" 9 [ AllTerrain ] NoSeason Magical , Monster "Low-level Dragon" 4 [ AllTerrain ] Spring WildDragon , Monster "Mid-level Dragon" 7 [ AllTerrain ] Spring WildDragon , Monster "High-level Dragon" 9 [ AllTerrain ] Spring WildDragon ] type alias Npc = { name : String, level : Int } other = [ Npc "Hoodlum" 3 , Npc "Low-level Bandit" 5 , Npc "High-level Bandit" 7 , Npc "<NAME>" 4 , Npc "Knight" 7 , Npc "Mid-level magician" 5 , Npc "High-level magician" 7 , Npc "Animal" 0 ]
true
module Draconica.Monsters exposing (allMonsters) import Draconica.Monster exposing (Monster, Season(..), Terrain(..), MonsterType(..)) allMonsters : List Monster allMonsters = [ Monster "Walking Egg" 1 [ AllTerrain ] Spring Egg , Monster "Running Egg" 3 [ Wasteland, RockyTerrain, Woods ] Winter Egg , Monster "Riding Egg" 5 [ Grassland, Desert ] Fall Egg , Monster "Mob Beast" 1 [ Grassland, Wasteland, DarkForest ] Spring PhantomBeast , Monster "Giant Ant" 2 [ Grassland, Wasteland, RockyTerrain ] Spring PhantomBeast , Monster "Cockatrice" 2 [ Grassland, Woods, DarkForest ] Fall PhantomBeast , Monster "KPI:NAME:<NAME>END_PI" 2 [ Grassland, Wasteland, RockyTerrain ] Winter PhantomBeast , Monster "High Roadrunner" 3 [ Grassland, Wasteland, Desert ] Spring PhantomBeast , Monster "Speckled Bee" 3 [ Wasteland, Woods, DarkForest ] Summer PhantomBeast , Monster "Pegasus" 3 [ Grassland, Highlands, Woods, Mountain ] Spring PhantomBeast , Monster "False Egg" 3 [ Grassland, Desert, Wasteland, Woods ] Fall PhantomBeast , Monster "Anaconda" 3 [ Grassland, Swamp, DarkForest, Woods, Pond ] Summer PhantomBeast , Monster "Unicorn" 3 [ DarkForest, Jungle, Mountain ] Spring PhantomBeast , Monster "Griffon" 4 [ Grassland, Wasteland, Mountain ] Spring PhantomBeast , Monster "Loyal Dog" 4 [ AllTerrain ] Spring PhantomBeast , Monster "Hungry Mole" 4 [ Grassland, Highlands, Wasteland ] Winter PhantomBeast , Monster "PI:NAME:<NAME>END_PI" 4 [ River, Swamp ] Winter PhantomBeast , Monster "PI:NAME:<NAME>END_PI" 5 [ Wasteland, Woods, Mountain ] Winter PhantomBeast , Monster "PI:NAME:<NAME>END_PI" 5 [ Woods, DarkForest, Jungle, Mountain ] Winter PhantomBeast , Monster "PI:NAME:<NAME>END_PI" 5 [ DarkForest, Woods, Mountain ] Summer PhantomBeast , Monster "PI:NAME:<NAME>END_PI" 5 [ Grassland, Wasteland, Highlands ] Fall PhantomBeast , Monster "PI:NAME:<NAME>END_PI" 6 [ Wasteland, DarkForest, Mountain, Jungle ] Summer PhantomBeast , Monster "PI:NAME:<NAME>END_PI" 6 [ Sea ] Spring PhantomBeast , Monster "PI:NAME:<NAME>END_PI" 7 [ Desert, Wasteland, Mountain, RockyTerrain ] Fall PhantomBeast , Monster "PI:NAME:<NAME>END_PI" 10 [ DarkForest, Jungle, Mountain, Alpine ] Summer PhantomBeast , Monster "Ghost PI:NAME:<NAME>END_PI" 12 [ Alpine, Desert, Sea, AllHighLevelTerrain ] Spring PhantomBeast , Monster "PI:NAME:<NAME>END_PI" 2 [ Desert, Wasteland, Mountain ] Winter PhantomPlant , Monster "PI:NAME:<NAME>END_PI" 2 [ Woods, DarkForest, Jungle ] Fall PhantomPlant , Monster "PI:NAME:<NAME>END_PI" 3 [ Woods, DarkForest, Highlands, Grassland, Wasteland ] Spring PhantomPlant , Monster "ParPI:NAME:<NAME>END_PI" 3 [ Woods, DarkForest, Jungle ] Spring PhantomPlant , Monster "PI:NAME:<NAME>END_PI" 4 [ Grassland, Wasteland, Woods ] Spring PhantomPlant , Monster "Death PI:NAME:<NAME>END_PI" 5 [ Grassland, Swamp ] Spring PhantomPlant , Monster "Plantimal" 5 [ AllTerrain ] Fall PhantomPlant , Monster "Earth Tiger" 5 [ Desert, Wasteland, Mountain ] Winter PhantomPlant , Monster "Pseudo Parasol" 6 [ DarkForest, Jungle, Mountain ] Summer PhantomPlant , Monster "Lightstalk" 7 [ LowAlpines, DarkForest ] Fall PhantomPlant , Monster "Brave Bamboo" 9 [ DarkForest, Jungle, LowAlpines ] Summer PhantomPlant , Monster "KPI:NAME:<NAME>END_PIko-gobPI:NAME:<NAME>END_PI" 2 [ AllTerrain ] Spring Nekogoblin , Monster "NPI:NAME:<NAME>END_PIo-goblin" 3 [ AllTerrain ] Spring Nekogoblin , Monster "HPI:NAME:<NAME>END_PIneko-goblin" 5 [ AllTerrain ] Spring Nekogoblin , Monster "Meteoric Iron" 3 [ AllTerrain ] NoSeason Demonstone , Monster "Symhonic Crystal" 3 [ AllTerrain ] NoSeason Demonstone , Monster "Rock Eater" 4 [ Wasteland, RockyTerrain, Mountain, Desert ] NoSeason Demonstone , Monster "MoPI:NAME:<NAME>END_PI" 5 [ AllTerrain ] NoSeason Demonstone , Monster "Frozen Statue" 6 [ Mountain, Alpine ] Winter Demonstone , Monster "Petrified Fossil" 7 [ Wasteland, RockyTerrain, Mountain, Desert, Alpine ] NoSeason Demonstone , Monster "Leeme Alone" 8 [ Mountain, Desert, Alpine ] NoSeason Demonstone , Monster "Zombie" 1 [ AllTerrain ] Summer Undead , Monster "Calacassa" 2 [ AllTerrain ] Summer Undead , Monster "Skeleton" 3 [ AllTerrain ] Fall Undead , Monster "Foxphorous" 4 [ AllTerrain ] Spring Undead , Monster "Mummy" 5 [ AllTerrain ] Summer Undead , Monster "Thousandbones" 6 [ AllTerrain ] Summer Undead , Monster "PI:NAME:<NAME>END_PI" 7 [ AllTerrain ] Summer Undead , Monster "LPI:NAME:<NAME>END_PI SaPI:NAME:<NAME>END_PI" 9 [ AllTerrain ] Fall Undead , Monster "PI:NAME:<NAME>END_PI" 9 [ AllTerrain ] Summer Undead , Monster "PI:NAME:<NAME>END_PIeen March" 10 [ AllTerrain ] Fall Undead , Monster "PI:NAME:<NAME>END_PI" 11 [ AllTerrain ] Summer Undead , Monster "Gobroach" 4 [ AllTerrain ] Summer Gobroach , Monster "Sky Gobroach" 5 [ AllTerrain ] Summer Gobroach , Monster "Radioactive Gobroach" 8 [ AllTerrain ] Summer Gobroach , Monster "PI:NAME:<NAME>END_PI" 1 [ AllTerrain ] Spring Demon , Monster "Poison Toad" 2 [ AllTerrain ] Summer Demon , Monster "DecPI:NAME:<NAME>END_PIter" 3 [ AllTerrain ] Summer Demon , Monster "Meta PI:NAME:<NAME>END_PI" 4 [ AllTerrain ] Summer Demon , Monster "Dragon Madder" 5 [ AllTerrain ] NoSeason Demon , Monster "Black Death Skull" 8 [ AllTerrain ] NoSeason Demon , Monster "Red DPI:NAME:<NAME>END_PI" 11 [ AllTerrain ] NoSeason Demon , Monster "ToPI:NAME:<NAME>END_PI Soldier" 1 [ AllTerrain ] NoSeason Magical , Monster "SPI:NAME:<NAME>END_PI" 3 [ AllTerrain ] Summer Magical , Monster "Magic Hand" 3 [ AllTerrain ] NoSeason Magical , Monster "PI:NAME:<NAME>END_PI" 5 [ AllTerrain ] NoSeason Magical , Monster "PI:NAME:<NAME>END_PI" 5 [ AllTerrain ] NoSeason Magical , Monster "PI:NAME:<NAME>END_PI" 6 [ AllTerrain ] NoSeason Magical , Monster "Factory" 9 [ AllTerrain ] NoSeason Magical , Monster "Low-level Dragon" 4 [ AllTerrain ] Spring WildDragon , Monster "Mid-level Dragon" 7 [ AllTerrain ] Spring WildDragon , Monster "High-level Dragon" 9 [ AllTerrain ] Spring WildDragon ] type alias Npc = { name : String, level : Int } other = [ Npc "Hoodlum" 3 , Npc "Low-level Bandit" 5 , Npc "High-level Bandit" 7 , Npc "PI:NAME:<NAME>END_PI" 4 , Npc "Knight" 7 , Npc "Mid-level magician" 5 , Npc "High-level magician" 7 , Npc "Animal" 0 ]
elm
[ { "context": "r -> updateSpeaker i speaker (\\sp -> { sp | name = name }))\n s.speakers\n ", "end": 2615, "score": 0.982034862, "start": 2611, "tag": "NAME", "value": "name" } ]
frontend/src/Submission.elm
javaBin/submit
1
module Submission exposing (updateSubmissionField) import Model.Submission exposing (..) import Messages exposing (..) import Messages exposing (..) import Backend.Network exposing (RequestStatus(..)) import Nav.Requests exposing (saveSubmission, loginFailed, saveComment) import Time import Task import Lazy import Ports exposing (fileSelected, ImagePostData) updateSubmissionField : SubmissionField -> Model -> ( Model, Cmd Msg ) updateSubmissionField field model = case field of Title title -> updateField model (\_ -> Cmd.none) <| \s -> { s | title = title } Abstract abstract -> updateField model (\_ -> Cmd.none) <| \s -> { s | abstract = abstract } Equipment equipment -> updateField model (\_ -> Cmd.none) <| \s -> { s | equipment = equipment } Format format -> updateField model (\_ -> Cmd.none) <| \s -> { s | format = format, length = getLength format } Status status -> updateField model (\_ -> Cmd.none) <| \s -> { s | status = status } IntendedAudience intendedAudience -> updateField model (\_ -> Cmd.none) <| \s -> { s | intendedAudience = intendedAudience } Language language -> updateField model (\_ -> Cmd.none) <| \s -> { s | language = language } Length length -> updateField model (\_ -> Cmd.none) <| \s -> { s | length = length } Outline outline -> updateField model (\_ -> Cmd.none) <| \s -> { s | outline = outline } Level level -> updateField model (\_ -> Cmd.none) <| \s -> { s | level = level } SuggestedKeywords suggestedKeywords -> updateField model (\_ -> Cmd.none) <| \s -> { s | suggestedKeywords = suggestedKeywords } InfoToProgramCommittee infoToProgramCommittee -> updateField model (\_ -> Cmd.none) <| \s -> { s | infoToProgramCommittee = infoToProgramCommittee } AddSpeaker -> updateField model (\s -> saveSubmission s) <| \s -> { s | speakers = s.speakers ++ [ initSpeaker s.speakers ] } SpeakerName i name -> updateField model (\_ -> Cmd.none) <| \s -> let updatedSpeakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | name = name })) s.speakers in { s | speakers = updatedSpeakers } SpeakerEmail i email -> updateField model (\_ -> Cmd.none) <| \s -> let updatedSpeakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | email = email })) s.speakers in { s | speakers = updatedSpeakers } SpeakerBio i bio -> updateField model (\_ -> Cmd.none) <| \s -> let updatedSpeakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | bio = bio })) s.speakers in { s | speakers = updatedSpeakers } SpeakerZipCode i zipCode -> updateField model (\_ -> Cmd.none) <| \s -> let speakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | zipCode = zipCode })) s.speakers in { s | speakers = speakers } SpeakerTwitter i twitter -> updateField model (\_ -> Cmd.none) <| \s -> let speakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | twitter = twitter })) s.speakers in { s | speakers = speakers } RemoveSpeaker i -> updateField model (\s -> saveSubmission s) <| \s -> let speakers = List.filter (\( j, _ ) -> j /= i) s.speakers in { s | speakers = speakers } FileSelected speaker i id -> case model.submission of Complete submission -> ( model, fileSelected <| ImagePostData id submission.id speaker.id i ) _ -> ( model, Cmd.none ) FileUploaded image -> updateField model (\_ -> Cmd.none) <| \s -> let speakers = List.map (\speaker -> updateSpeaker image.i speaker (\sp -> { sp | pictureUrl = image.url, hasPicture = True })) s.speakers in { s | speakers = speakers } NewComment comment -> ( { model | comment = comment }, Cmd.none ) SaveComment -> case model.submission of Complete submission -> ( model, saveComment model submission ) _ -> ( model, Cmd.none ) updateField : Model -> (Submission -> Cmd Msg) -> (Submission -> Submission) -> ( Model, Cmd Msg ) updateField model cmdFn updateFunction = case model.submission of Complete submission -> let updated = updateFunction submission in ( { model | dirty = True, submission = Complete updated }, cmdFn updated ) _ -> ( model, Cmd.none ) updateSpeaker : Int -> ( Int, Speaker ) -> (Speaker -> Speaker) -> ( Int, Speaker ) updateSpeaker i ( j, speaker ) updateFunction = if i == j then ( j, updateFunction speaker ) else ( j, speaker ) getLength : String -> String getLength format = case format of "presentation" -> "45" "lightning-talk" -> "10" _ -> "120"
46615
module Submission exposing (updateSubmissionField) import Model.Submission exposing (..) import Messages exposing (..) import Messages exposing (..) import Backend.Network exposing (RequestStatus(..)) import Nav.Requests exposing (saveSubmission, loginFailed, saveComment) import Time import Task import Lazy import Ports exposing (fileSelected, ImagePostData) updateSubmissionField : SubmissionField -> Model -> ( Model, Cmd Msg ) updateSubmissionField field model = case field of Title title -> updateField model (\_ -> Cmd.none) <| \s -> { s | title = title } Abstract abstract -> updateField model (\_ -> Cmd.none) <| \s -> { s | abstract = abstract } Equipment equipment -> updateField model (\_ -> Cmd.none) <| \s -> { s | equipment = equipment } Format format -> updateField model (\_ -> Cmd.none) <| \s -> { s | format = format, length = getLength format } Status status -> updateField model (\_ -> Cmd.none) <| \s -> { s | status = status } IntendedAudience intendedAudience -> updateField model (\_ -> Cmd.none) <| \s -> { s | intendedAudience = intendedAudience } Language language -> updateField model (\_ -> Cmd.none) <| \s -> { s | language = language } Length length -> updateField model (\_ -> Cmd.none) <| \s -> { s | length = length } Outline outline -> updateField model (\_ -> Cmd.none) <| \s -> { s | outline = outline } Level level -> updateField model (\_ -> Cmd.none) <| \s -> { s | level = level } SuggestedKeywords suggestedKeywords -> updateField model (\_ -> Cmd.none) <| \s -> { s | suggestedKeywords = suggestedKeywords } InfoToProgramCommittee infoToProgramCommittee -> updateField model (\_ -> Cmd.none) <| \s -> { s | infoToProgramCommittee = infoToProgramCommittee } AddSpeaker -> updateField model (\s -> saveSubmission s) <| \s -> { s | speakers = s.speakers ++ [ initSpeaker s.speakers ] } SpeakerName i name -> updateField model (\_ -> Cmd.none) <| \s -> let updatedSpeakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | name = <NAME> })) s.speakers in { s | speakers = updatedSpeakers } SpeakerEmail i email -> updateField model (\_ -> Cmd.none) <| \s -> let updatedSpeakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | email = email })) s.speakers in { s | speakers = updatedSpeakers } SpeakerBio i bio -> updateField model (\_ -> Cmd.none) <| \s -> let updatedSpeakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | bio = bio })) s.speakers in { s | speakers = updatedSpeakers } SpeakerZipCode i zipCode -> updateField model (\_ -> Cmd.none) <| \s -> let speakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | zipCode = zipCode })) s.speakers in { s | speakers = speakers } SpeakerTwitter i twitter -> updateField model (\_ -> Cmd.none) <| \s -> let speakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | twitter = twitter })) s.speakers in { s | speakers = speakers } RemoveSpeaker i -> updateField model (\s -> saveSubmission s) <| \s -> let speakers = List.filter (\( j, _ ) -> j /= i) s.speakers in { s | speakers = speakers } FileSelected speaker i id -> case model.submission of Complete submission -> ( model, fileSelected <| ImagePostData id submission.id speaker.id i ) _ -> ( model, Cmd.none ) FileUploaded image -> updateField model (\_ -> Cmd.none) <| \s -> let speakers = List.map (\speaker -> updateSpeaker image.i speaker (\sp -> { sp | pictureUrl = image.url, hasPicture = True })) s.speakers in { s | speakers = speakers } NewComment comment -> ( { model | comment = comment }, Cmd.none ) SaveComment -> case model.submission of Complete submission -> ( model, saveComment model submission ) _ -> ( model, Cmd.none ) updateField : Model -> (Submission -> Cmd Msg) -> (Submission -> Submission) -> ( Model, Cmd Msg ) updateField model cmdFn updateFunction = case model.submission of Complete submission -> let updated = updateFunction submission in ( { model | dirty = True, submission = Complete updated }, cmdFn updated ) _ -> ( model, Cmd.none ) updateSpeaker : Int -> ( Int, Speaker ) -> (Speaker -> Speaker) -> ( Int, Speaker ) updateSpeaker i ( j, speaker ) updateFunction = if i == j then ( j, updateFunction speaker ) else ( j, speaker ) getLength : String -> String getLength format = case format of "presentation" -> "45" "lightning-talk" -> "10" _ -> "120"
true
module Submission exposing (updateSubmissionField) import Model.Submission exposing (..) import Messages exposing (..) import Messages exposing (..) import Backend.Network exposing (RequestStatus(..)) import Nav.Requests exposing (saveSubmission, loginFailed, saveComment) import Time import Task import Lazy import Ports exposing (fileSelected, ImagePostData) updateSubmissionField : SubmissionField -> Model -> ( Model, Cmd Msg ) updateSubmissionField field model = case field of Title title -> updateField model (\_ -> Cmd.none) <| \s -> { s | title = title } Abstract abstract -> updateField model (\_ -> Cmd.none) <| \s -> { s | abstract = abstract } Equipment equipment -> updateField model (\_ -> Cmd.none) <| \s -> { s | equipment = equipment } Format format -> updateField model (\_ -> Cmd.none) <| \s -> { s | format = format, length = getLength format } Status status -> updateField model (\_ -> Cmd.none) <| \s -> { s | status = status } IntendedAudience intendedAudience -> updateField model (\_ -> Cmd.none) <| \s -> { s | intendedAudience = intendedAudience } Language language -> updateField model (\_ -> Cmd.none) <| \s -> { s | language = language } Length length -> updateField model (\_ -> Cmd.none) <| \s -> { s | length = length } Outline outline -> updateField model (\_ -> Cmd.none) <| \s -> { s | outline = outline } Level level -> updateField model (\_ -> Cmd.none) <| \s -> { s | level = level } SuggestedKeywords suggestedKeywords -> updateField model (\_ -> Cmd.none) <| \s -> { s | suggestedKeywords = suggestedKeywords } InfoToProgramCommittee infoToProgramCommittee -> updateField model (\_ -> Cmd.none) <| \s -> { s | infoToProgramCommittee = infoToProgramCommittee } AddSpeaker -> updateField model (\s -> saveSubmission s) <| \s -> { s | speakers = s.speakers ++ [ initSpeaker s.speakers ] } SpeakerName i name -> updateField model (\_ -> Cmd.none) <| \s -> let updatedSpeakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | name = PI:NAME:<NAME>END_PI })) s.speakers in { s | speakers = updatedSpeakers } SpeakerEmail i email -> updateField model (\_ -> Cmd.none) <| \s -> let updatedSpeakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | email = email })) s.speakers in { s | speakers = updatedSpeakers } SpeakerBio i bio -> updateField model (\_ -> Cmd.none) <| \s -> let updatedSpeakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | bio = bio })) s.speakers in { s | speakers = updatedSpeakers } SpeakerZipCode i zipCode -> updateField model (\_ -> Cmd.none) <| \s -> let speakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | zipCode = zipCode })) s.speakers in { s | speakers = speakers } SpeakerTwitter i twitter -> updateField model (\_ -> Cmd.none) <| \s -> let speakers = List.map (\speaker -> updateSpeaker i speaker (\sp -> { sp | twitter = twitter })) s.speakers in { s | speakers = speakers } RemoveSpeaker i -> updateField model (\s -> saveSubmission s) <| \s -> let speakers = List.filter (\( j, _ ) -> j /= i) s.speakers in { s | speakers = speakers } FileSelected speaker i id -> case model.submission of Complete submission -> ( model, fileSelected <| ImagePostData id submission.id speaker.id i ) _ -> ( model, Cmd.none ) FileUploaded image -> updateField model (\_ -> Cmd.none) <| \s -> let speakers = List.map (\speaker -> updateSpeaker image.i speaker (\sp -> { sp | pictureUrl = image.url, hasPicture = True })) s.speakers in { s | speakers = speakers } NewComment comment -> ( { model | comment = comment }, Cmd.none ) SaveComment -> case model.submission of Complete submission -> ( model, saveComment model submission ) _ -> ( model, Cmd.none ) updateField : Model -> (Submission -> Cmd Msg) -> (Submission -> Submission) -> ( Model, Cmd Msg ) updateField model cmdFn updateFunction = case model.submission of Complete submission -> let updated = updateFunction submission in ( { model | dirty = True, submission = Complete updated }, cmdFn updated ) _ -> ( model, Cmd.none ) updateSpeaker : Int -> ( Int, Speaker ) -> (Speaker -> Speaker) -> ( Int, Speaker ) updateSpeaker i ( j, speaker ) updateFunction = if i == j then ( j, updateFunction speaker ) else ( j, speaker ) getLength : String -> String getLength format = case format of "presentation" -> "45" "lightning-talk" -> "10" _ -> "120"
elm
[ { "context": " \"Id\"\n\n FirstName ->\n \"Prénom\"\n\n LastName ->\n \"Nom\"\n\n ", "end": 319, "score": 0.9995548129, "start": 313, "tag": "NAME", "value": "Prénom" }, { "context": " \"Prénom\"\n\n LastName ->\n \"Nom\"\n\n Login ->\n \"Login\"\n\n E", "end": 358, "score": 0.9991875291, "start": 355, "tag": "NAME", "value": "Nom" } ]
elm/src/Admin/UserManagement/I18n/French.elm
jiwhiz/jhipster-elm-demo
1
module Admin.UserManagement.I18n.French exposing (translate) import Admin.UserManagement.I18n.Phrases exposing (Phrase(..)) translate : Phrase -> String translate phrase = case phrase of UserListTitle -> "Utilisateurs" Id -> "Id" FirstName -> "Prénom" LastName -> "Nom" Login -> "Login" Email -> "Email" Language -> "Langue" Role -> "Droits" Activated -> "Activé" Deactivated -> "Désactivé" CreatedBy -> "Créé par" CreatedDate -> "Créé le" LastModifiedBy -> "Modifié par" LastModifiedDate -> "Modifié le"
2669
module Admin.UserManagement.I18n.French exposing (translate) import Admin.UserManagement.I18n.Phrases exposing (Phrase(..)) translate : Phrase -> String translate phrase = case phrase of UserListTitle -> "Utilisateurs" Id -> "Id" FirstName -> "<NAME>" LastName -> "<NAME>" Login -> "Login" Email -> "Email" Language -> "Langue" Role -> "Droits" Activated -> "Activé" Deactivated -> "Désactivé" CreatedBy -> "Créé par" CreatedDate -> "Créé le" LastModifiedBy -> "Modifié par" LastModifiedDate -> "Modifié le"
true
module Admin.UserManagement.I18n.French exposing (translate) import Admin.UserManagement.I18n.Phrases exposing (Phrase(..)) translate : Phrase -> String translate phrase = case phrase of UserListTitle -> "Utilisateurs" Id -> "Id" FirstName -> "PI:NAME:<NAME>END_PI" LastName -> "PI:NAME:<NAME>END_PI" Login -> "Login" Email -> "Email" Language -> "Langue" Role -> "Droits" Activated -> "Activé" Deactivated -> "Désactivé" CreatedBy -> "Créé par" CreatedDate -> "Créé le" LastModifiedBy -> "Modifié par" LastModifiedDate -> "Modifié le"
elm
[ { "context": "ame\n@docs dayOfMonthWithSuffix\n\nCopyright (c) 2016 Ossi Hanhinen\n\n-}\n\nimport Date exposing (Day(..), Month(..))\n\n\n", "end": 213, "score": 0.9998671412, "start": 200, "tag": "NAME", "value": "Ossi Hanhinen" } ]
src/Date/Extra/I18n/I_sv_se.elm
AdrianRibao/elm-date-extra
81
module Date.Extra.I18n.I_sv_se exposing (..) {-| Swedish values for day and month names. @docs dayShort @docs dayName @docs monthShort @docs monthName @docs dayOfMonthWithSuffix Copyright (c) 2016 Ossi Hanhinen -} import Date exposing (Day(..), Month(..)) {-| Day short name. -} dayShort : Day -> String dayShort day = case day of Mon -> "mån" Tue -> "tis" Wed -> "ons" Thu -> "tor" Fri -> "fre" Sat -> "lör" Sun -> "sön" {-| Day full name. -} dayName : Day -> String dayName day = case day of Mon -> "måndag" Tue -> "tisdag" Wed -> "onsdag" Thu -> "torsdag" Fri -> "fredag" Sat -> "lördag" Sun -> "söndag" {-| Month short name. -} monthShort : Month -> String monthShort month = case month of Jan -> "jan" Feb -> "feb" Mar -> "mar" Apr -> "apr" May -> "maj" Jun -> "jun" Jul -> "jul" Aug -> "aug" Sep -> "sep" Oct -> "okt" Nov -> "nov" Dec -> "dec" {-| Month full name. -} monthName : Month -> String monthName month = case month of Jan -> "januari" Feb -> "februari" Mar -> "mars" Apr -> "april" May -> "maj" Jun -> "juni" Jul -> "juli" Aug -> "augusti" Sep -> "september" Oct -> "oktober" Nov -> "november" Dec -> "december" {-| Nothing done here for now, but it might be needed -} dayOfMonthWithSuffix : Bool -> Int -> String dayOfMonthWithSuffix pad day = case day of _ -> toString day
26392
module Date.Extra.I18n.I_sv_se exposing (..) {-| Swedish values for day and month names. @docs dayShort @docs dayName @docs monthShort @docs monthName @docs dayOfMonthWithSuffix Copyright (c) 2016 <NAME> -} import Date exposing (Day(..), Month(..)) {-| Day short name. -} dayShort : Day -> String dayShort day = case day of Mon -> "mån" Tue -> "tis" Wed -> "ons" Thu -> "tor" Fri -> "fre" Sat -> "lör" Sun -> "sön" {-| Day full name. -} dayName : Day -> String dayName day = case day of Mon -> "måndag" Tue -> "tisdag" Wed -> "onsdag" Thu -> "torsdag" Fri -> "fredag" Sat -> "lördag" Sun -> "söndag" {-| Month short name. -} monthShort : Month -> String monthShort month = case month of Jan -> "jan" Feb -> "feb" Mar -> "mar" Apr -> "apr" May -> "maj" Jun -> "jun" Jul -> "jul" Aug -> "aug" Sep -> "sep" Oct -> "okt" Nov -> "nov" Dec -> "dec" {-| Month full name. -} monthName : Month -> String monthName month = case month of Jan -> "januari" Feb -> "februari" Mar -> "mars" Apr -> "april" May -> "maj" Jun -> "juni" Jul -> "juli" Aug -> "augusti" Sep -> "september" Oct -> "oktober" Nov -> "november" Dec -> "december" {-| Nothing done here for now, but it might be needed -} dayOfMonthWithSuffix : Bool -> Int -> String dayOfMonthWithSuffix pad day = case day of _ -> toString day
true
module Date.Extra.I18n.I_sv_se exposing (..) {-| Swedish values for day and month names. @docs dayShort @docs dayName @docs monthShort @docs monthName @docs dayOfMonthWithSuffix Copyright (c) 2016 PI:NAME:<NAME>END_PI -} import Date exposing (Day(..), Month(..)) {-| Day short name. -} dayShort : Day -> String dayShort day = case day of Mon -> "mån" Tue -> "tis" Wed -> "ons" Thu -> "tor" Fri -> "fre" Sat -> "lör" Sun -> "sön" {-| Day full name. -} dayName : Day -> String dayName day = case day of Mon -> "måndag" Tue -> "tisdag" Wed -> "onsdag" Thu -> "torsdag" Fri -> "fredag" Sat -> "lördag" Sun -> "söndag" {-| Month short name. -} monthShort : Month -> String monthShort month = case month of Jan -> "jan" Feb -> "feb" Mar -> "mar" Apr -> "apr" May -> "maj" Jun -> "jun" Jul -> "jul" Aug -> "aug" Sep -> "sep" Oct -> "okt" Nov -> "nov" Dec -> "dec" {-| Month full name. -} monthName : Month -> String monthName month = case month of Jan -> "januari" Feb -> "februari" Mar -> "mars" Apr -> "april" May -> "maj" Jun -> "juni" Jul -> "juli" Aug -> "augusti" Sep -> "september" Oct -> "oktober" Nov -> "november" Dec -> "december" {-| Nothing done here for now, but it might be needed -} dayOfMonthWithSuffix : Bool -> Int -> String dayOfMonthWithSuffix pad day = case day of _ -> toString day
elm
[ { "context": " , account = data.account\n , username = data.username\n , password = data.password\n }\n\n\n{-| A Part", "end": 2936, "score": 0.8690140843, "start": 2928, "tag": "USERNAME", "value": "username" }, { "context": "nt\n , username = data.username\n , password = data.password\n }\n\n\n{-| A Participant decoder\n-}\ndecoder : De", "end": 2967, "score": 0.9986560345, "start": 2954, "tag": "PASSWORD", "value": "data.password" }, { "context": "D.maybe Account.decoder)\n |> JDP.required \"username\" (JD.string |> JD.map Just)\n |> JDP.option", "end": 4074, "score": 0.5147122741, "start": 4066, "tag": "USERNAME", "value": "username" } ]
src/Engage/Entity/Participant.elm
EngageSoftware/elm-engage-common
0
module Engage.Entity.Participant exposing ( Participant , decoder, empty, encoder, encoderWith, toParticipant ) {-| Entity.Participant @docs Participant @docs decoder, empty, encoder, encoderWith, toParticipant -} import Date exposing (Date) import Engage.Decode exposing (isoDateDecoder) import Engage.Entity.Account as Account exposing (Account) import Engage.Entity.Address as Address exposing (Address) import Engage.Entity.Gender as Gender exposing (Gender) import Engage.Entity.PhoneNumber as PhoneNumber exposing (PhoneNumber) import Engage.ListItem exposing (ListItem) import Json.Decode as JD exposing (Decoder) import Json.Decode.Pipeline as JDP import Json.Encode as JE {-| The Participant type -} type alias Participant = { participantId : Maybe Int , firstName : String , lastName : String , middleName : String , email : String , primaryAddress : Maybe Address , phone : PhoneNumber , mobilePhone : PhoneNumber , profilePicture : String , gender : Gender , birthDate : Maybe Date , birthDateYear : Maybe ListItem , birthDateMonth : Maybe ListItem , account : Maybe Account , username : Maybe String , password : Maybe String } {-| Get an empty Participant -} empty : Participant empty = { participantId = Nothing , firstName = "" , lastName = "" , middleName = "" , email = "" , primaryAddress = Nothing , phone = PhoneNumber.empty , mobilePhone = PhoneNumber.empty , profilePicture = "" , gender = Gender.Unspecified , birthDate = Nothing , birthDateYear = Nothing , birthDateMonth = Nothing , account = Nothing , username = Nothing , password = Nothing } type alias ParticipantLike a = { a | participantId : Maybe Int , firstName : String , lastName : String , middleName : String , email : String , primaryAddress : Maybe Address , phone : PhoneNumber , mobilePhone : PhoneNumber , profilePicture : String , gender : Gender , birthDate : Maybe Date , birthDateYear : Maybe ListItem , birthDateMonth : Maybe ListItem , account : Maybe Account , username : Maybe String , password : Maybe String } {-| Get a Participant from a partial -} toParticipant : ParticipantLike a -> Participant toParticipant data = { participantId = data.participantId , firstName = data.firstName , lastName = data.lastName , middleName = data.middleName , email = data.email , primaryAddress = data.primaryAddress , phone = data.phone , mobilePhone = data.mobilePhone , profilePicture = data.profilePicture , gender = data.gender , birthDate = data.birthDate , birthDateYear = data.birthDateYear , birthDateMonth = data.birthDateMonth , account = data.account , username = data.username , password = data.password } {-| A Participant decoder -} decoder : Decoder Participant decoder = JD.succeed Participant |> JDP.required "participantId" (JD.map Just JD.int) |> JDP.required "firstName" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "lastName" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "middleName" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "email" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "primaryAddress" (JD.maybe Address.decoder) |> JDP.required "phone" PhoneNumber.decoder |> JDP.required "mobilePhone" PhoneNumber.decoder |> JDP.required "profilePicture" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "gender" Gender.decoder |> JDP.required "birthDatePosix" (JD.nullable isoDateDecoder) |> JDP.required "birthDateYear" (JD.maybe (JD.int |> JD.map (\val -> ( val, "" )))) |> JDP.required "birthDateMonth" (JD.maybe (JD.int |> JD.map (\val -> ( val, "" )))) |> JDP.required "account" (JD.maybe Account.decoder) |> JDP.required "username" (JD.string |> JD.map Just) |> JDP.optional "password" (JD.maybe JD.string) Nothing {-| A Participant encoder -} encoder : ParticipantLike a -> JE.Value encoder = encoderWith [] {-| A Participant with fields encoder -} encoderWith : List ( String, JE.Value ) -> ParticipantLike a -> JE.Value encoderWith fields participantData = JE.object (fields ++ [ ( "participantId", Maybe.map JE.int participantData.participantId |> Maybe.withDefault JE.null ) , ( "firstName", JE.string participantData.firstName ) , ( "middleName", JE.string participantData.middleName ) , ( "lastName", JE.string participantData.lastName ) , ( "email", JE.string participantData.email ) , ( "phone", PhoneNumber.encoder participantData.phone ) , ( "mobilePhone", PhoneNumber.encoder participantData.mobilePhone ) , ( "profilePicture", JE.string participantData.profilePicture ) , ( "gender", Gender.encoder participantData.gender ) , ( "birthDatePosix", Maybe.map (Date.toIsoString >> JE.string) participantData.birthDate |> Maybe.withDefault JE.null ) , ( "birthDateYear", Maybe.map (Tuple.first >> JE.int) participantData.birthDateYear |> Maybe.withDefault JE.null ) , ( "birthDateMonth", Maybe.map (Tuple.first >> JE.int) participantData.birthDateMonth |> Maybe.withDefault JE.null ) , ( "account", Maybe.map Account.encoder participantData.account |> Maybe.withDefault JE.null ) , ( "primaryAddress", Maybe.map Address.encoder participantData.primaryAddress |> Maybe.withDefault JE.null ) , ( "username", participantData.username |> Maybe.map JE.string |> Maybe.withDefault JE.null ) , ( "password", participantData.password |> Maybe.map JE.string |> Maybe.withDefault JE.null ) ] )
56052
module Engage.Entity.Participant exposing ( Participant , decoder, empty, encoder, encoderWith, toParticipant ) {-| Entity.Participant @docs Participant @docs decoder, empty, encoder, encoderWith, toParticipant -} import Date exposing (Date) import Engage.Decode exposing (isoDateDecoder) import Engage.Entity.Account as Account exposing (Account) import Engage.Entity.Address as Address exposing (Address) import Engage.Entity.Gender as Gender exposing (Gender) import Engage.Entity.PhoneNumber as PhoneNumber exposing (PhoneNumber) import Engage.ListItem exposing (ListItem) import Json.Decode as JD exposing (Decoder) import Json.Decode.Pipeline as JDP import Json.Encode as JE {-| The Participant type -} type alias Participant = { participantId : Maybe Int , firstName : String , lastName : String , middleName : String , email : String , primaryAddress : Maybe Address , phone : PhoneNumber , mobilePhone : PhoneNumber , profilePicture : String , gender : Gender , birthDate : Maybe Date , birthDateYear : Maybe ListItem , birthDateMonth : Maybe ListItem , account : Maybe Account , username : Maybe String , password : Maybe String } {-| Get an empty Participant -} empty : Participant empty = { participantId = Nothing , firstName = "" , lastName = "" , middleName = "" , email = "" , primaryAddress = Nothing , phone = PhoneNumber.empty , mobilePhone = PhoneNumber.empty , profilePicture = "" , gender = Gender.Unspecified , birthDate = Nothing , birthDateYear = Nothing , birthDateMonth = Nothing , account = Nothing , username = Nothing , password = Nothing } type alias ParticipantLike a = { a | participantId : Maybe Int , firstName : String , lastName : String , middleName : String , email : String , primaryAddress : Maybe Address , phone : PhoneNumber , mobilePhone : PhoneNumber , profilePicture : String , gender : Gender , birthDate : Maybe Date , birthDateYear : Maybe ListItem , birthDateMonth : Maybe ListItem , account : Maybe Account , username : Maybe String , password : Maybe String } {-| Get a Participant from a partial -} toParticipant : ParticipantLike a -> Participant toParticipant data = { participantId = data.participantId , firstName = data.firstName , lastName = data.lastName , middleName = data.middleName , email = data.email , primaryAddress = data.primaryAddress , phone = data.phone , mobilePhone = data.mobilePhone , profilePicture = data.profilePicture , gender = data.gender , birthDate = data.birthDate , birthDateYear = data.birthDateYear , birthDateMonth = data.birthDateMonth , account = data.account , username = data.username , password = <PASSWORD> } {-| A Participant decoder -} decoder : Decoder Participant decoder = JD.succeed Participant |> JDP.required "participantId" (JD.map Just JD.int) |> JDP.required "firstName" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "lastName" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "middleName" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "email" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "primaryAddress" (JD.maybe Address.decoder) |> JDP.required "phone" PhoneNumber.decoder |> JDP.required "mobilePhone" PhoneNumber.decoder |> JDP.required "profilePicture" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "gender" Gender.decoder |> JDP.required "birthDatePosix" (JD.nullable isoDateDecoder) |> JDP.required "birthDateYear" (JD.maybe (JD.int |> JD.map (\val -> ( val, "" )))) |> JDP.required "birthDateMonth" (JD.maybe (JD.int |> JD.map (\val -> ( val, "" )))) |> JDP.required "account" (JD.maybe Account.decoder) |> JDP.required "username" (JD.string |> JD.map Just) |> JDP.optional "password" (JD.maybe JD.string) Nothing {-| A Participant encoder -} encoder : ParticipantLike a -> JE.Value encoder = encoderWith [] {-| A Participant with fields encoder -} encoderWith : List ( String, JE.Value ) -> ParticipantLike a -> JE.Value encoderWith fields participantData = JE.object (fields ++ [ ( "participantId", Maybe.map JE.int participantData.participantId |> Maybe.withDefault JE.null ) , ( "firstName", JE.string participantData.firstName ) , ( "middleName", JE.string participantData.middleName ) , ( "lastName", JE.string participantData.lastName ) , ( "email", JE.string participantData.email ) , ( "phone", PhoneNumber.encoder participantData.phone ) , ( "mobilePhone", PhoneNumber.encoder participantData.mobilePhone ) , ( "profilePicture", JE.string participantData.profilePicture ) , ( "gender", Gender.encoder participantData.gender ) , ( "birthDatePosix", Maybe.map (Date.toIsoString >> JE.string) participantData.birthDate |> Maybe.withDefault JE.null ) , ( "birthDateYear", Maybe.map (Tuple.first >> JE.int) participantData.birthDateYear |> Maybe.withDefault JE.null ) , ( "birthDateMonth", Maybe.map (Tuple.first >> JE.int) participantData.birthDateMonth |> Maybe.withDefault JE.null ) , ( "account", Maybe.map Account.encoder participantData.account |> Maybe.withDefault JE.null ) , ( "primaryAddress", Maybe.map Address.encoder participantData.primaryAddress |> Maybe.withDefault JE.null ) , ( "username", participantData.username |> Maybe.map JE.string |> Maybe.withDefault JE.null ) , ( "password", participantData.password |> Maybe.map JE.string |> Maybe.withDefault JE.null ) ] )
true
module Engage.Entity.Participant exposing ( Participant , decoder, empty, encoder, encoderWith, toParticipant ) {-| Entity.Participant @docs Participant @docs decoder, empty, encoder, encoderWith, toParticipant -} import Date exposing (Date) import Engage.Decode exposing (isoDateDecoder) import Engage.Entity.Account as Account exposing (Account) import Engage.Entity.Address as Address exposing (Address) import Engage.Entity.Gender as Gender exposing (Gender) import Engage.Entity.PhoneNumber as PhoneNumber exposing (PhoneNumber) import Engage.ListItem exposing (ListItem) import Json.Decode as JD exposing (Decoder) import Json.Decode.Pipeline as JDP import Json.Encode as JE {-| The Participant type -} type alias Participant = { participantId : Maybe Int , firstName : String , lastName : String , middleName : String , email : String , primaryAddress : Maybe Address , phone : PhoneNumber , mobilePhone : PhoneNumber , profilePicture : String , gender : Gender , birthDate : Maybe Date , birthDateYear : Maybe ListItem , birthDateMonth : Maybe ListItem , account : Maybe Account , username : Maybe String , password : Maybe String } {-| Get an empty Participant -} empty : Participant empty = { participantId = Nothing , firstName = "" , lastName = "" , middleName = "" , email = "" , primaryAddress = Nothing , phone = PhoneNumber.empty , mobilePhone = PhoneNumber.empty , profilePicture = "" , gender = Gender.Unspecified , birthDate = Nothing , birthDateYear = Nothing , birthDateMonth = Nothing , account = Nothing , username = Nothing , password = Nothing } type alias ParticipantLike a = { a | participantId : Maybe Int , firstName : String , lastName : String , middleName : String , email : String , primaryAddress : Maybe Address , phone : PhoneNumber , mobilePhone : PhoneNumber , profilePicture : String , gender : Gender , birthDate : Maybe Date , birthDateYear : Maybe ListItem , birthDateMonth : Maybe ListItem , account : Maybe Account , username : Maybe String , password : Maybe String } {-| Get a Participant from a partial -} toParticipant : ParticipantLike a -> Participant toParticipant data = { participantId = data.participantId , firstName = data.firstName , lastName = data.lastName , middleName = data.middleName , email = data.email , primaryAddress = data.primaryAddress , phone = data.phone , mobilePhone = data.mobilePhone , profilePicture = data.profilePicture , gender = data.gender , birthDate = data.birthDate , birthDateYear = data.birthDateYear , birthDateMonth = data.birthDateMonth , account = data.account , username = data.username , password = PI:PASSWORD:<PASSWORD>END_PI } {-| A Participant decoder -} decoder : Decoder Participant decoder = JD.succeed Participant |> JDP.required "participantId" (JD.map Just JD.int) |> JDP.required "firstName" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "lastName" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "middleName" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "email" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "primaryAddress" (JD.maybe Address.decoder) |> JDP.required "phone" PhoneNumber.decoder |> JDP.required "mobilePhone" PhoneNumber.decoder |> JDP.required "profilePicture" (JD.oneOf [ JD.null "", JD.string ]) |> JDP.required "gender" Gender.decoder |> JDP.required "birthDatePosix" (JD.nullable isoDateDecoder) |> JDP.required "birthDateYear" (JD.maybe (JD.int |> JD.map (\val -> ( val, "" )))) |> JDP.required "birthDateMonth" (JD.maybe (JD.int |> JD.map (\val -> ( val, "" )))) |> JDP.required "account" (JD.maybe Account.decoder) |> JDP.required "username" (JD.string |> JD.map Just) |> JDP.optional "password" (JD.maybe JD.string) Nothing {-| A Participant encoder -} encoder : ParticipantLike a -> JE.Value encoder = encoderWith [] {-| A Participant with fields encoder -} encoderWith : List ( String, JE.Value ) -> ParticipantLike a -> JE.Value encoderWith fields participantData = JE.object (fields ++ [ ( "participantId", Maybe.map JE.int participantData.participantId |> Maybe.withDefault JE.null ) , ( "firstName", JE.string participantData.firstName ) , ( "middleName", JE.string participantData.middleName ) , ( "lastName", JE.string participantData.lastName ) , ( "email", JE.string participantData.email ) , ( "phone", PhoneNumber.encoder participantData.phone ) , ( "mobilePhone", PhoneNumber.encoder participantData.mobilePhone ) , ( "profilePicture", JE.string participantData.profilePicture ) , ( "gender", Gender.encoder participantData.gender ) , ( "birthDatePosix", Maybe.map (Date.toIsoString >> JE.string) participantData.birthDate |> Maybe.withDefault JE.null ) , ( "birthDateYear", Maybe.map (Tuple.first >> JE.int) participantData.birthDateYear |> Maybe.withDefault JE.null ) , ( "birthDateMonth", Maybe.map (Tuple.first >> JE.int) participantData.birthDateMonth |> Maybe.withDefault JE.null ) , ( "account", Maybe.map Account.encoder participantData.account |> Maybe.withDefault JE.null ) , ( "primaryAddress", Maybe.map Address.encoder participantData.primaryAddress |> Maybe.withDefault JE.null ) , ( "username", participantData.username |> Maybe.map JE.string |> Maybe.withDefault JE.null ) , ( "password", participantData.password |> Maybe.map JE.string |> Maybe.withDefault JE.null ) ] )
elm
[ { "context": ", ( \" 345 m \", Ok 345 )\n\n -- 2020-03-12 from TheRealManiac (https://forum.botengine.org/t/last-version-of-mi", "end": 605, "score": 0.999415338, "start": 592, "tag": "USERNAME", "value": "TheRealManiac" }, { "context": ", ( \"6.621 m \", Ok 6621 )\n\n -- 2020-03-22 from istu233 at https://forum.botengine.org/t/mining-bot-probl", "end": 732, "score": 0.9996323586, "start": 725, "tag": "USERNAME", "value": "istu233" }, { "context": "DCF580-[In Space with selected Ore Hold].zip' from Leon Bechen.\n , ( \"0/5.000,0 m³\", Ok { used = 0, maximum =", "end": 1785, "score": 0.9893501401, "start": 1774, "tag": "NAME", "value": "Leon Bechen" }, { "context": "020-02-23 process-sample-FFE3312944 contributed by ORly (https://forum.botengine.org/t/mining-bot-i-canno", "end": 2062, "score": 0.9589499235, "start": 2058, "tag": "USERNAME", "value": "ORly" } ]
implement/applications/eve-online/eve-online-sanderling-framework/tests/ParseMemoryReadingTest.elm
kiwi12456/fleet_hauler
0
module ParseMemoryReadingTest exposing (allTests) import Common.EffectOnWindow import EveOnline.ParseUserInterface import Expect import Test allTests : Test.Test allTests = Test.describe "Parse memory reading" [ overview_entry_distance_text_to_meter , inventory_capacity_gauge_text , parse_module_button_tooltip_shortcut ] overview_entry_distance_text_to_meter : Test.Test overview_entry_distance_text_to_meter = [ ( "2,856 m", Ok 2856 ) , ( "123 m", Ok 123 ) , ( "16 km", Ok 16000 ) , ( " 345 m ", Ok 345 ) -- 2020-03-12 from TheRealManiac (https://forum.botengine.org/t/last-version-of-mining-bot/3149) , ( "6.621 m ", Ok 6621 ) -- 2020-03-22 from istu233 at https://forum.botengine.org/t/mining-bot-problem/3169 , ( "2 980 m", Ok 2980 ) ] |> List.map (\( displayText, expectedResult ) -> Test.test displayText <| \_ -> displayText |> EveOnline.ParseUserInterface.parseOverviewEntryDistanceInMetersFromText |> Expect.equal expectedResult ) |> Test.describe "Overview entry distance text" inventory_capacity_gauge_text : Test.Test inventory_capacity_gauge_text = [ ( "1,211.9/5,000.0 m³", Ok { used = 1211, maximum = Just 5000, selected = Nothing } ) , ( " 123.4 / 5,000.0 m³ ", Ok { used = 123, maximum = Just 5000, selected = Nothing } ) -- Example from https://forum.botengine.org/t/standard-mining-bot-problems/2715/14?u=viir , ( "4 999,8/5 000,0 m³", Ok { used = 4999, maximum = Just 5000, selected = Nothing } ) -- 2020-01-31 sample 'process-sample-2FA2DCF580-[In Space with selected Ore Hold].zip' from Leon Bechen. , ( "0/5.000,0 m³", Ok { used = 0, maximum = Just 5000, selected = Nothing } ) -- 2020-02-16-eve-online-sample , ( "(33.3) 53.6/450.0 m³", Ok { used = 53, maximum = Just 450, selected = Just 33 } ) -- 2020-02-23 process-sample-FFE3312944 contributed by ORly (https://forum.botengine.org/t/mining-bot-i-cannot-see-the-ore-hold-capacity-gauge/3101/5?u=viir) , ( "0/5\u{00A0}000,0 m³", Ok { used = 0, maximum = Just 5000, selected = Nothing } ) -- 2020-07-26 scenario shared by neolexo at https://forum.botengine.org/t/issue-with-mining/3469/3?u=viir , ( "0/5’000.0 m³", Ok { used = 0, maximum = Just 5000, selected = Nothing } ) ] |> List.map (\( text, expectedResult ) -> Test.test text <| \_ -> text |> EveOnline.ParseUserInterface.parseInventoryCapacityGaugeText |> Expect.equal expectedResult ) |> Test.describe "Inventory capacity gauge text" parse_module_button_tooltip_shortcut : Test.Test parse_module_button_tooltip_shortcut = [ ( " F1 ", [ Common.EffectOnWindow.vkey_F1 ] ) , ( " CTRL-F3 ", [ Common.EffectOnWindow.vkey_LCONTROL, Common.EffectOnWindow.vkey_F3 ] ) , ( " STRG-F4 ", [ Common.EffectOnWindow.vkey_LCONTROL, Common.EffectOnWindow.vkey_F4 ] ) , ( " ALT+F4 ", [ Common.EffectOnWindow.vkey_LMENU, Common.EffectOnWindow.vkey_F4 ] ) , ( " SHIFT - F5 ", [ Common.EffectOnWindow.vkey_LSHIFT, Common.EffectOnWindow.vkey_F5 ] ) , ( " UMSCH-F6 ", [ Common.EffectOnWindow.vkey_LSHIFT, Common.EffectOnWindow.vkey_F6 ] ) ] |> List.map (\( text, expectedResult ) -> Test.test text <| \_ -> text |> EveOnline.ParseUserInterface.parseModuleButtonTooltipShortcut |> Expect.equal (Ok expectedResult) ) |> Test.describe "Parse module button tooltip shortcut"
47493
module ParseMemoryReadingTest exposing (allTests) import Common.EffectOnWindow import EveOnline.ParseUserInterface import Expect import Test allTests : Test.Test allTests = Test.describe "Parse memory reading" [ overview_entry_distance_text_to_meter , inventory_capacity_gauge_text , parse_module_button_tooltip_shortcut ] overview_entry_distance_text_to_meter : Test.Test overview_entry_distance_text_to_meter = [ ( "2,856 m", Ok 2856 ) , ( "123 m", Ok 123 ) , ( "16 km", Ok 16000 ) , ( " 345 m ", Ok 345 ) -- 2020-03-12 from TheRealManiac (https://forum.botengine.org/t/last-version-of-mining-bot/3149) , ( "6.621 m ", Ok 6621 ) -- 2020-03-22 from istu233 at https://forum.botengine.org/t/mining-bot-problem/3169 , ( "2 980 m", Ok 2980 ) ] |> List.map (\( displayText, expectedResult ) -> Test.test displayText <| \_ -> displayText |> EveOnline.ParseUserInterface.parseOverviewEntryDistanceInMetersFromText |> Expect.equal expectedResult ) |> Test.describe "Overview entry distance text" inventory_capacity_gauge_text : Test.Test inventory_capacity_gauge_text = [ ( "1,211.9/5,000.0 m³", Ok { used = 1211, maximum = Just 5000, selected = Nothing } ) , ( " 123.4 / 5,000.0 m³ ", Ok { used = 123, maximum = Just 5000, selected = Nothing } ) -- Example from https://forum.botengine.org/t/standard-mining-bot-problems/2715/14?u=viir , ( "4 999,8/5 000,0 m³", Ok { used = 4999, maximum = Just 5000, selected = Nothing } ) -- 2020-01-31 sample 'process-sample-2FA2DCF580-[In Space with selected Ore Hold].zip' from <NAME>. , ( "0/5.000,0 m³", Ok { used = 0, maximum = Just 5000, selected = Nothing } ) -- 2020-02-16-eve-online-sample , ( "(33.3) 53.6/450.0 m³", Ok { used = 53, maximum = Just 450, selected = Just 33 } ) -- 2020-02-23 process-sample-FFE3312944 contributed by ORly (https://forum.botengine.org/t/mining-bot-i-cannot-see-the-ore-hold-capacity-gauge/3101/5?u=viir) , ( "0/5\u{00A0}000,0 m³", Ok { used = 0, maximum = Just 5000, selected = Nothing } ) -- 2020-07-26 scenario shared by neolexo at https://forum.botengine.org/t/issue-with-mining/3469/3?u=viir , ( "0/5’000.0 m³", Ok { used = 0, maximum = Just 5000, selected = Nothing } ) ] |> List.map (\( text, expectedResult ) -> Test.test text <| \_ -> text |> EveOnline.ParseUserInterface.parseInventoryCapacityGaugeText |> Expect.equal expectedResult ) |> Test.describe "Inventory capacity gauge text" parse_module_button_tooltip_shortcut : Test.Test parse_module_button_tooltip_shortcut = [ ( " F1 ", [ Common.EffectOnWindow.vkey_F1 ] ) , ( " CTRL-F3 ", [ Common.EffectOnWindow.vkey_LCONTROL, Common.EffectOnWindow.vkey_F3 ] ) , ( " STRG-F4 ", [ Common.EffectOnWindow.vkey_LCONTROL, Common.EffectOnWindow.vkey_F4 ] ) , ( " ALT+F4 ", [ Common.EffectOnWindow.vkey_LMENU, Common.EffectOnWindow.vkey_F4 ] ) , ( " SHIFT - F5 ", [ Common.EffectOnWindow.vkey_LSHIFT, Common.EffectOnWindow.vkey_F5 ] ) , ( " UMSCH-F6 ", [ Common.EffectOnWindow.vkey_LSHIFT, Common.EffectOnWindow.vkey_F6 ] ) ] |> List.map (\( text, expectedResult ) -> Test.test text <| \_ -> text |> EveOnline.ParseUserInterface.parseModuleButtonTooltipShortcut |> Expect.equal (Ok expectedResult) ) |> Test.describe "Parse module button tooltip shortcut"
true
module ParseMemoryReadingTest exposing (allTests) import Common.EffectOnWindow import EveOnline.ParseUserInterface import Expect import Test allTests : Test.Test allTests = Test.describe "Parse memory reading" [ overview_entry_distance_text_to_meter , inventory_capacity_gauge_text , parse_module_button_tooltip_shortcut ] overview_entry_distance_text_to_meter : Test.Test overview_entry_distance_text_to_meter = [ ( "2,856 m", Ok 2856 ) , ( "123 m", Ok 123 ) , ( "16 km", Ok 16000 ) , ( " 345 m ", Ok 345 ) -- 2020-03-12 from TheRealManiac (https://forum.botengine.org/t/last-version-of-mining-bot/3149) , ( "6.621 m ", Ok 6621 ) -- 2020-03-22 from istu233 at https://forum.botengine.org/t/mining-bot-problem/3169 , ( "2 980 m", Ok 2980 ) ] |> List.map (\( displayText, expectedResult ) -> Test.test displayText <| \_ -> displayText |> EveOnline.ParseUserInterface.parseOverviewEntryDistanceInMetersFromText |> Expect.equal expectedResult ) |> Test.describe "Overview entry distance text" inventory_capacity_gauge_text : Test.Test inventory_capacity_gauge_text = [ ( "1,211.9/5,000.0 m³", Ok { used = 1211, maximum = Just 5000, selected = Nothing } ) , ( " 123.4 / 5,000.0 m³ ", Ok { used = 123, maximum = Just 5000, selected = Nothing } ) -- Example from https://forum.botengine.org/t/standard-mining-bot-problems/2715/14?u=viir , ( "4 999,8/5 000,0 m³", Ok { used = 4999, maximum = Just 5000, selected = Nothing } ) -- 2020-01-31 sample 'process-sample-2FA2DCF580-[In Space with selected Ore Hold].zip' from PI:NAME:<NAME>END_PI. , ( "0/5.000,0 m³", Ok { used = 0, maximum = Just 5000, selected = Nothing } ) -- 2020-02-16-eve-online-sample , ( "(33.3) 53.6/450.0 m³", Ok { used = 53, maximum = Just 450, selected = Just 33 } ) -- 2020-02-23 process-sample-FFE3312944 contributed by ORly (https://forum.botengine.org/t/mining-bot-i-cannot-see-the-ore-hold-capacity-gauge/3101/5?u=viir) , ( "0/5\u{00A0}000,0 m³", Ok { used = 0, maximum = Just 5000, selected = Nothing } ) -- 2020-07-26 scenario shared by neolexo at https://forum.botengine.org/t/issue-with-mining/3469/3?u=viir , ( "0/5’000.0 m³", Ok { used = 0, maximum = Just 5000, selected = Nothing } ) ] |> List.map (\( text, expectedResult ) -> Test.test text <| \_ -> text |> EveOnline.ParseUserInterface.parseInventoryCapacityGaugeText |> Expect.equal expectedResult ) |> Test.describe "Inventory capacity gauge text" parse_module_button_tooltip_shortcut : Test.Test parse_module_button_tooltip_shortcut = [ ( " F1 ", [ Common.EffectOnWindow.vkey_F1 ] ) , ( " CTRL-F3 ", [ Common.EffectOnWindow.vkey_LCONTROL, Common.EffectOnWindow.vkey_F3 ] ) , ( " STRG-F4 ", [ Common.EffectOnWindow.vkey_LCONTROL, Common.EffectOnWindow.vkey_F4 ] ) , ( " ALT+F4 ", [ Common.EffectOnWindow.vkey_LMENU, Common.EffectOnWindow.vkey_F4 ] ) , ( " SHIFT - F5 ", [ Common.EffectOnWindow.vkey_LSHIFT, Common.EffectOnWindow.vkey_F5 ] ) , ( " UMSCH-F6 ", [ Common.EffectOnWindow.vkey_LSHIFT, Common.EffectOnWindow.vkey_F6 ] ) ] |> List.map (\( text, expectedResult ) -> Test.test text <| \_ -> text |> EveOnline.ParseUserInterface.parseModuleButtonTooltipShortcut |> Expect.equal (Ok expectedResult) ) |> Test.describe "Parse module button tooltip shortcut"
elm
[ { "context": "e center\" ]\n [ text \"Made with 😭 by Fotis Papadogeogopoulos\"\n ]\n ]\n ]\n\n\nnavb", "end": 2843, "score": 0.9998998642, "start": 2820, "tag": "NAME", "value": "Fotis Papadogeogopoulos" } ]
src/Views/Page.elm
fpapado/ephemeral
33
module Views.Page exposing (ActivePage(..), frame, fullFrame) import Data.User exposing (User) import Html exposing (..) import Html.Attributes exposing (..) import Route exposing (Route) import Views.General exposing (avatar, epButton) import Views.Icons as Icons type ActivePage = Other | Home | Login | Settings | NewEntry | FullMap frame : Maybe User -> ActivePage -> Html msg -> Html msg frame user page content = div [] [ viewMenu page user -- , viewHeader user , div [ class "pa3 pt4 ph5-ns bg-white" ] [ div [ class "mw7-ns center" ] [ content ] , viewFooter ] ] fullFrame : Maybe User -> ActivePage -> Html msg -> Html msg fullFrame user page content = div [] [ viewMenu page user , content ] viewMenu : ActivePage -> Maybe User -> Html msg viewMenu page user = div [ class "h-nav fixed bottom-0 left-0 w-100 z-999" ] [ nav [ class "h-100 mw7-ns center flex flex-row f6 f5-ns black bg-nav bt b--black-20" ] <| [ navbarLink (page == Home) Route.Home [ iconAndText Icons.list "List" ] , navbarLink (page == NewEntry) Route.NewEntry [ iconAndText Icons.edit "Add" ] , navbarLink (page == FullMap) Route.FullMap [ iconAndText Icons.map "Add" ] , navbarLink (page == Settings) Route.Settings [ iconAndText Icons.settings "Settings" ] ] ++ viewSignIn page user ] viewSignIn : ActivePage -> Maybe User -> List (Html msg) viewSignIn page user = case user of Nothing -> [ navbarLink (page == Login) Route.Login [ iconAndText Icons.logIn "Login" ] ] Just user -> [ navbarLink False Route.Logout [ iconAndText Icons.logOut "Logout" ] ] iconAndText : Html msg -> a -> Html msg iconAndText icon txt = -- , p [ class "mt1 mb0" ] [ text txt ] div [ class "mv0 center relative flex flex-column items-center justify-center" ] [ icon ] viewHeader : Maybe User -> Html msg viewHeader loggedIn = let name = case loggedIn of Nothing -> "Guest" Just user -> user.username in div [ class "pa4" ] [ avatar name [ class "pointer mw4 center" ] ] viewFooter : Html msg viewFooter = div [ class "mt4" ] [ hr [ class "mv0 w-100 bb bw1 b--black-10" ] [] , div [ class "pv3 tc" ] [ p [ class "f6 lh-copy measure center" ] [ text "Ephemeral is an app for writing down words and their translations, as you encounter them" ] , span [ class "f6 lh-copy measure center" ] [ text "Made with 😭 by Fotis Papadogeogopoulos" ] ] ] navbarLink : Bool -> Route -> List (Html msg) -> Html msg navbarLink isActive route linkContent = div [ class "h-100 flex flex-column flex-grow-1 justify-center items-center" ] [ a [ classList [ ( "w-100 h-100 flex items-center b", True ), ( "white hover-white", isActive ), ( "dim nav-disabled", not isActive ) ], Route.href route ] linkContent ]
35079
module Views.Page exposing (ActivePage(..), frame, fullFrame) import Data.User exposing (User) import Html exposing (..) import Html.Attributes exposing (..) import Route exposing (Route) import Views.General exposing (avatar, epButton) import Views.Icons as Icons type ActivePage = Other | Home | Login | Settings | NewEntry | FullMap frame : Maybe User -> ActivePage -> Html msg -> Html msg frame user page content = div [] [ viewMenu page user -- , viewHeader user , div [ class "pa3 pt4 ph5-ns bg-white" ] [ div [ class "mw7-ns center" ] [ content ] , viewFooter ] ] fullFrame : Maybe User -> ActivePage -> Html msg -> Html msg fullFrame user page content = div [] [ viewMenu page user , content ] viewMenu : ActivePage -> Maybe User -> Html msg viewMenu page user = div [ class "h-nav fixed bottom-0 left-0 w-100 z-999" ] [ nav [ class "h-100 mw7-ns center flex flex-row f6 f5-ns black bg-nav bt b--black-20" ] <| [ navbarLink (page == Home) Route.Home [ iconAndText Icons.list "List" ] , navbarLink (page == NewEntry) Route.NewEntry [ iconAndText Icons.edit "Add" ] , navbarLink (page == FullMap) Route.FullMap [ iconAndText Icons.map "Add" ] , navbarLink (page == Settings) Route.Settings [ iconAndText Icons.settings "Settings" ] ] ++ viewSignIn page user ] viewSignIn : ActivePage -> Maybe User -> List (Html msg) viewSignIn page user = case user of Nothing -> [ navbarLink (page == Login) Route.Login [ iconAndText Icons.logIn "Login" ] ] Just user -> [ navbarLink False Route.Logout [ iconAndText Icons.logOut "Logout" ] ] iconAndText : Html msg -> a -> Html msg iconAndText icon txt = -- , p [ class "mt1 mb0" ] [ text txt ] div [ class "mv0 center relative flex flex-column items-center justify-center" ] [ icon ] viewHeader : Maybe User -> Html msg viewHeader loggedIn = let name = case loggedIn of Nothing -> "Guest" Just user -> user.username in div [ class "pa4" ] [ avatar name [ class "pointer mw4 center" ] ] viewFooter : Html msg viewFooter = div [ class "mt4" ] [ hr [ class "mv0 w-100 bb bw1 b--black-10" ] [] , div [ class "pv3 tc" ] [ p [ class "f6 lh-copy measure center" ] [ text "Ephemeral is an app for writing down words and their translations, as you encounter them" ] , span [ class "f6 lh-copy measure center" ] [ text "Made with 😭 by <NAME>" ] ] ] navbarLink : Bool -> Route -> List (Html msg) -> Html msg navbarLink isActive route linkContent = div [ class "h-100 flex flex-column flex-grow-1 justify-center items-center" ] [ a [ classList [ ( "w-100 h-100 flex items-center b", True ), ( "white hover-white", isActive ), ( "dim nav-disabled", not isActive ) ], Route.href route ] linkContent ]
true
module Views.Page exposing (ActivePage(..), frame, fullFrame) import Data.User exposing (User) import Html exposing (..) import Html.Attributes exposing (..) import Route exposing (Route) import Views.General exposing (avatar, epButton) import Views.Icons as Icons type ActivePage = Other | Home | Login | Settings | NewEntry | FullMap frame : Maybe User -> ActivePage -> Html msg -> Html msg frame user page content = div [] [ viewMenu page user -- , viewHeader user , div [ class "pa3 pt4 ph5-ns bg-white" ] [ div [ class "mw7-ns center" ] [ content ] , viewFooter ] ] fullFrame : Maybe User -> ActivePage -> Html msg -> Html msg fullFrame user page content = div [] [ viewMenu page user , content ] viewMenu : ActivePage -> Maybe User -> Html msg viewMenu page user = div [ class "h-nav fixed bottom-0 left-0 w-100 z-999" ] [ nav [ class "h-100 mw7-ns center flex flex-row f6 f5-ns black bg-nav bt b--black-20" ] <| [ navbarLink (page == Home) Route.Home [ iconAndText Icons.list "List" ] , navbarLink (page == NewEntry) Route.NewEntry [ iconAndText Icons.edit "Add" ] , navbarLink (page == FullMap) Route.FullMap [ iconAndText Icons.map "Add" ] , navbarLink (page == Settings) Route.Settings [ iconAndText Icons.settings "Settings" ] ] ++ viewSignIn page user ] viewSignIn : ActivePage -> Maybe User -> List (Html msg) viewSignIn page user = case user of Nothing -> [ navbarLink (page == Login) Route.Login [ iconAndText Icons.logIn "Login" ] ] Just user -> [ navbarLink False Route.Logout [ iconAndText Icons.logOut "Logout" ] ] iconAndText : Html msg -> a -> Html msg iconAndText icon txt = -- , p [ class "mt1 mb0" ] [ text txt ] div [ class "mv0 center relative flex flex-column items-center justify-center" ] [ icon ] viewHeader : Maybe User -> Html msg viewHeader loggedIn = let name = case loggedIn of Nothing -> "Guest" Just user -> user.username in div [ class "pa4" ] [ avatar name [ class "pointer mw4 center" ] ] viewFooter : Html msg viewFooter = div [ class "mt4" ] [ hr [ class "mv0 w-100 bb bw1 b--black-10" ] [] , div [ class "pv3 tc" ] [ p [ class "f6 lh-copy measure center" ] [ text "Ephemeral is an app for writing down words and their translations, as you encounter them" ] , span [ class "f6 lh-copy measure center" ] [ text "Made with 😭 by PI:NAME:<NAME>END_PI" ] ] ] navbarLink : Bool -> Route -> List (Html msg) -> Html msg navbarLink isActive route linkContent = div [ class "h-100 flex flex-column flex-grow-1 justify-center items-center" ] [ a [ classList [ ( "w-100 h-100 flex items-center b", True ), ( "white hover-white", isActive ), ( "dim nav-disabled", not isActive ) ], Route.href route ] linkContent ]
elm
[ { "context": "Object1 =\n \"\"\"\n {\n \"name\" : \"Arthur\",\n \"age\" : 22,\n \"role\" : \"", "end": 403, "score": 0.9998323321, "start": 397, "tag": "NAME", "value": "Arthur" } ]
example-elm/play-1/decode.elm
raoul2000/js-playground
1
module Main exposing (..) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onInput) import Json.Decode exposing (..) -- MODEL type Role = Manager | Employee | Chief type alias Object = { name : String , age : Int , role : Role } stringObject1 : String stringObject1 = """ { "name" : "Arthur", "age" : 22, "role" : "Employee" } """ initObject : Object initObject = Object "Bobby" 12 Manager type alias Model = { object : Object , asString : String , message : String } initModel : Model initModel = Model initObject stringObject1 "" init : ( Model, Cmd Msg ) init = ( initModel, Cmd.none ) roleDecoder : Decoder Role roleDecoder = let convert : String -> Decoder Role convert a = case a of "Manager" -> succeed Manager "Employee" -> succeed Employee "Chief" -> succeed Chief _ -> fail <| "Trying to decode Role, but value \"" ++ a ++ "\" is not supported." in string |> andThen convert objectDecoder : Decoder Object objectDecoder = map3 Object (field "name" string) (field "age" int) (field "role" roleDecoder) -- MESSAGES type Msg = Decode | WorkNow (Result String Object) | CommitJSON String -- VIEW view : Model -> Html Msg view model = div [] [ h1 [] [ text "Json.Decode"] , button [ onClick (WorkNow (decodeString objectDecoder model.asString)) ] [ text "Decode" ] , div [] [ text model.message ] , textarea [ style [ ( "width", "100%" ) , ( "height", "200px" ) ] , onInput CommitJSON ] [ text model.asString ] , ul [] [ li [] [ text ("name : " ++ model.object.name) ] , li [] [ text ("age : " ++ (toString model.object.age)) ] , li [] [ text ("role : " ++ (toString model.object.role)) ] ] ] -- UPDATE update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of CommitJSON str -> ( { model | asString = str } , Cmd.none ) Decode -> ( model, Cmd.none ) WorkNow (Ok obj) -> ( { model | object = obj } , Cmd.none ) WorkNow (Err msg) -> ( { model | message = msg } , Cmd.none ) -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions model = Sub.none -- MAIN main = program { init = init , view = view , update = update , subscriptions = subscriptions }
23829
module Main exposing (..) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onInput) import Json.Decode exposing (..) -- MODEL type Role = Manager | Employee | Chief type alias Object = { name : String , age : Int , role : Role } stringObject1 : String stringObject1 = """ { "name" : "<NAME>", "age" : 22, "role" : "Employee" } """ initObject : Object initObject = Object "Bobby" 12 Manager type alias Model = { object : Object , asString : String , message : String } initModel : Model initModel = Model initObject stringObject1 "" init : ( Model, Cmd Msg ) init = ( initModel, Cmd.none ) roleDecoder : Decoder Role roleDecoder = let convert : String -> Decoder Role convert a = case a of "Manager" -> succeed Manager "Employee" -> succeed Employee "Chief" -> succeed Chief _ -> fail <| "Trying to decode Role, but value \"" ++ a ++ "\" is not supported." in string |> andThen convert objectDecoder : Decoder Object objectDecoder = map3 Object (field "name" string) (field "age" int) (field "role" roleDecoder) -- MESSAGES type Msg = Decode | WorkNow (Result String Object) | CommitJSON String -- VIEW view : Model -> Html Msg view model = div [] [ h1 [] [ text "Json.Decode"] , button [ onClick (WorkNow (decodeString objectDecoder model.asString)) ] [ text "Decode" ] , div [] [ text model.message ] , textarea [ style [ ( "width", "100%" ) , ( "height", "200px" ) ] , onInput CommitJSON ] [ text model.asString ] , ul [] [ li [] [ text ("name : " ++ model.object.name) ] , li [] [ text ("age : " ++ (toString model.object.age)) ] , li [] [ text ("role : " ++ (toString model.object.role)) ] ] ] -- UPDATE update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of CommitJSON str -> ( { model | asString = str } , Cmd.none ) Decode -> ( model, Cmd.none ) WorkNow (Ok obj) -> ( { model | object = obj } , Cmd.none ) WorkNow (Err msg) -> ( { model | message = msg } , Cmd.none ) -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions model = Sub.none -- MAIN main = program { init = init , view = view , update = update , subscriptions = subscriptions }
true
module Main exposing (..) import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (onClick, onInput) import Json.Decode exposing (..) -- MODEL type Role = Manager | Employee | Chief type alias Object = { name : String , age : Int , role : Role } stringObject1 : String stringObject1 = """ { "name" : "PI:NAME:<NAME>END_PI", "age" : 22, "role" : "Employee" } """ initObject : Object initObject = Object "Bobby" 12 Manager type alias Model = { object : Object , asString : String , message : String } initModel : Model initModel = Model initObject stringObject1 "" init : ( Model, Cmd Msg ) init = ( initModel, Cmd.none ) roleDecoder : Decoder Role roleDecoder = let convert : String -> Decoder Role convert a = case a of "Manager" -> succeed Manager "Employee" -> succeed Employee "Chief" -> succeed Chief _ -> fail <| "Trying to decode Role, but value \"" ++ a ++ "\" is not supported." in string |> andThen convert objectDecoder : Decoder Object objectDecoder = map3 Object (field "name" string) (field "age" int) (field "role" roleDecoder) -- MESSAGES type Msg = Decode | WorkNow (Result String Object) | CommitJSON String -- VIEW view : Model -> Html Msg view model = div [] [ h1 [] [ text "Json.Decode"] , button [ onClick (WorkNow (decodeString objectDecoder model.asString)) ] [ text "Decode" ] , div [] [ text model.message ] , textarea [ style [ ( "width", "100%" ) , ( "height", "200px" ) ] , onInput CommitJSON ] [ text model.asString ] , ul [] [ li [] [ text ("name : " ++ model.object.name) ] , li [] [ text ("age : " ++ (toString model.object.age)) ] , li [] [ text ("role : " ++ (toString model.object.role)) ] ] ] -- UPDATE update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of CommitJSON str -> ( { model | asString = str } , Cmd.none ) Decode -> ( model, Cmd.none ) WorkNow (Ok obj) -> ( { model | object = obj } , Cmd.none ) WorkNow (Err msg) -> ( { model | message = msg } , Cmd.none ) -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions model = Sub.none -- MAIN main = program { init = init , view = view , update = update , subscriptions = subscriptions }
elm
[ { "context": "{-\n Main.elm\n Author: Henrique da Cunha Buss\n Creation: October/2020\n This file contains t", "end": 48, "score": 0.9998632073, "start": 26, "tag": "NAME", "value": "Henrique da Cunha Buss" } ]
src/Main.elm
NeoVier/LFC01
0
{- Main.elm Author: Henrique da Cunha Buss Creation: October/2020 This file contains the main and update functions, and is the entrypoint of the application -} module Main exposing (..) import Browser import File exposing (File) import File.Download as Download import File.Select as Select import Models.Automata as Automata import Models.Grammars as Grammars import Models.Models as Models import Operations.Basics as BasicOperations import Operations.Conversion.Automata as CAutomata import Operations.Conversion.Grammars as CGrammars import Operations.Conversion.Regex as CRegex import Operations.GLC as OpGLC import Operations.Minimization as Minimization import Parsing.Automata as PAutomata import Parsing.Grammars as PGrammars import Parsing.Regex as PRegex import Task import Types.Types as Types import Utils.Utils as Utils import View.View as View -- MAIN {- The program entrypoint, which defines the browser element according to The Elm Architecture -} main : Program () Types.Model Types.Msg main = Browser.element { init = Types.init , view = View.view , update = update , subscriptions = subscriptions } -- UPDATE {- The main update function, which gets called whenever a Types.Msg is fired -} update : Types.Msg -> Types.Model -> ( Types.Model, Cmd Types.Msg ) update msg model = case msg of Types.FileRequested f -> ( model, Select.file [ "text/txt" ] (Types.FileSelected f) ) Types.FileSelected f file -> ( model, Task.perform (Types.FileLoaded f) (File.toString file) ) Types.FileLoaded f content -> case f content of Nothing -> ( { model | currentItem = Err "Erro ao ler arquivo" } , Cmd.none ) Just item -> ( { model | currentItem = Ok item , itemHistory = item :: model.itemHistory } , Cmd.none ) Types.SaveFile name filetype content -> ( model, Download.string name filetype content ) Types.SetCurrent general -> ( { model | currentItem = Ok general }, Cmd.none ) Types.UpdateCurrent general -> ( { model | currentItem = Ok general , itemHistory = case model.currentItem of Ok curr -> Utils.replaceBy curr general model.itemHistory _ -> model.itemHistory } , Cmd.none ) Types.SetWithFunction f -> case model.currentItem of Ok m -> let result = f m newHistory = case result of Ok r -> if result == model.currentItem then model.itemHistory else r :: model.itemHistory _ -> model.itemHistory in ( { model | currentItem = result , itemHistory = newHistory } , Cmd.none ) _ -> ( model, Cmd.none ) Types.RemoveItem general -> let newHistory = List.filter (\a -> a /= general) model.itemHistory in ( { model | itemHistory = newHistory , currentItem = case List.head newHistory of Nothing -> Err "Nenhum item carregado" Just a -> Ok a } , Cmd.none ) Types.SetSentence sentence -> ( { model | currentSentence = sentence }, Cmd.none ) Types.DoUnion -> case Utils.getFirstTwoAsAFDs model.itemHistory of Nothing -> ( { model | currentItem = Err "Erro ao fazer união" } , Cmd.none ) Just ( afd1, afd2 ) -> let result = BasicOperations.union afd1 afd2 |> Automata.FiniteNonDeterministic |> Models.Automaton in ( { model | currentItem = Ok result , itemHistory = result :: model.itemHistory } , Cmd.none ) Types.DoIntersection -> case Utils.getFirstTwoAsAFDs model.itemHistory of Nothing -> ( { model | currentItem = Err "Erro ao fazer interseção" } , Cmd.none ) Just ( afd1, afd2 ) -> let result = BasicOperations.intersection afd1 afd2 |> Automata.FiniteDeterministic |> Models.Automaton in ( { model | currentItem = Ok result , itemHistory = result :: model.itemHistory } , Cmd.none ) Types.ConvertERToAFD -> case model.currentItem of Ok (Models.Regex regexes) -> let results = List.map (\( id, regex ) -> CRegex.erToAfd regex |> Automata.FiniteDeterministic |> Models.Automaton ) regexes in case List.head results of Nothing -> ( model, Cmd.none ) Just afd -> ( { model | currentItem = Ok afd , itemHistory = results ++ model.itemHistory } , Cmd.none ) _ -> ( model, Cmd.none ) Types.NoOp -> ( model, Cmd.none ) -- SUBSCRIPTIONS {- We don't need any subscriptions for this application -} subscriptions : Types.Model -> Sub Types.Msg subscriptions model = Sub.none
12235
{- Main.elm Author: <NAME> Creation: October/2020 This file contains the main and update functions, and is the entrypoint of the application -} module Main exposing (..) import Browser import File exposing (File) import File.Download as Download import File.Select as Select import Models.Automata as Automata import Models.Grammars as Grammars import Models.Models as Models import Operations.Basics as BasicOperations import Operations.Conversion.Automata as CAutomata import Operations.Conversion.Grammars as CGrammars import Operations.Conversion.Regex as CRegex import Operations.GLC as OpGLC import Operations.Minimization as Minimization import Parsing.Automata as PAutomata import Parsing.Grammars as PGrammars import Parsing.Regex as PRegex import Task import Types.Types as Types import Utils.Utils as Utils import View.View as View -- MAIN {- The program entrypoint, which defines the browser element according to The Elm Architecture -} main : Program () Types.Model Types.Msg main = Browser.element { init = Types.init , view = View.view , update = update , subscriptions = subscriptions } -- UPDATE {- The main update function, which gets called whenever a Types.Msg is fired -} update : Types.Msg -> Types.Model -> ( Types.Model, Cmd Types.Msg ) update msg model = case msg of Types.FileRequested f -> ( model, Select.file [ "text/txt" ] (Types.FileSelected f) ) Types.FileSelected f file -> ( model, Task.perform (Types.FileLoaded f) (File.toString file) ) Types.FileLoaded f content -> case f content of Nothing -> ( { model | currentItem = Err "Erro ao ler arquivo" } , Cmd.none ) Just item -> ( { model | currentItem = Ok item , itemHistory = item :: model.itemHistory } , Cmd.none ) Types.SaveFile name filetype content -> ( model, Download.string name filetype content ) Types.SetCurrent general -> ( { model | currentItem = Ok general }, Cmd.none ) Types.UpdateCurrent general -> ( { model | currentItem = Ok general , itemHistory = case model.currentItem of Ok curr -> Utils.replaceBy curr general model.itemHistory _ -> model.itemHistory } , Cmd.none ) Types.SetWithFunction f -> case model.currentItem of Ok m -> let result = f m newHistory = case result of Ok r -> if result == model.currentItem then model.itemHistory else r :: model.itemHistory _ -> model.itemHistory in ( { model | currentItem = result , itemHistory = newHistory } , Cmd.none ) _ -> ( model, Cmd.none ) Types.RemoveItem general -> let newHistory = List.filter (\a -> a /= general) model.itemHistory in ( { model | itemHistory = newHistory , currentItem = case List.head newHistory of Nothing -> Err "Nenhum item carregado" Just a -> Ok a } , Cmd.none ) Types.SetSentence sentence -> ( { model | currentSentence = sentence }, Cmd.none ) Types.DoUnion -> case Utils.getFirstTwoAsAFDs model.itemHistory of Nothing -> ( { model | currentItem = Err "Erro ao fazer união" } , Cmd.none ) Just ( afd1, afd2 ) -> let result = BasicOperations.union afd1 afd2 |> Automata.FiniteNonDeterministic |> Models.Automaton in ( { model | currentItem = Ok result , itemHistory = result :: model.itemHistory } , Cmd.none ) Types.DoIntersection -> case Utils.getFirstTwoAsAFDs model.itemHistory of Nothing -> ( { model | currentItem = Err "Erro ao fazer interseção" } , Cmd.none ) Just ( afd1, afd2 ) -> let result = BasicOperations.intersection afd1 afd2 |> Automata.FiniteDeterministic |> Models.Automaton in ( { model | currentItem = Ok result , itemHistory = result :: model.itemHistory } , Cmd.none ) Types.ConvertERToAFD -> case model.currentItem of Ok (Models.Regex regexes) -> let results = List.map (\( id, regex ) -> CRegex.erToAfd regex |> Automata.FiniteDeterministic |> Models.Automaton ) regexes in case List.head results of Nothing -> ( model, Cmd.none ) Just afd -> ( { model | currentItem = Ok afd , itemHistory = results ++ model.itemHistory } , Cmd.none ) _ -> ( model, Cmd.none ) Types.NoOp -> ( model, Cmd.none ) -- SUBSCRIPTIONS {- We don't need any subscriptions for this application -} subscriptions : Types.Model -> Sub Types.Msg subscriptions model = Sub.none
true
{- Main.elm Author: PI:NAME:<NAME>END_PI Creation: October/2020 This file contains the main and update functions, and is the entrypoint of the application -} module Main exposing (..) import Browser import File exposing (File) import File.Download as Download import File.Select as Select import Models.Automata as Automata import Models.Grammars as Grammars import Models.Models as Models import Operations.Basics as BasicOperations import Operations.Conversion.Automata as CAutomata import Operations.Conversion.Grammars as CGrammars import Operations.Conversion.Regex as CRegex import Operations.GLC as OpGLC import Operations.Minimization as Minimization import Parsing.Automata as PAutomata import Parsing.Grammars as PGrammars import Parsing.Regex as PRegex import Task import Types.Types as Types import Utils.Utils as Utils import View.View as View -- MAIN {- The program entrypoint, which defines the browser element according to The Elm Architecture -} main : Program () Types.Model Types.Msg main = Browser.element { init = Types.init , view = View.view , update = update , subscriptions = subscriptions } -- UPDATE {- The main update function, which gets called whenever a Types.Msg is fired -} update : Types.Msg -> Types.Model -> ( Types.Model, Cmd Types.Msg ) update msg model = case msg of Types.FileRequested f -> ( model, Select.file [ "text/txt" ] (Types.FileSelected f) ) Types.FileSelected f file -> ( model, Task.perform (Types.FileLoaded f) (File.toString file) ) Types.FileLoaded f content -> case f content of Nothing -> ( { model | currentItem = Err "Erro ao ler arquivo" } , Cmd.none ) Just item -> ( { model | currentItem = Ok item , itemHistory = item :: model.itemHistory } , Cmd.none ) Types.SaveFile name filetype content -> ( model, Download.string name filetype content ) Types.SetCurrent general -> ( { model | currentItem = Ok general }, Cmd.none ) Types.UpdateCurrent general -> ( { model | currentItem = Ok general , itemHistory = case model.currentItem of Ok curr -> Utils.replaceBy curr general model.itemHistory _ -> model.itemHistory } , Cmd.none ) Types.SetWithFunction f -> case model.currentItem of Ok m -> let result = f m newHistory = case result of Ok r -> if result == model.currentItem then model.itemHistory else r :: model.itemHistory _ -> model.itemHistory in ( { model | currentItem = result , itemHistory = newHistory } , Cmd.none ) _ -> ( model, Cmd.none ) Types.RemoveItem general -> let newHistory = List.filter (\a -> a /= general) model.itemHistory in ( { model | itemHistory = newHistory , currentItem = case List.head newHistory of Nothing -> Err "Nenhum item carregado" Just a -> Ok a } , Cmd.none ) Types.SetSentence sentence -> ( { model | currentSentence = sentence }, Cmd.none ) Types.DoUnion -> case Utils.getFirstTwoAsAFDs model.itemHistory of Nothing -> ( { model | currentItem = Err "Erro ao fazer união" } , Cmd.none ) Just ( afd1, afd2 ) -> let result = BasicOperations.union afd1 afd2 |> Automata.FiniteNonDeterministic |> Models.Automaton in ( { model | currentItem = Ok result , itemHistory = result :: model.itemHistory } , Cmd.none ) Types.DoIntersection -> case Utils.getFirstTwoAsAFDs model.itemHistory of Nothing -> ( { model | currentItem = Err "Erro ao fazer interseção" } , Cmd.none ) Just ( afd1, afd2 ) -> let result = BasicOperations.intersection afd1 afd2 |> Automata.FiniteDeterministic |> Models.Automaton in ( { model | currentItem = Ok result , itemHistory = result :: model.itemHistory } , Cmd.none ) Types.ConvertERToAFD -> case model.currentItem of Ok (Models.Regex regexes) -> let results = List.map (\( id, regex ) -> CRegex.erToAfd regex |> Automata.FiniteDeterministic |> Models.Automaton ) regexes in case List.head results of Nothing -> ( model, Cmd.none ) Just afd -> ( { model | currentItem = Ok afd , itemHistory = results ++ model.itemHistory } , Cmd.none ) _ -> ( model, Cmd.none ) Types.NoOp -> ( model, Cmd.none ) -- SUBSCRIPTIONS {- We don't need any subscriptions for this application -} subscriptions : Types.Model -> Sub Types.Msg subscriptions model = Sub.none
elm
[ { "context": " Favicon.fromUrl \"https://github.com/audreyr/favicon-cheat-sheet\"\n |> Expec", "end": 499, "score": 0.9996551871, "start": 492, "tag": "USERNAME", "value": "audreyr" }, { "context": " \\() ->\n Favicon.fromUrl \"mailto:betty@example.com\"\n |> Expect.equal Nothing\n ", "end": 1135, "score": 0.9999216199, "start": 1118, "tag": "EMAIL", "value": "betty@example.com" } ]
tests/Tests.elm
nelsonic/elm-favicon
6
module Tests exposing (..) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import Test exposing (..) import Favicon suite : Test suite = describe "Favicon" [ test "basic example" <| \() -> Favicon.fromUrl "https://google.com" |> Expect.equal (Just "https://google.com:443/favicon.ico") , test "URL with path" <| \() -> Favicon.fromUrl "https://github.com/audreyr/favicon-cheat-sheet" |> Expect.equal (Just "https://github.com:443/favicon.ico") , test "URL with hash" <| \() -> Favicon.fromUrl "https://example.com/index.html#hash" |> Expect.equal (Just "https://example.com:443/favicon.ico") , test "URL with query string" <| \() -> Favicon.fromUrl "https://example.com/index.html?query" |> Expect.equal (Just "https://example.com:443/favicon.ico") , test "non-HTTP(S) protocol" <| \() -> Favicon.fromUrl "mailto:betty@example.com" |> Expect.equal Nothing , test "URL with HTTP protocol" <| \() -> Favicon.fromUrl "http://elm-lang.org" |> Expect.equal (Just "http://elm-lang.org/favicon.ico") , test "URL with trailing slash" <| \() -> Favicon.fromUrl "http://elm-lang.org/" |> Expect.equal (Just "http://elm-lang.org/favicon.ico") ]
3975
module Tests exposing (..) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import Test exposing (..) import Favicon suite : Test suite = describe "Favicon" [ test "basic example" <| \() -> Favicon.fromUrl "https://google.com" |> Expect.equal (Just "https://google.com:443/favicon.ico") , test "URL with path" <| \() -> Favicon.fromUrl "https://github.com/audreyr/favicon-cheat-sheet" |> Expect.equal (Just "https://github.com:443/favicon.ico") , test "URL with hash" <| \() -> Favicon.fromUrl "https://example.com/index.html#hash" |> Expect.equal (Just "https://example.com:443/favicon.ico") , test "URL with query string" <| \() -> Favicon.fromUrl "https://example.com/index.html?query" |> Expect.equal (Just "https://example.com:443/favicon.ico") , test "non-HTTP(S) protocol" <| \() -> Favicon.fromUrl "mailto:<EMAIL>" |> Expect.equal Nothing , test "URL with HTTP protocol" <| \() -> Favicon.fromUrl "http://elm-lang.org" |> Expect.equal (Just "http://elm-lang.org/favicon.ico") , test "URL with trailing slash" <| \() -> Favicon.fromUrl "http://elm-lang.org/" |> Expect.equal (Just "http://elm-lang.org/favicon.ico") ]
true
module Tests exposing (..) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import Test exposing (..) import Favicon suite : Test suite = describe "Favicon" [ test "basic example" <| \() -> Favicon.fromUrl "https://google.com" |> Expect.equal (Just "https://google.com:443/favicon.ico") , test "URL with path" <| \() -> Favicon.fromUrl "https://github.com/audreyr/favicon-cheat-sheet" |> Expect.equal (Just "https://github.com:443/favicon.ico") , test "URL with hash" <| \() -> Favicon.fromUrl "https://example.com/index.html#hash" |> Expect.equal (Just "https://example.com:443/favicon.ico") , test "URL with query string" <| \() -> Favicon.fromUrl "https://example.com/index.html?query" |> Expect.equal (Just "https://example.com:443/favicon.ico") , test "non-HTTP(S) protocol" <| \() -> Favicon.fromUrl "mailto:PI:EMAIL:<EMAIL>END_PI" |> Expect.equal Nothing , test "URL with HTTP protocol" <| \() -> Favicon.fromUrl "http://elm-lang.org" |> Expect.equal (Just "http://elm-lang.org/favicon.ico") , test "URL with trailing slash" <| \() -> Favicon.fromUrl "http://elm-lang.org/" |> Expect.equal (Just "http://elm-lang.org/favicon.ico") ]
elm
[ { "context": "nd\", \"29\" )\n , ( \"White\", \"Fischer, Robert J.\" )\n , ( \"Black\", \"Spassky, ", "end": 1135, "score": 0.9674084783, "start": 1118, "tag": "NAME", "value": "Fischer, Robert J" }, { "context": "obert J.\" )\n , ( \"Black\", \"Spassky, Boris V.\" )\n , ( \"Result\", \"1/2-1/2\"", "end": 1194, "score": 0.9300370216, "start": 1178, "tag": "NAME", "value": "Spassky, Boris V" }, { "context": "ia JUG\"]\n[Date \"1992.11.04\"]\n[Round \"29\"]\n[White \"Fischer, Robert J.\"]\n[Black \"Spassky, Boris V.\"]\n[Result ", "end": 4341, "score": 0.9998035431, "start": 4334, "tag": "NAME", "value": "Fischer" }, { "context": "\n[Date \"1992.11.04\"]\n[Round \"29\"]\n[White \"Fischer, Robert J.\"]\n[Black \"Spassky, Boris V.\"]\n[Result \"1/2-1/2\"]", "end": 4351, "score": 0.7575293779, "start": 4343, "tag": "NAME", "value": "Robert J" }, { "context": "[Round \"29\"]\n[White \"Fischer, Robert J.\"]\n[Black \"Spassky, Boris V.\"]\n[Result \"1/2-1/2\"]\n\n\n\"\"\"\n\n\nvariationW", "end": 4370, "score": 0.9994218349, "start": 4363, "tag": "NAME", "value": "Spassky" }, { "context": "29\"]\n[White \"Fischer, Robert J.\"]\n[Black \"Spassky, Boris V.\"]\n[Result \"1/2-1/2\"]\n\n\n\"\"\"\n\n\nvariationWithNewlin", "end": 4379, "score": 0.9988141656, "start": 4372, "tag": "NAME", "value": "Boris V" }, { "context": " , ( \"Round\", \"29\" )\n , ( \"White\", \"Fischer, Robert J.\" )\n , ( \"Black\", \"Spassky, Boris V.\" )\n ", "end": 5838, "score": 0.9970116019, "start": 5821, "tag": "NAME", "value": "Fischer, Robert J" }, { "context": "te\", \"Fischer, Robert J.\" )\n , ( \"Black\", \"Spassky, Boris V.\" )\n , ( \"Result\", \"1/2-1/2\" )\n ]\n ", "end": 5881, "score": 0.9451749921, "start": 5865, "tag": "NAME", "value": "Spassky, Boris V" } ]
tests/PgnTest.elm
romstad/elm-chess
6
module PgnTest exposing (suite) import Test exposing (..) import ElmTestBDDStyle exposing (..) import Internal.Game exposing (Game, GameResult(..), TagPair) import Expect exposing (..) import Internal.Pgn exposing (..) import Parser suite : Test suite = describe "PGN parsing" [ describe "pgn parsing a whole game" [ it "parses Spassky vs Fischer round 29" <| expect (Parser.run pgn examplePgn) to equal (Ok expectedSpasskyFischerGame) , it "parses a small example game with variation" <| expect (Parser.run pgn pgnWithVariation) to equal (Ok expectedParsedPgnWithVariation) ] , describe "headers" [ it "parses multiple headers" <| expect (Parser.run headers headersString) to equal (Ok [ ( "Event", "F/S Return Match" ) , ( "Site", "Belgrade, Serbia JUG" ) , ( "Date", "1992.11.04" ) , ( "Round", "29" ) , ( "White", "Fischer, Robert J." ) , ( "Black", "Spassky, Boris V." ) , ( "Result", "1/2-1/2" ) ] ) ] , describe "moves" [ it "parses an integer, discarding the dot and space thereafter" <| expect (Parser.run moveNumber "1. ") to equal (Ok 1) , it "parses a variation" <| expect (Parser.run variation variationWithNewline) to equal (Ok expectedParsedVariationWithNewline) , it "parses a comment without the {}" <| expect (Parser.run comment "{Jo momma can't read}") to equal (Ok "Jo momma can't read") , it "parses a move" <| expect (Parser.run move "e4") to equal (Ok "e4") , test "does not parse a blank move" <| (\_ -> Expect.err (Parser.run move "")) , describe "termination" [ it "parses a draw" <| expect (Parser.run termination "1/2-1/2") to equal (Ok Draw) , it "parses a win with the white pieces" <| expect (Parser.run termination "1-0") to equal (Ok WhiteWins) , it "parses a win with the black pieces" <| expect (Parser.run termination "0-1") to equal (Ok BlackWins) , it "parses an unknown result" <| expect (Parser.run termination "*") to equal (Ok UnknownResult) ] , describe "moveTextItem" [ it "parses a move text item as a move number" <| expect (Parser.run moveTextItem "1. e4 e5 ") to equal (Ok MoveNumber) , it "parses e4 as a move" <| expect (Parser.run moveTextItem "e4 e5") to equal (Ok <| Move "e4") , it "parses a NAG" <| expect (Parser.run moveTextItem "$0 4. g6") to equal (Ok <| Nag 0) , it "parses a termination" <| expect (Parser.run moveTextItem "1/2-1/2") to equal (Ok <| Termination Draw) ] , it "parses one move number" <| expect (Parser.run moveText "1. ") to equal (Ok [ MoveNumber ]) , it "parses a move number and a move" <| expect (Parser.run moveText "1. e4 ") to equal (Ok [ MoveNumber, Move "e4" ]) , it "parses a list of moves" <| expect (Parser.run moveText "1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 {This opening is called the Ruy Lopez.}") to equal (Ok [ MoveNumber , Move "e4" , Move "e5" , MoveNumber , Move "Nf3" , Move "Nc6" , MoveNumber , Move "Bb5" , Move "a6" , Comment "This opening is called the Ruy Lopez." ] ) ] ] headersString = """ [Event "F/S Return Match"] [Site "Belgrade, Serbia JUG"] [Date "1992.11.04"] [Round "29"] [White "Fischer, Robert J."] [Black "Spassky, Boris V."] [Result "1/2-1/2"] """ variationWithNewline = """(2... Nc6 {is the usual reply here, and it generally leads to the Ruy Lopez opening with} 3. Bb5) """ expectedParsedVariationWithNewline = Variation [ MoveNumber , Move ".." , Move "Nc6" , Comment "is the usual reply here, and it generally\nleads to the Ruy Lopez opening with" , MoveNumber , Move "Bb5" ] pgnWithVariation = """ [Game "Unknown"] 1. e4 e5 2. Nf3 Nf6 (2... Nc6 {is the usual reply here, and it generally leads to the Ruy Lopez opening with} 3. Bb5) 3. Nxe5 d6 4. Nf3 Nxe4 5. d4 d5""" expectedParsedPgnWithVariation = { headers = [ ( "Game", "Unknown" ) ] , moveText = [ MoveNumber , Move "e4" , Move "e5" , MoveNumber , Move "Nf3" , Move "Nf6" , Variation [ MoveNumber, Move "..", Move "Nc6", Comment "is the usual reply here, and it generally\nleads to the Ruy Lopez opening with", MoveNumber, Move "Bb5" ] , MoveNumber , Move "Nxe5" , Move "d6" , MoveNumber , Move "Nf3" , Move "Nxe4" , MoveNumber , Move "d4" , Move "d5" ] } expectedSpasskyFischerGame = { headers = [ ( "Event", "F/S Return Match" ) , ( "Site", "Belgrade, Serbia JUG" ) , ( "Date", "1992.11.04" ) , ( "Round", "29" ) , ( "White", "Fischer, Robert J." ) , ( "Black", "Spassky, Boris V." ) , ( "Result", "1/2-1/2" ) ] , moveText = [ MoveNumber , Move "e4" , Move "e5" , MoveNumber , Move "Nf3" , Move "Nc6" , MoveNumber , Move "Bb5" , Move "a6" , Comment "This opening is called the Ruy Lopez." , MoveNumber , Move "Ba4" , Move "Nf6" , MoveNumber , Move "O-O" , Move "Be7" , MoveNumber , Move "Re1" , Move "b5" , MoveNumber , Move "Bb3" , Move "d6" , MoveNumber , Move "c3" , Move "O-O" , MoveNumber , Move "h3" , Move "Nb8" , MoveNumber , Move "d4" , Move "Nbd7" , MoveNumber , Move "c4" , Move "c6" , MoveNumber , Move "cxb5" , Move "axb5" , MoveNumber , Move "Nc3" , Move "Bb7" , MoveNumber , Move "Bg5" , Move "b4" , MoveNumber , Move "Nb1" , Move "h6" , MoveNumber , Move "Bh4" , Move "c5" , MoveNumber , Move "dxe5" , Move "Nxe4" , MoveNumber , Move "Bxe7" , Move "Qxe7" , MoveNumber , Move "exd6" , Move "Qf6" , MoveNumber , Move "Nbd2" , Move "Nxd6" , MoveNumber , Move "Nc4" , Move "Nxc4" , MoveNumber , Move "Bxc4" , Move "Nb6" , MoveNumber , Move "Ne5" , Move "Rae8" , MoveNumber , Move "Bxf7+" , Move "Rxf7" , MoveNumber , Move "Nxf7" , Move "Rxe1+" , MoveNumber , Move "Qxe1" , Move "Kxf7" , MoveNumber , Move "Qe3" , Move "Qg5" , MoveNumber , Move "Qxg5" , Move "hxg5" , MoveNumber , Move "b3" , Move "Ke6" , MoveNumber , Move "a3" , Move "Kd6" , MoveNumber , Move "axb4" , Move "cxb4" , MoveNumber , Move "Ra5" , Move "Nd5" , MoveNumber , Move "f3" , Move "Bc8" , MoveNumber , Move "Kf2" , Move "Bf5" , MoveNumber , Move "Ra7" , Move "g6" , MoveNumber , Move "Ra6+" , Move "Kc5" , MoveNumber , Move "Ke1" , Move "Nf4" , MoveNumber , Move "g3" , Move "Nxh3" , MoveNumber , Move "Kd2" , Move "Kb5" , MoveNumber , Move "Rd6" , Move "Kc5" , MoveNumber , Move "Ra6" , Move "Nf2" , MoveNumber , Move "g4" , Move "Bd3" , MoveNumber , Move "Re6" , Termination Draw ] }
50428
module PgnTest exposing (suite) import Test exposing (..) import ElmTestBDDStyle exposing (..) import Internal.Game exposing (Game, GameResult(..), TagPair) import Expect exposing (..) import Internal.Pgn exposing (..) import Parser suite : Test suite = describe "PGN parsing" [ describe "pgn parsing a whole game" [ it "parses Spassky vs Fischer round 29" <| expect (Parser.run pgn examplePgn) to equal (Ok expectedSpasskyFischerGame) , it "parses a small example game with variation" <| expect (Parser.run pgn pgnWithVariation) to equal (Ok expectedParsedPgnWithVariation) ] , describe "headers" [ it "parses multiple headers" <| expect (Parser.run headers headersString) to equal (Ok [ ( "Event", "F/S Return Match" ) , ( "Site", "Belgrade, Serbia JUG" ) , ( "Date", "1992.11.04" ) , ( "Round", "29" ) , ( "White", "<NAME>." ) , ( "Black", "<NAME>." ) , ( "Result", "1/2-1/2" ) ] ) ] , describe "moves" [ it "parses an integer, discarding the dot and space thereafter" <| expect (Parser.run moveNumber "1. ") to equal (Ok 1) , it "parses a variation" <| expect (Parser.run variation variationWithNewline) to equal (Ok expectedParsedVariationWithNewline) , it "parses a comment without the {}" <| expect (Parser.run comment "{Jo momma can't read}") to equal (Ok "Jo momma can't read") , it "parses a move" <| expect (Parser.run move "e4") to equal (Ok "e4") , test "does not parse a blank move" <| (\_ -> Expect.err (Parser.run move "")) , describe "termination" [ it "parses a draw" <| expect (Parser.run termination "1/2-1/2") to equal (Ok Draw) , it "parses a win with the white pieces" <| expect (Parser.run termination "1-0") to equal (Ok WhiteWins) , it "parses a win with the black pieces" <| expect (Parser.run termination "0-1") to equal (Ok BlackWins) , it "parses an unknown result" <| expect (Parser.run termination "*") to equal (Ok UnknownResult) ] , describe "moveTextItem" [ it "parses a move text item as a move number" <| expect (Parser.run moveTextItem "1. e4 e5 ") to equal (Ok MoveNumber) , it "parses e4 as a move" <| expect (Parser.run moveTextItem "e4 e5") to equal (Ok <| Move "e4") , it "parses a NAG" <| expect (Parser.run moveTextItem "$0 4. g6") to equal (Ok <| Nag 0) , it "parses a termination" <| expect (Parser.run moveTextItem "1/2-1/2") to equal (Ok <| Termination Draw) ] , it "parses one move number" <| expect (Parser.run moveText "1. ") to equal (Ok [ MoveNumber ]) , it "parses a move number and a move" <| expect (Parser.run moveText "1. e4 ") to equal (Ok [ MoveNumber, Move "e4" ]) , it "parses a list of moves" <| expect (Parser.run moveText "1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 {This opening is called the Ruy Lopez.}") to equal (Ok [ MoveNumber , Move "e4" , Move "e5" , MoveNumber , Move "Nf3" , Move "Nc6" , MoveNumber , Move "Bb5" , Move "a6" , Comment "This opening is called the Ruy Lopez." ] ) ] ] headersString = """ [Event "F/S Return Match"] [Site "Belgrade, Serbia JUG"] [Date "1992.11.04"] [Round "29"] [White "<NAME>, <NAME>."] [Black "<NAME>, <NAME>."] [Result "1/2-1/2"] """ variationWithNewline = """(2... Nc6 {is the usual reply here, and it generally leads to the Ruy Lopez opening with} 3. Bb5) """ expectedParsedVariationWithNewline = Variation [ MoveNumber , Move ".." , Move "Nc6" , Comment "is the usual reply here, and it generally\nleads to the Ruy Lopez opening with" , MoveNumber , Move "Bb5" ] pgnWithVariation = """ [Game "Unknown"] 1. e4 e5 2. Nf3 Nf6 (2... Nc6 {is the usual reply here, and it generally leads to the Ruy Lopez opening with} 3. Bb5) 3. Nxe5 d6 4. Nf3 Nxe4 5. d4 d5""" expectedParsedPgnWithVariation = { headers = [ ( "Game", "Unknown" ) ] , moveText = [ MoveNumber , Move "e4" , Move "e5" , MoveNumber , Move "Nf3" , Move "Nf6" , Variation [ MoveNumber, Move "..", Move "Nc6", Comment "is the usual reply here, and it generally\nleads to the Ruy Lopez opening with", MoveNumber, Move "Bb5" ] , MoveNumber , Move "Nxe5" , Move "d6" , MoveNumber , Move "Nf3" , Move "Nxe4" , MoveNumber , Move "d4" , Move "d5" ] } expectedSpasskyFischerGame = { headers = [ ( "Event", "F/S Return Match" ) , ( "Site", "Belgrade, Serbia JUG" ) , ( "Date", "1992.11.04" ) , ( "Round", "29" ) , ( "White", "<NAME>." ) , ( "Black", "<NAME>." ) , ( "Result", "1/2-1/2" ) ] , moveText = [ MoveNumber , Move "e4" , Move "e5" , MoveNumber , Move "Nf3" , Move "Nc6" , MoveNumber , Move "Bb5" , Move "a6" , Comment "This opening is called the Ruy Lopez." , MoveNumber , Move "Ba4" , Move "Nf6" , MoveNumber , Move "O-O" , Move "Be7" , MoveNumber , Move "Re1" , Move "b5" , MoveNumber , Move "Bb3" , Move "d6" , MoveNumber , Move "c3" , Move "O-O" , MoveNumber , Move "h3" , Move "Nb8" , MoveNumber , Move "d4" , Move "Nbd7" , MoveNumber , Move "c4" , Move "c6" , MoveNumber , Move "cxb5" , Move "axb5" , MoveNumber , Move "Nc3" , Move "Bb7" , MoveNumber , Move "Bg5" , Move "b4" , MoveNumber , Move "Nb1" , Move "h6" , MoveNumber , Move "Bh4" , Move "c5" , MoveNumber , Move "dxe5" , Move "Nxe4" , MoveNumber , Move "Bxe7" , Move "Qxe7" , MoveNumber , Move "exd6" , Move "Qf6" , MoveNumber , Move "Nbd2" , Move "Nxd6" , MoveNumber , Move "Nc4" , Move "Nxc4" , MoveNumber , Move "Bxc4" , Move "Nb6" , MoveNumber , Move "Ne5" , Move "Rae8" , MoveNumber , Move "Bxf7+" , Move "Rxf7" , MoveNumber , Move "Nxf7" , Move "Rxe1+" , MoveNumber , Move "Qxe1" , Move "Kxf7" , MoveNumber , Move "Qe3" , Move "Qg5" , MoveNumber , Move "Qxg5" , Move "hxg5" , MoveNumber , Move "b3" , Move "Ke6" , MoveNumber , Move "a3" , Move "Kd6" , MoveNumber , Move "axb4" , Move "cxb4" , MoveNumber , Move "Ra5" , Move "Nd5" , MoveNumber , Move "f3" , Move "Bc8" , MoveNumber , Move "Kf2" , Move "Bf5" , MoveNumber , Move "Ra7" , Move "g6" , MoveNumber , Move "Ra6+" , Move "Kc5" , MoveNumber , Move "Ke1" , Move "Nf4" , MoveNumber , Move "g3" , Move "Nxh3" , MoveNumber , Move "Kd2" , Move "Kb5" , MoveNumber , Move "Rd6" , Move "Kc5" , MoveNumber , Move "Ra6" , Move "Nf2" , MoveNumber , Move "g4" , Move "Bd3" , MoveNumber , Move "Re6" , Termination Draw ] }
true
module PgnTest exposing (suite) import Test exposing (..) import ElmTestBDDStyle exposing (..) import Internal.Game exposing (Game, GameResult(..), TagPair) import Expect exposing (..) import Internal.Pgn exposing (..) import Parser suite : Test suite = describe "PGN parsing" [ describe "pgn parsing a whole game" [ it "parses Spassky vs Fischer round 29" <| expect (Parser.run pgn examplePgn) to equal (Ok expectedSpasskyFischerGame) , it "parses a small example game with variation" <| expect (Parser.run pgn pgnWithVariation) to equal (Ok expectedParsedPgnWithVariation) ] , describe "headers" [ it "parses multiple headers" <| expect (Parser.run headers headersString) to equal (Ok [ ( "Event", "F/S Return Match" ) , ( "Site", "Belgrade, Serbia JUG" ) , ( "Date", "1992.11.04" ) , ( "Round", "29" ) , ( "White", "PI:NAME:<NAME>END_PI." ) , ( "Black", "PI:NAME:<NAME>END_PI." ) , ( "Result", "1/2-1/2" ) ] ) ] , describe "moves" [ it "parses an integer, discarding the dot and space thereafter" <| expect (Parser.run moveNumber "1. ") to equal (Ok 1) , it "parses a variation" <| expect (Parser.run variation variationWithNewline) to equal (Ok expectedParsedVariationWithNewline) , it "parses a comment without the {}" <| expect (Parser.run comment "{Jo momma can't read}") to equal (Ok "Jo momma can't read") , it "parses a move" <| expect (Parser.run move "e4") to equal (Ok "e4") , test "does not parse a blank move" <| (\_ -> Expect.err (Parser.run move "")) , describe "termination" [ it "parses a draw" <| expect (Parser.run termination "1/2-1/2") to equal (Ok Draw) , it "parses a win with the white pieces" <| expect (Parser.run termination "1-0") to equal (Ok WhiteWins) , it "parses a win with the black pieces" <| expect (Parser.run termination "0-1") to equal (Ok BlackWins) , it "parses an unknown result" <| expect (Parser.run termination "*") to equal (Ok UnknownResult) ] , describe "moveTextItem" [ it "parses a move text item as a move number" <| expect (Parser.run moveTextItem "1. e4 e5 ") to equal (Ok MoveNumber) , it "parses e4 as a move" <| expect (Parser.run moveTextItem "e4 e5") to equal (Ok <| Move "e4") , it "parses a NAG" <| expect (Parser.run moveTextItem "$0 4. g6") to equal (Ok <| Nag 0) , it "parses a termination" <| expect (Parser.run moveTextItem "1/2-1/2") to equal (Ok <| Termination Draw) ] , it "parses one move number" <| expect (Parser.run moveText "1. ") to equal (Ok [ MoveNumber ]) , it "parses a move number and a move" <| expect (Parser.run moveText "1. e4 ") to equal (Ok [ MoveNumber, Move "e4" ]) , it "parses a list of moves" <| expect (Parser.run moveText "1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 {This opening is called the Ruy Lopez.}") to equal (Ok [ MoveNumber , Move "e4" , Move "e5" , MoveNumber , Move "Nf3" , Move "Nc6" , MoveNumber , Move "Bb5" , Move "a6" , Comment "This opening is called the Ruy Lopez." ] ) ] ] headersString = """ [Event "F/S Return Match"] [Site "Belgrade, Serbia JUG"] [Date "1992.11.04"] [Round "29"] [White "PI:NAME:<NAME>END_PI, PI:NAME:<NAME>END_PI."] [Black "PI:NAME:<NAME>END_PI, PI:NAME:<NAME>END_PI."] [Result "1/2-1/2"] """ variationWithNewline = """(2... Nc6 {is the usual reply here, and it generally leads to the Ruy Lopez opening with} 3. Bb5) """ expectedParsedVariationWithNewline = Variation [ MoveNumber , Move ".." , Move "Nc6" , Comment "is the usual reply here, and it generally\nleads to the Ruy Lopez opening with" , MoveNumber , Move "Bb5" ] pgnWithVariation = """ [Game "Unknown"] 1. e4 e5 2. Nf3 Nf6 (2... Nc6 {is the usual reply here, and it generally leads to the Ruy Lopez opening with} 3. Bb5) 3. Nxe5 d6 4. Nf3 Nxe4 5. d4 d5""" expectedParsedPgnWithVariation = { headers = [ ( "Game", "Unknown" ) ] , moveText = [ MoveNumber , Move "e4" , Move "e5" , MoveNumber , Move "Nf3" , Move "Nf6" , Variation [ MoveNumber, Move "..", Move "Nc6", Comment "is the usual reply here, and it generally\nleads to the Ruy Lopez opening with", MoveNumber, Move "Bb5" ] , MoveNumber , Move "Nxe5" , Move "d6" , MoveNumber , Move "Nf3" , Move "Nxe4" , MoveNumber , Move "d4" , Move "d5" ] } expectedSpasskyFischerGame = { headers = [ ( "Event", "F/S Return Match" ) , ( "Site", "Belgrade, Serbia JUG" ) , ( "Date", "1992.11.04" ) , ( "Round", "29" ) , ( "White", "PI:NAME:<NAME>END_PI." ) , ( "Black", "PI:NAME:<NAME>END_PI." ) , ( "Result", "1/2-1/2" ) ] , moveText = [ MoveNumber , Move "e4" , Move "e5" , MoveNumber , Move "Nf3" , Move "Nc6" , MoveNumber , Move "Bb5" , Move "a6" , Comment "This opening is called the Ruy Lopez." , MoveNumber , Move "Ba4" , Move "Nf6" , MoveNumber , Move "O-O" , Move "Be7" , MoveNumber , Move "Re1" , Move "b5" , MoveNumber , Move "Bb3" , Move "d6" , MoveNumber , Move "c3" , Move "O-O" , MoveNumber , Move "h3" , Move "Nb8" , MoveNumber , Move "d4" , Move "Nbd7" , MoveNumber , Move "c4" , Move "c6" , MoveNumber , Move "cxb5" , Move "axb5" , MoveNumber , Move "Nc3" , Move "Bb7" , MoveNumber , Move "Bg5" , Move "b4" , MoveNumber , Move "Nb1" , Move "h6" , MoveNumber , Move "Bh4" , Move "c5" , MoveNumber , Move "dxe5" , Move "Nxe4" , MoveNumber , Move "Bxe7" , Move "Qxe7" , MoveNumber , Move "exd6" , Move "Qf6" , MoveNumber , Move "Nbd2" , Move "Nxd6" , MoveNumber , Move "Nc4" , Move "Nxc4" , MoveNumber , Move "Bxc4" , Move "Nb6" , MoveNumber , Move "Ne5" , Move "Rae8" , MoveNumber , Move "Bxf7+" , Move "Rxf7" , MoveNumber , Move "Nxf7" , Move "Rxe1+" , MoveNumber , Move "Qxe1" , Move "Kxf7" , MoveNumber , Move "Qe3" , Move "Qg5" , MoveNumber , Move "Qxg5" , Move "hxg5" , MoveNumber , Move "b3" , Move "Ke6" , MoveNumber , Move "a3" , Move "Kd6" , MoveNumber , Move "axb4" , Move "cxb4" , MoveNumber , Move "Ra5" , Move "Nd5" , MoveNumber , Move "f3" , Move "Bc8" , MoveNumber , Move "Kf2" , Move "Bf5" , MoveNumber , Move "Ra7" , Move "g6" , MoveNumber , Move "Ra6+" , Move "Kc5" , MoveNumber , Move "Ke1" , Move "Nf4" , MoveNumber , Move "g3" , Move "Nxh3" , MoveNumber , Move "Kd2" , Move "Kb5" , MoveNumber , Move "Rd6" , Move "Kc5" , MoveNumber , Move "Ra6" , Move "Nf2" , MoveNumber , Move "g4" , Move "Bd3" , MoveNumber , Move "Re6" , Termination Draw ] }
elm
[ { "context": "rated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples).\n-- Please don't modify this", "end": 146, "score": 0.9995462894, "start": 138, "tag": "USERNAME", "value": "stoeffel" }, { "context": "ual\n (\n register \"Paul\"\n |> incrementScore 10\n ", "end": 546, "score": 0.6763346791, "start": 544, "tag": "NAME", "value": "ul" } ]
tests/VerifyExamples/Shared/Scores/DecrementScore0.elm
phollyer/elm-space-invaders
0
module VerifyExamples.Shared.Scores.DecrementScore0 exposing (..) -- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples). -- Please don't modify this file by hand! import Test import Expect import Shared.Scores exposing (..) spec0 : Test.Test spec0 = Test.test "#decrementScore: \n\n register \"Paul\"\n |> incrementScore 10\n |> decrementScore 3\n |> points\n --> 7" <| \() -> Expect.equal ( register "Paul" |> incrementScore 10 |> decrementScore 3 |> points ) ( 7 )
8680
module VerifyExamples.Shared.Scores.DecrementScore0 exposing (..) -- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples). -- Please don't modify this file by hand! import Test import Expect import Shared.Scores exposing (..) spec0 : Test.Test spec0 = Test.test "#decrementScore: \n\n register \"Paul\"\n |> incrementScore 10\n |> decrementScore 3\n |> points\n --> 7" <| \() -> Expect.equal ( register "Pa<NAME>" |> incrementScore 10 |> decrementScore 3 |> points ) ( 7 )
true
module VerifyExamples.Shared.Scores.DecrementScore0 exposing (..) -- This file got generated by [elm-verify-examples](https://github.com/stoeffel/elm-verify-examples). -- Please don't modify this file by hand! import Test import Expect import Shared.Scores exposing (..) spec0 : Test.Test spec0 = Test.test "#decrementScore: \n\n register \"Paul\"\n |> incrementScore 10\n |> decrementScore 3\n |> points\n --> 7" <| \() -> Expect.equal ( register "PaPI:NAME:<NAME>END_PI" |> incrementScore 10 |> decrementScore 3 |> points ) ( 7 )
elm
[ { "context": " \"pass\"\n \"e23bd5b727046a9e3b4b7db57bd8d6ee684:1\"\n )\n , test \"", "end": 603, "score": 0.9961078763, "start": 568, "tag": "PASSWORD", "value": "e23bd5b727046a9e3b4b7db57bd8d6ee684" }, { "context": "Unknown\n (isPasswordKnown \"asdfdf\" \"\"\"00169791E84389EFBAA05C2EAE449D45D00:1\n01BC5A0", "end": 847, "score": 0.9814023376, "start": 841, "tag": "PASSWORD", "value": "asdfdf" }, { "context": "mes 514780)\n (isPasswordKnown \"asdfghjkl\" answer_for_asdfghjkl)\n ]\n\n\nanswer_for_asd", "end": 1150, "score": 0.977371037, "start": 1141, "tag": "PASSWORD", "value": "asdfghjkl" } ]
tests/Tests.elm
brasilikum/is-password-known
0
module Tests exposing (suite) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import IsPasswordKnown exposing (IsPasswordKnown(..), isPasswordKnown) import Test exposing (..) suite : Test suite = describe "The IsPasswordKnown module" [ describe "parseResponse" [ test "finds one correct entry for one response" <| \_ -> Expect.equal (FoundInBreachedDataTimes 1) (isPasswordKnown "pass" "e23bd5b727046a9e3b4b7db57bd8d6ee684:1" ) , test "does not find on randomly non matching strings" <| \_ -> Expect.equal PasswordUnknown (isPasswordKnown "asdfdf" """00169791E84389EFBAA05C2EAE449D45D00:1 01BC5A02D8F0DDA6DB019ACDD3F36051F7F:1""") ] , test "finds match in cached real response" <| \_ -> Expect.equal (FoundInBreachedDataTimes 514780) (isPasswordKnown "asdfghjkl" answer_for_asdfghjkl) ] answer_for_asdfghjkl = """00721DAB885B3C745FAF8E13A2C0A23D22B:2 007EFFB71339AFB4FD1D2D5F1F42B07E833:5 00CDC5D3BA289D3726A7637FE66F2DB0EEE:2 01783EEEAF576CDBBB176C06DACCBCCE334:1 01C07AD380C2369A7F1AD700C266EF997BB:4 01FE309477AA8EBD2FCE83D49D233749600:2 01FEA56B47DE74B260FEC85428E70910DDB:10 0232868600EEB190903A13EA07B79A98C59:6 03479ACE8B47C73FF8890F597CD9F1D4558:1 0393336444E8781E9C6905680B28A85166C:1 0394BCD985574FDA0C1EBDD20FBF1C5847F:1 04567E14C1A8B13FC5B470D0B310E798302:3 04E99C31F147533385CCF3B2A8A8A14BCB5:1 05CA309B6F64021C7C5F9748CFF5BD2ED31:4 05D421DAD791F043EF707236552A715D7E7:1 05EBF5ABB5895336BF00C1AE599D81371AF:11 06245BD27A61D79557875FD695B4324B898:9 069293AEC0FE7FAD6E41AAE074FC3F7B5D4:2 07C3881213DC5C8E156C3448E23DA4F17DE:1 07DDEDECD2267C01344AB7241A38978EDD3:1 0901174943A08895B24493BF6E5E56617F4:4 09EB15A56E74A1E80CB9D21FE927C9F1E85:2 09FA313908A020D96CCA0F9AC23652DCA9B:2 0A03777C21B91779E56AFC90FB0451AD9D6:2 0A24A581A6D20824BF6056873139763CC97:2 0A41DE34570251F0A60BA2BA8D2D7721450:2 0AB4774B461DC5BD5F3DE0FE26FAA0E873A:4 0AC153318E44010790460BB00966DB1C084:1 0C589B4D612F94B9C5B6AB0A3BB89296BEC:1 0C629CE13AD7B9475C7F449D3782A1DBC4C:1 0DAD6D88F2A916D32449C0B2B0310886D24:1 0E38BD95BE4F4BEF29E24346BD80AA83444:11 0EE0C3728353F3F86CBD0976B7658EA04F6:2 0F22720FD09C07EF87450FB80EC037FA4B0:4 0FF9AE9009E184D136CE2D9B855A6F8820E:1 10864862DCD10FD6AA209B455C174D2ADA6:3 10FAD02E1CB7D7ECC1D5A1DFE9263886191:4 11008E9A3C6359542BC16DA9BB2A589EA8E:2 126860AC140FC59E9C1F1AC1AE5511CB26D:4 126BE3A23967EF77D9D7FE9512F1899F1BA:2 12D860AA1388251CC7772882E1B6284649C:2 14F2F586C2BFBB68FC5F7FAC945F54487BE:6 15437B38123F10F592D7EAD1878882D1FD8:1 163F56A3089A582AABBB1AD73AD71F121FB:2 164D36AE8C54636F1D5A979E3C8FB09DC69:1 16632C8F83178A7FD1DD9D830536043F95F:1 17519400D1D5F0AD33E654081CD0C6144B2:1 18A450C29C0AD55408E223CEB32758C5AC6:2 18ED7902EC2B462823974DC8CCFC251F015:8 1998BD853445F8E1C5EA171FEADDA7DEDB1:1 19A7FEC6493CDB7B884265C2F8EA9C72216:15 19FBE83CF8B2E0BF214C4BFD2689C52AF38:7 1A093C719525C386B19F9E97DB4530B48A1:1 1AA91ECABA1C20AE5A037D2D463DCEF7D91:20 1AD409E0F12AAC85273000AAC7CE3E54AD8:2 1AEF6E9BFD1E3073C26CB456CF92901CE46:2 1B4430D4CD06259BFA8B4733104490D3264:2 1B5BBF1A4AC86FBD61D8888CDBD9769D080:2 1BB241A6117C61C24826663446E5849C0F1:4 1C75B8A438B8D17ADE9A8E78160B9F4D09E:1 1D42E4758B48150CD50988F8F8C27D615B4:1 1DE11C305A0F504CEBB6CD253992C6FDE7D:1 1EC6B682185B78E51CEEE150773341372A2:2 1F54CAC0C2D568468959BA0C2CE91292610:1 1F808B64A66AE837D2532F88D41B9F451B3:1 1FE78BF7A49D8AEAE78FBCC78193B2F635A:2 216895287B44C4C45C05DCD76ABA41C2892:3 2183353C95A554F6019AEB92F5278CD7244:2 22828741EEC825D579C039AD1881879AA2C:2 22C598A8533BA4F3000929A919DBB16481E:2 22D3FD712963EA1BEAB3F46EDF393A3C0CE:3 22DB2E13CEA5805BC73C66533B99C9A38F8:6 231D70B838BE2E479EF847725D89540B818:2 23336F586DFA8C07CE7C853A0E522592CD4:1 24B29E6F3441163D292218B3DD040B414B9:4 24DFD27191A597EA25B8C10A420558D26FB:2 2621E72F01EAED166A188AA397B4A97E8D4:1 27161124353A80163C7B10AF97BEFB60176:2 27B8BE3468A9C4577CC60D720E6E585A51C:2 29765C786F73A2C0C53A736375AF4463998:3 29A414B0C005C881FBED6D584C4B0117C48:3 2A6350DB8E1DC47831AEECAD6DCEA53A9F1:2 2A7357EC8CE4CACD53C2716CF99C9E44D51:2 2B06A1CC1317EB17D110E89AF8DD246DA0E:4 2C66632A8A8B71D4229D1B06258E8926C97:3 2CBC4F49CDCE84C5134E0DFD1662E720840:5 2CCCF84A52E8E837C84973A629FD032F197:3 2CFCA5999FC7214BE1BDECE241B48C89C06:5 2DB8D71F2D0C850AD73099BE98E5281907D:2 2ED3B9F24BBEDFC1F534797DCA07E690E5B:3 2F2720BB4F73465D1068FB901DB96089E11:2 2F5A767880EFBFD9C472532E8634F9639A6:1 2FD4C80277EA030BA3E969B29C5CFDB8801:4 2FF853397752F070BEAA1BBD1561C80A2AC:1 3076C4D371C055271B64DFDBD5EED444A6A:1 3223AB3906BD1D33EE31788FFDD592218B8:1 32A0B41397288EAABB5232159401EBC6394:22 3338A0E0513CC4109081E456AA375AD5330:2 3371529480C679815232254E541036979CA:1 33978346B6561BF28959244BE1CE4CDAAEA:2 3450EB7DA4296AF3458C7ED3DAB62243D95:2 355E4670416E53887B1876B8C98F3958F73:2 3590148DE4FFB4A31384C2F88DB1E043DC2:9 37389ED6092FA06690AEEDE4ED2630541E4:2 37468FD8D42038EEA23E98BE6D962F1ABCF:9 38608D6012F25E8963BE2B8BA0A6BE20D0E:12 387B78E43B006DD40121EB39844D1E72445:1 3884A27824CFEA69ADA4D255682871585F7:17 38B6D136029E5729ACC76D5BF3F04BFF785:1 396028FB0D5CA885D5D832D6BAED526FB2C:2 397249BB1CD9BCE72107BEAE4ACA72C3ACB:2 39ED15BF5EB200FC85DE650CE94A03E3C89:4 3B57ABD02E77BAD30D6554DE2BF85E94041:1 3B9481F2F95E5304C6FE76BBC6C986100C4:2 3C4A8A59AFA8D9715B5E583E00EDBCF537E:5 3C70E1F8B1FD34E2A359FA9B3CBE3B4CDCB:13 3C770D319CB6CDBCBA52107C7E6B9C41B8F:6 3CDA3DBD91503DF5D0614AB2262D6F7BD7C:5 3D477BD978C16590151A200DB7DDC1B08C0:1 3DCB3915D02D4773791EF7245531529C6DC:3 3E28783B84A393041D3B5A40E2D0AFAC9ED:1 3ECE7E8794ED029F801F3F16212259A9A0A:1 3EF396196869133E0345B5363622C329622:2 3EFBF7342ECCF7C9A0472A3DC888342E849:2 409A55DB312EFAED0C60D79C820123857ED:4 40C479428CA2E2A17C62E3EC9A8D1263D3B:7 40CE9A7B9B8E58542678800A6C623E9A13A:1 40E66F71BEA945D1124A204E94E56DBDD4C:4 4161134763027BF30812D76BD89CEEE4313:1 42C4F4E94CDEB8C2E59DCB2B71C52AAFECE:1 42DD8371560C9A999D5A83B0F9B62A1C232:2 43355AF1376084DDAACE8E48DDD1B301358:2 43379662DD408EB8BEFD7FBDC7BA139C7ED:3 446401FBEDC423BFECA860CE2515FEBBC64:1 44AFD5CF7AD0D3A18955ED037AB4B104E34:2 45C626376FA22BF7C3961A93BCBC7715BBB:2 463F55F95E6C74F72BC0DC2A0549309AD9B:1 465EE874FD8477775A92EBFB48DDCFE8F69:1 468E11280C3DBE4205933675F32B5C5315E:2 46F017EAEF24880BD83882BE05DE5EBA7E4:4 472C8500206084F880FB704A0CC765FCCA8:1 480855A5D696E7DE951245F6CDC1FFA99A9:1 48D6E8F7D39CDC429F7DA1F210D275D43D4:3 491104F690968038C0B8B5B907A7666E17B:2 4944FD7BED9E76CCB8D50A24801F417ABD1:4 49D63F70FA89FCBD865EC380E730A54536F:1 4A323CA77F38E34E252F803F2312685BBD0:1 4AB15955A6DFD23CAEC36007DB965A25D3E:2 4C1000B69FF96A38A93233F52AFD74A7FF5:2 4EF189AE5F0FD8689E0509B3B83FCCDA065:2 4F486BBEB886416124D743C74E38C355312:6 4F51C90CECFA4C93845D0EF912FFD0D53AC:1 5055B063A6E2B656CE5CC828C94C0A2C651:7 50F3EA256B13AF3586EC3E0880B46B330DB:1 51C5D06F1DA3868A4B45C2AC0C13F01A88C:2 51DAB3BD2CA5BC5A12C993E7DD7524D1FDA:1 5217430F9EB15C5B259CC1295CDEC750C99:6 538A1DF282AA1481EEB8F01C49D1E3332C1:1 539644701B53DA1028396158EF490262D2E:1 53A961DF595D1F80524CE7900A1E107A941:2 541DF822567128E98BBA210E1731DF674B4:2 5636DD61E40C8F333BED313CC55985C3260:3 566A7551FF3B83FF511F03BD7645804DBED:3 56A7653412B2196E8F02FD5E8480AB1C3C3:3 56F33A2F2128D42390781BBC1C6C5EA49FD:3 56FD3E50D21610EC46A12B340029D1540B5:2 574B768EEFFC32593DB817E3F9458419749:2 57986A405A70D478AB818EFBE13C8EAF01C:2 5859DB0C43EBAFFC1E7DEA8D8AE68ABBD61:4 58E0B742240BA78B772D03F794769438E62:3 5902ABB6A4C0A3C6C3AAD69318F57E67E65:1 593C0D6F2724CA9FD459AF544675EB2E8F5:126 595045AA5C037CE7A8907D42CD503056665:1 59C69A1E90A3F364BB6AB1CFE1F58B75759:4 5A04A0727E35212BF3E288F18270DD44BD5:4 5B2DF0E6DA6BC2F7CE46CB4606FBF668AB1:1 5B64978270EDA41C9A61508311FBDE8BFC1:25 5CB66D04DA973AD381AD05AD3038FE9F652:2 5D1374FEB99CA2A30F627ACDA10CA35B696:8 5DC2E3F67289C38E38B8C6146C6C7F7DA87:3 5DD805E17DF4EAB9C79EAFA19505C846897:1 5E538E772E0E22DD0D1C2D323A8BC99FA82:1 5E59EBE6A72FA70DFE43B33D94541CB0DC4:3 5E64136CB77DF3B966D7ADA29BED55D7E3B:1 5EB24DC67AFCF404356C5ABB3F21694996A:4 60910CCED1542070FD763D0D80770F0BC39:3 61386005F28E1075FDE5AD6DDCC4D7D1698:1 613EC92793236C177F974873C3EB036E2E7:2 61475F6084609C6EA4906CC7A9DA850143B:3 61E3FDB7C1CF0B50AC71B0CAC440C4C2477:2 62C275DCF82C3BEB093E660F1120F0AFFCD:3 6324BCA826D133A71F76C5F6F6E5B3996E6:2 64633DF62221D46785D4C26260410CECFAC:4 647AA3891B535634E4B58145DA0292519E2:2 64DE389A3D54055DE2CA03D034A65B49E4D:5 64FA823B43C0F2A10A8AE16437376087241:2 6607D9E12D84C34DC8A1FE0C09F9C928DA5:5 6608605DEC3D88121D9119D3DCA546D0345:8 66BF6FE5F2BD89C8583488439F2AE034E1A:1 66FC2E0A6800E87F2110855DF4E86306D2A:1 689FBEC7FB47CB8A27E2EAA2F4B0C20FD26:1 68AB3477559D2B2966B59CA0F415D34E269:2 6AE8FC557EA95FBAD0899F5D89AD678D53F:2 6B50E481DCAF2AB70165F1F08AEF0BAE214:2 6CB8817293485D7D697729392E69885E810:2 6CC18441F64A6A3912B75F13269EC30BCB3:3 6DBA67B08191E1DAA5060658A34F3927D4A:1 6DC6A584342A36967BB7E8860B9FAE6A063:1 6DCD4A4C28AE5B324026C7F3FFB34E92514:2 6E0D373F6981BD47930F4A56C4C7E08155A:1 6E43B226EBBE36A9A7175B81E94A6A17120:3 6E5E01883CE777D41286AE822A96E1D31F5:2 6FA57594BC01BD05E66E8A3CCD246D1BD33:1 7118901357A7F1C26B5A7D5BBBCEE746A31:1 71AA924424D3AC16DD1E8F38B9BABF8CC66:2 71F2EBDD6D5F226ED8A2B1B2C96A8AFBDFA:2 72812979401206FCAE9365548D965254DCE:1 73AF3A4B50CDC1D33AC0486058B91E81C6D:1 741D40D547B37A948D99A2174B04366EB14:3 74439891C8FED22022532967E48971AA2C3:2 74B6B8D03B94856084B0461DCF457DD8579:10 74CA186B0BBF7B6411C83C49179C9706E9F:2 76E30736CB99547A786CD23872E47726875:2 7712EA10BD04D77052785EBD04B306E262F:1 77170C450D3F8453751CAC0AD43ED8D4CE2:7 780D1679417E51653947DD0D0B0D20462F8:2 78AB0D277B5B67714F481E086E82102710B:2 78BC3B1E5570B2FD901B72ACCC5EA4E07D1:1 79777FEE6AD7AB97E7F2815C38D2105B23E:3 7A556B54F85B14A4EA4B855D567722ECFB6:3 7A936EE328C6906F08245F74657D42E690E:5 7A9FD995B65CB90D652AFA629EA4EB9B75E:2 7BEF7CD90527CDD45AE57FD54D0982121C7:3 7BF11C5E1AA98A9773C1EC6CD49C8C92EB8:2 7C38F34FDCBF65D8818DB0F11CA2E0D1DB6:1 7C513186CA452C9D04E50AE4CF2A99F49E6:4 7C6EAC3A4B5691F231EB89B43D92DF3E212:2 7DCB092016F7988A52026764BAD7B16E9B6:3 7E649081A3D86EF4D54DCE71635D76923B6:1 7F52B3BA9470E5E2FD3A80C689B4A7202BB:1 7F85C62E818FC95FEABF63A6567EFD82C14:1 7FA01144F7D9DEF6EEDFD4C95449BE604AE:3 80553EE51F892A6253D750C9664297BD2D2:1 81E21C305EC0861C99F99BFF50035DA5714:1 824D7FFBF7FBD80C57526190054EE2FAF94:4 831174A845D467869948EFB0D55FB0EAB16:4 83CC74FB6BD9DCC15A0C8B7AFDEA28EAF5C:1 846B3DE3A043DBA21279917F1075F1C87DA:12 8506A8BFDA9146551AC965FAF0EE33CCB1E:4 85588793E2BC7CDDD91FD2EE6687767C625:1 86204767D950BC178752B789250FA1951A7:2 866AE5C9B47EE9799FA9DE8287EE5F92160:1 86813A557CE096216F2C789C8B5B38ACC1C:4 873543B8084458A5A8D64D7A037BE237EB6:5 87F29D9004A062DF6C3E5677A7B9E51700F:8 88650F85CE60D59336B7B550C8DED7C1629:2 88D9AF4E55A9003404D438488CCBA254255:2 8963045DE4AF6B497C6A44D235927AA06D4:1 8A03958ED504BCC270351A222275F694D1B:1 8B1439F16867B8970AAA8F5887D71961C9B:1 8BAA0A48822C8C4D2E2CC8DB100EBD4CC10:2 8CB5BBE983314E9D51A87F15DFBDDD208E1:1 8CFAC2AD594EA6973A394067FD90DFE4F4C:1 8EE74C747990A5383DFE98CB09903E2A441:12 8F61FC0B22A1ED668B0C38AEACF6BBBD532:2 9067848425AC6E3A99230338B54E1B73ACD:28 90B830D465A3AD20610CBAC0DE1BBAB27AF:2 90BA96BF63F438682B411065984E23B42B2:1 90F504682DC0D621C73CB8D9DCA64DE2AD3:1 92FE443CD39E9FFC799DD00650DAD4506D9:10 93A61FB8F69A5615D50B28E6A19503CC4DB:4 955CDC3DAE4F9BC8D0DF682163E178A134A:3 9565C104761CB68D99A8B4908B1E1D8FC17:2 95A36EBB6B37416AB7F92ACD80725FA971B:2 95E12C96B61C1006B1260447CCFCE3E9AAE:6 960F3EAE324BDC39326F64F8B3C5B1C43B9:2 962009258BB125EF02F9420CBCDD84F0D7F:3 9715281C7AA292ED92EC05D659321307D63:3 97691DC92E99FD6A8AA581AF7999EA2CC40:2 979178F32F3E5B7F1B714C8EF77DA328C78:5 98A16185733ED923079E839E3C4074FD139:1 99CC23968ED935A2C0454593518559F5AC4:17 9A9D0D0EF781883CAFFAEB3DF2BE8FB0179:12 9AA8F765F6A0A2685F305A68A402A4F31CC:7 9AD24138A817EE75C9E430956AEA6FA73EF:2 9B2F3D4B7ED2FE150B19E19C1E819390240:2 9B4B775C9EC42C90038779AF44A377C84B6:4 9BADDB23F48B9CC14BB2181FC62E811F78D:3 9BBBB1EEACED3B52E54F44576AAF0D77D96:514780 9CA29FC04D017ED4C109EF2ADC5EF14024E:3 9DB80D391CBD1CFD17D5A712040EB4B765B:1 9DC907D1119E717AC968327DE3EE1990F07:2 9E4DCB22E470C51FE480892CF96E3429948:3 9E8B5853B50C2B6850CA76275297BC0CD87:1 9E9C6FD8AB732FC38F731AF781A37F05379:2 9EA3432A56A75EBB32F73979C78EE36623D:2 9F70C00BEA91DD60B38530D54F600E2B05E:28 9FF668FE9660EA15AF550390CC781E85C07:3 A1C813690B89FEC9CA7B1F235287DD427A4:1 A2349972A986FDDC945EEF0C600789349B1:1 A234C98FC53D10CE55BB39F1220D6F6E614:1 A2BF81A797268C1E9EEA46DAF3EC19BC518:5 A367F10C022C0D175CB268EC810A9E12A94:1 A38C0704396F36963376E241CF4EB81DC0E:2 A51C994BA20F97C3A1D8DBAD23E12561BB0:2 A5543BA889F421A2E4124A8F5664BCF692B:4 A556C58AD4AA4B8BBE7DD6CF5DE4B78194F:1 A564C4D44CBF6753E7928F4304905021C78:3 A651DFF1FF53D86CD6D34F6720BFE139749:2 A67D122777174A27DC88D2CA1A250CA6607:1 A7145F67B39B490C5DF37161F24DC4ABFB6:2 A84DF047119820B3820F08DE072D72D4CB7:1 A8BB8B130CBC8605E5937D198870F200899:1 A8C800803CC37B1BB71F0EE58D6405D1392:1 A8EBCCF466587BBEB4071DC3FE04EEF3AD1:2 A9081B97CC141FB26749004FF8988794724:10 A9C94C7821EF4F2BD36F9788B2364A94BAB:4 AC587B7B1CA81D53B69861F87B36B9EC394:3 AC90FBAB1F177D913F7B3E82EC4BAED9E3E:1 ACA267D4B1A7AD74789B12197898D6B8E9A:1 ACE918664FCCE918D4DE56D18489CCDFB46:5 AD917404A05A7E183B55DB1D22ABE39B1B1:3 AE452C1905A0DCA7F2718552E70CADDDEA8:5 AE6F8885070746C5C36C46A413007A59335:3 AF6B7DEC97D3E0B09236BEA120D6580C30D:1 AF701031143661DA7F853554E82E71AF7E1:1 AF70E78F0FCBF7EF2C9D0F2FA4DFA3FCF1F:1 AF755BEA42C6CF817A7DCC608C8F0642E47:3 B1CBB503ADA165C2266661953368C31F20B:4 B1DC12029E01A8054DD6A82B1BC4919E5FA:2 B1DC948D79F8306A298BA78A8B38410BEF4:1 B2A164DA818387688192D9A6FE5141F2881:1 B2B80E721E97330384C346A701FE35C2955:4 B47348CADC38957691A36D185039B799ECE:2 B5C7BB5BB17BB32B383DCA3259E259176C2:1 B61BD6CFC7D9F44361DFB1D3399C2F9EE4E:8 B74D785244C6C47D00F9B9589BA0E433994:1 B7A224C1F6CBBFAC4D5BBF2543893EDCF23:5 B83B74383253A1269F52C5CCA266CCB3C9A:1 B8B3478F96E0E598A39E8C61A6985970524:1 B8C6D3EF2DF858F8980455A01172E6DA239:2 B8DD367330758BCFD57716F0F8F64390843:1 B8FC47BE9A4D0B2540534C7C38583F754DF:1 B93D561BFBDF00C23545D1F03B562CA1DB5:2 B9712D9D3AC1D555D0BEBF147BD17511B5B:3 BA3290DA02BEF4A008843E97309FB815146:3 BAA8401AA6F7245312CCBB2F1752B22D86D:2 BAE0A09F1F00AE97A0FE13B55B766062637:2 BAF573F6C3D5B0C5AB0558CBC5B02AEFDAE:3 BC00635F1CB1A87D9205E6C0E8091785105:2 BD6F4F1B69B2196B5C6CF033718F574EC07:2 BDB1DDCC228BE9F7FB35EEF6AF5113AF73E:4 BE146DED014E4D1F66D577D2D14D8135DF3:1 BE70DCBAE2F79C46225CB2B9BDD65F1AB3A:4 BE90622F1FFCC28BA2C7A0AC039643B4C54:27 C02C14DE7103830953582B7393D71A32EC2:4 C065390F044A0733C62EFFD26C7BC9E5C0A:4 C069578DF1863522C57972C993C74EDA915:2 C17EAB25AA71E786892A6EA72B0966AAD6A:1 C1ADA5AD77F58D11542594DE65BCE3D1EDF:1 C1BFC70CA9C7A42528493171C882FA7C417:3 C2E0DF0AE878FF0FAC08D2C289833B51E58:2 C2EE82E916065EE6D864F275F311ACE61C9:10 C342BDFB47690A964704AAA2271A725CCE7:4 C383EBB71D19EC43FE5AFE35258E754DDC7:3 C3C95C722170002A1AD91D143E180EAB1E7:2 C40BA356F488EF52E2396A2E46569DD768F:2 C427749A32159BD6D7CD8B2ADF92FB1F832:24 C42B61033860FE10F17A4FA7FD99C9AC833:9 C447BAE41CB8EE62527EB64A6F5FE9CF478:1 C46C421AA6A899409ABA61633BDA8D66972:3 C64BB58C11AC8FCF9EEE1D520A6BF627B78:2 C67266A679B412A4BB4A3C6008A7B9DAA87:1 C71ED4BADEBE21EDE7AC71A8FED4F52008E:1 C803ADE6E741B4D5851D712047DF03FBD36:3 CA2F8699ADC9CAC35D6751970EFC11A4273:1 CA5C3E40B7F064088261816AD2888EB9B5E:1 CA81B22EC34A8DD2D112BE8A8BD9F56D100:2 CB16866ECD76A98EEA229DF3D79EA89B3D6:4 CBCBF62F09255D7BBA936414ECED1A67BA0:4 CC98AB04707CD69D15C388DA10AA56679F1:1 CCA035AA895B0EA8188F1CBC7804A8CAFC2:1 CD34C7E8CA4E4618D5CCB9EAC5557C3E30A:2 CD7D00C4A077103B1963DC634F165D7F0BE:1 CD82178053185D54C63C43D726A8561C525:2 CE952275CB4048AD5557A578182F946ACE9:2 CF05ADEEC343EF4344A3E9E7791B0786ED3:2 CF88AD9C21E356F0E508AB2B9B1034AB4BF:1 D00CF8A1BAF5D4B98DF2F93E229BE6A1504:2 D11041C636E15B723A67AB06393481922E7:8 D1ACDBBCC31EDB46C17BBB18A52EC9AC84A:1 D36BD2C30C77F0579246E51EB0C9CA15F3F:2 D412374C03007172DC190D1041BC624A987:2 D473AF390CE7667A7150AA79DCD36F4770D:2 D49C0B15FD180F4888FC7BF039B066E03BE:5 D5D25E77982F28739452CCB9B78C8A179FD:1 D65861F0BBEFB5EB0FE0D5318A1BF0F9FDC:4 D6CD8865B7B37E3780AFF1B17D028D406B7:2 D71FB1FCE65FBAAD5ED83C39509A922FC46:2 D79A244777E6E96C0C2597C273C4C03C54F:3 D7ED8EEB37E8EA3B7E7A94C7FC9A6D669E9:2 D7F077C52487CCEAA92ADD2B0C6EB01F384:1 D80D5E2950FB9B1176D91A7B05DA9B2DD58:1 D87A63C6B084CE5A490C3C58F5CD21A4CCE:2 D8C641931B0532C3AF145A7269BD3D13751:3 D94FEF8F82FB19C79125D8A6C241EE21659:7 D9BBFA213D99BCEB24D105F60883772BB28:1 DA30A95C801D6DAAC206774F550BF9A3780:1 DA8485F5355CA5897505FF131A4FBC5689C:1 DB4AB6C872594C86DE61952319D4E8113F1:1 DD54432092FE8AF9A9989A671CF30F41453:1 DD8827FDAE633D8C3DDE92CE340448C5FC0:2 DD900A16EED4ABBCED95727A6ADA1768DF1:2 DE911C5A4E78C1724BF9781B3D7CDC1A876:8 DEB6D6BF137BE132DBC7A2460972887F2F4:1 DF14FB996ECC3AA5D2F8C4A6D0E58B619DE:1 DF72602EE2EBC8AA211AD19E0AE99CD3C79:1 DFA04413E112FB760E5F63FDD1101D66D7B:4 E00198653017C8A9FEF5692FA9A34FE56F2:2 E050DDE60C393C83837491D8506B6CDE13C:11 E0E34404EEB668C870BE21100BE2D93C3D4:2 E0F399997E6F9473478B3DA378104AF99CC:2 E12D8F3E9A5D7ED3619100FEC9E840891B9:2 E1EBD9264316BF61CF4A57220515629B914:2 E1FDE65F4AF0AEBE3E7BC1DF9E111258B9C:1 E226D1DC125529CA74AB35CE29CFB843AB2:4 E24AA431A18597225AFD480A09AD37E6EDF:1 E2B13A612DF68ED2E2A740F6A3762A1628B:3 E326FA55A7C9EDD8D3B65838EB5470A521D:6 E33DF201133C0ED09E04C1020ABEA0F3E06:9 E36466033C1B0888121BF02D918410A70E9:2 E366F1E21138C1487E77F3032D80BEB377A:2 E52067FB4CE0B7E26B9E4BB307B26CC9254:2 E65D96D93846AB37052F5D26DFCA82A3B20:5 E66296ED8E76E1164C45ABF5D505CEE5C96:4 E66831A66807F98D0B589FC1D2EC7B5025C:2 E6E4819C437B5B4CC7C3613FC0FEF92777B:4 E7149CC9CAAB44B75BEEEDFC2DB911B220C:1 E742FCC827D15E2E3C0C16A8D123E923B4B:2 E80D4052DC51EB0FF0E24272966F0A6D9B8:1 E8A013C059CE52F9ACF4D846B1ECDF2A4A7:1 E8BAE5966D8B08DC4A4688044A37C506B09:5 EAF279A80A926293110FDCE5F4D5B666131:4 EB1169745BFB899D08CC201CAE987A82EDC:1 EB2F9AE57CEB1526DE1ECFEE5FAB2F2C134:3 EC3428101C99E3DD004C30118F26BB933F8:1 EC48CC72308314F0D83BC34413082658709:2 EC5EE696325A6E43E3113739E5FB457625E:2 EC7DCAA7F5A26724F16FF9B5238ACD43C0B:1 ECA8984DDEB11D75081EA10F8B92105466E:6 ED0B255C69A349D6A26DE71FFA8E374C429:1 ED330B743D94014E7431F1B1030EFACE4DF:2 ED6A73D7532F3F1EA9F9D5CA10C7553C6E4:11 ED909FB31E41C764FB7AFEF09EB4B60E76F:2 EDC47316ED80259983A280379829565DEF9:2 EDF816C5AB148DDF8F478F83656AAC7127A:30 EE85BA2F1E4E589CE6BE41542A950278E00:2 EEA8C1A6750C8F8A856BDEC098D8DBFB994:2 EFAF45F12963B29F3C515917B5F7B217D20:2 EFCE4F6E54E4E6CECD1FCDE54AE1E5536B6:3 F086DD2F38003DFE50E523875FADC2B8356:1 F0BCEB3CC0350941574E0704A743939266F:3 F10E05B0D4D94EEF84B9DA3DD0D59B17D55:6 F156D5216AE61BE9DC244114E803DE5B870:475 F1B9479ADE5FE0EBBAB138A45D3001958A8:2 F1F139F40FB8CD86725F9A9FE635D431150:2 F21A06E40A14623E79EDCC798EFF5B34743:5 F2478367D4B3264811BD74D9401E34E331D:158 F2E8204B0F5C21CB7B878879642B16C79C8:5 F35D472DB8E0FF810D76AF3EAF68C6192AB:1 F3B18D1F588210C0430A52F8C5E25298521:2 F41FCC62A47725102AABD806F4226E0D3BF:1 F42B67E0378DC81A7AF84A76814B6FFFEAD:1 F4A948CFFC3EA827CFA0BE4C3FC666E3724:1 F4E8C571660587A612F0F7828BD4053036B:4 F4F8CA8882862BE5E7FE4EC41CD17C315BD:3 F6121069443D63BD16E1C8DD8461F4E66DE:1 F6417F38A1431A6C526ABDF2CF795D00391:5 F6A3FA911781DEFC57D94A0DEB28B972AB1:7 F7222846AFA839F746C659D50F8DC382A56:2 F768DA97EB02A921AD864D28166DE257678:2 F7C663A1BD8D52A52E69CCC642CFBDC8FE8:1 F877BAC857742968E442A8A6972E2975D60:4 F9398A82D8DB3DB65145284E201BD73009D:2 FA3719FBE7A40DD97C7DB8ECC5FA675C705:2 FA7F650EE5C7FC09025A8E9319C44E08E0E:1 FAEF4F3518F723115DCFE1A411F79C72C67:1 FAFEF4FCB684EEB28553D23ECAA7391B037:2 FBA1245A47B13B5EDED9FC2BF805F246FE9:1 FC07D1D2A1070A50D96FE7CF9DFFE44BEC0:6 FC51D20F3F227A533924F7314FC7DB28A97:1 FCB4D5332B740D1A60C6FCAE2D169A61F8A:1 FCCFFDC0EB33DDDA658369682C08B5B872F:4 FD2F6A8A5ECA0EDAB1A739FFD01ABB6213D:2 FD39BA245AE25049AE80F67CAE0C82E8196:1 FF2FD2B9B042840F2957F6583D5EE2D3CDE:3 """
28878
module Tests exposing (suite) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import IsPasswordKnown exposing (IsPasswordKnown(..), isPasswordKnown) import Test exposing (..) suite : Test suite = describe "The IsPasswordKnown module" [ describe "parseResponse" [ test "finds one correct entry for one response" <| \_ -> Expect.equal (FoundInBreachedDataTimes 1) (isPasswordKnown "pass" "<PASSWORD>:1" ) , test "does not find on randomly non matching strings" <| \_ -> Expect.equal PasswordUnknown (isPasswordKnown "<PASSWORD>" """00169791E84389EFBAA05C2EAE449D45D00:1 01BC5A02D8F0DDA6DB019ACDD3F36051F7F:1""") ] , test "finds match in cached real response" <| \_ -> Expect.equal (FoundInBreachedDataTimes 514780) (isPasswordKnown "<PASSWORD>" answer_for_asdfghjkl) ] answer_for_asdfghjkl = """00721DAB885B3C745FAF8E13A2C0A23D22B:2 007EFFB71339AFB4FD1D2D5F1F42B07E833:5 00CDC5D3BA289D3726A7637FE66F2DB0EEE:2 01783EEEAF576CDBBB176C06DACCBCCE334:1 01C07AD380C2369A7F1AD700C266EF997BB:4 01FE309477AA8EBD2FCE83D49D233749600:2 01FEA56B47DE74B260FEC85428E70910DDB:10 0232868600EEB190903A13EA07B79A98C59:6 03479ACE8B47C73FF8890F597CD9F1D4558:1 0393336444E8781E9C6905680B28A85166C:1 0394BCD985574FDA0C1EBDD20FBF1C5847F:1 04567E14C1A8B13FC5B470D0B310E798302:3 04E99C31F147533385CCF3B2A8A8A14BCB5:1 05CA309B6F64021C7C5F9748CFF5BD2ED31:4 05D421DAD791F043EF707236552A715D7E7:1 05EBF5ABB5895336BF00C1AE599D81371AF:11 06245BD27A61D79557875FD695B4324B898:9 069293AEC0FE7FAD6E41AAE074FC3F7B5D4:2 07C3881213DC5C8E156C3448E23DA4F17DE:1 07DDEDECD2267C01344AB7241A38978EDD3:1 0901174943A08895B24493BF6E5E56617F4:4 09EB15A56E74A1E80CB9D21FE927C9F1E85:2 09FA313908A020D96CCA0F9AC23652DCA9B:2 0A03777C21B91779E56AFC90FB0451AD9D6:2 0A24A581A6D20824BF6056873139763CC97:2 0A41DE34570251F0A60BA2BA8D2D7721450:2 0AB4774B461DC5BD5F3DE0FE26FAA0E873A:4 0AC153318E44010790460BB00966DB1C084:1 0C589B4D612F94B9C5B6AB0A3BB89296BEC:1 0C629CE13AD7B9475C7F449D3782A1DBC4C:1 0DAD6D88F2A916D32449C0B2B0310886D24:1 0E38BD95BE4F4BEF29E24346BD80AA83444:11 0EE0C3728353F3F86CBD0976B7658EA04F6:2 0F22720FD09C07EF87450FB80EC037FA4B0:4 0FF9AE9009E184D136CE2D9B855A6F8820E:1 10864862DCD10FD6AA209B455C174D2ADA6:3 10FAD02E1CB7D7ECC1D5A1DFE9263886191:4 11008E9A3C6359542BC16DA9BB2A589EA8E:2 126860AC140FC59E9C1F1AC1AE5511CB26D:4 126BE3A23967EF77D9D7FE9512F1899F1BA:2 12D860AA1388251CC7772882E1B6284649C:2 14F2F586C2BFBB68FC5F7FAC945F54487BE:6 15437B38123F10F592D7EAD1878882D1FD8:1 163F56A3089A582AABBB1AD73AD71F121FB:2 164D36AE8C54636F1D5A979E3C8FB09DC69:1 16632C8F83178A7FD1DD9D830536043F95F:1 17519400D1D5F0AD33E654081CD0C6144B2:1 18A450C29C0AD55408E223CEB32758C5AC6:2 18ED7902EC2B462823974DC8CCFC251F015:8 1998BD853445F8E1C5EA171FEADDA7DEDB1:1 19A7FEC6493CDB7B884265C2F8EA9C72216:15 19FBE83CF8B2E0BF214C4BFD2689C52AF38:7 1A093C719525C386B19F9E97DB4530B48A1:1 1AA91ECABA1C20AE5A037D2D463DCEF7D91:20 1AD409E0F12AAC85273000AAC7CE3E54AD8:2 1AEF6E9BFD1E3073C26CB456CF92901CE46:2 1B4430D4CD06259BFA8B4733104490D3264:2 1B5BBF1A4AC86FBD61D8888CDBD9769D080:2 1BB241A6117C61C24826663446E5849C0F1:4 1C75B8A438B8D17ADE9A8E78160B9F4D09E:1 1D42E4758B48150CD50988F8F8C27D615B4:1 1DE11C305A0F504CEBB6CD253992C6FDE7D:1 1EC6B682185B78E51CEEE150773341372A2:2 1F54CAC0C2D568468959BA0C2CE91292610:1 1F808B64A66AE837D2532F88D41B9F451B3:1 1FE78BF7A49D8AEAE78FBCC78193B2F635A:2 216895287B44C4C45C05DCD76ABA41C2892:3 2183353C95A554F6019AEB92F5278CD7244:2 22828741EEC825D579C039AD1881879AA2C:2 22C598A8533BA4F3000929A919DBB16481E:2 22D3FD712963EA1BEAB3F46EDF393A3C0CE:3 22DB2E13CEA5805BC73C66533B99C9A38F8:6 231D70B838BE2E479EF847725D89540B818:2 23336F586DFA8C07CE7C853A0E522592CD4:1 24B29E6F3441163D292218B3DD040B414B9:4 24DFD27191A597EA25B8C10A420558D26FB:2 2621E72F01EAED166A188AA397B4A97E8D4:1 27161124353A80163C7B10AF97BEFB60176:2 27B8BE3468A9C4577CC60D720E6E585A51C:2 29765C786F73A2C0C53A736375AF4463998:3 29A414B0C005C881FBED6D584C4B0117C48:3 2A6350DB8E1DC47831AEECAD6DCEA53A9F1:2 2A7357EC8CE4CACD53C2716CF99C9E44D51:2 2B06A1CC1317EB17D110E89AF8DD246DA0E:4 2C66632A8A8B71D4229D1B06258E8926C97:3 2CBC4F49CDCE84C5134E0DFD1662E720840:5 2CCCF84A52E8E837C84973A629FD032F197:3 2CFCA5999FC7214BE1BDECE241B48C89C06:5 2DB8D71F2D0C850AD73099BE98E5281907D:2 2ED3B9F24BBEDFC1F534797DCA07E690E5B:3 2F2720BB4F73465D1068FB901DB96089E11:2 2F5A767880EFBFD9C472532E8634F9639A6:1 2FD4C80277EA030BA3E969B29C5CFDB8801:4 2FF853397752F070BEAA1BBD1561C80A2AC:1 3076C4D371C055271B64DFDBD5EED444A6A:1 3223AB3906BD1D33EE31788FFDD592218B8:1 32A0B41397288EAABB5232159401EBC6394:22 3338A0E0513CC4109081E456AA375AD5330:2 3371529480C679815232254E541036979CA:1 33978346B6561BF28959244BE1CE4CDAAEA:2 3450EB7DA4296AF3458C7ED3DAB62243D95:2 355E4670416E53887B1876B8C98F3958F73:2 3590148DE4FFB4A31384C2F88DB1E043DC2:9 37389ED6092FA06690AEEDE4ED2630541E4:2 37468FD8D42038EEA23E98BE6D962F1ABCF:9 38608D6012F25E8963BE2B8BA0A6BE20D0E:12 387B78E43B006DD40121EB39844D1E72445:1 3884A27824CFEA69ADA4D255682871585F7:17 38B6D136029E5729ACC76D5BF3F04BFF785:1 396028FB0D5CA885D5D832D6BAED526FB2C:2 397249BB1CD9BCE72107BEAE4ACA72C3ACB:2 39ED15BF5EB200FC85DE650CE94A03E3C89:4 3B57ABD02E77BAD30D6554DE2BF85E94041:1 3B9481F2F95E5304C6FE76BBC6C986100C4:2 3C4A8A59AFA8D9715B5E583E00EDBCF537E:5 3C70E1F8B1FD34E2A359FA9B3CBE3B4CDCB:13 3C770D319CB6CDBCBA52107C7E6B9C41B8F:6 3CDA3DBD91503DF5D0614AB2262D6F7BD7C:5 3D477BD978C16590151A200DB7DDC1B08C0:1 3DCB3915D02D4773791EF7245531529C6DC:3 3E28783B84A393041D3B5A40E2D0AFAC9ED:1 3ECE7E8794ED029F801F3F16212259A9A0A:1 3EF396196869133E0345B5363622C329622:2 3EFBF7342ECCF7C9A0472A3DC888342E849:2 409A55DB312EFAED0C60D79C820123857ED:4 40C479428CA2E2A17C62E3EC9A8D1263D3B:7 40CE9A7B9B8E58542678800A6C623E9A13A:1 40E66F71BEA945D1124A204E94E56DBDD4C:4 4161134763027BF30812D76BD89CEEE4313:1 42C4F4E94CDEB8C2E59DCB2B71C52AAFECE:1 42DD8371560C9A999D5A83B0F9B62A1C232:2 43355AF1376084DDAACE8E48DDD1B301358:2 43379662DD408EB8BEFD7FBDC7BA139C7ED:3 446401FBEDC423BFECA860CE2515FEBBC64:1 44AFD5CF7AD0D3A18955ED037AB4B104E34:2 45C626376FA22BF7C3961A93BCBC7715BBB:2 463F55F95E6C74F72BC0DC2A0549309AD9B:1 465EE874FD8477775A92EBFB48DDCFE8F69:1 468E11280C3DBE4205933675F32B5C5315E:2 46F017EAEF24880BD83882BE05DE5EBA7E4:4 472C8500206084F880FB704A0CC765FCCA8:1 480855A5D696E7DE951245F6CDC1FFA99A9:1 48D6E8F7D39CDC429F7DA1F210D275D43D4:3 491104F690968038C0B8B5B907A7666E17B:2 4944FD7BED9E76CCB8D50A24801F417ABD1:4 49D63F70FA89FCBD865EC380E730A54536F:1 4A323CA77F38E34E252F803F2312685BBD0:1 4AB15955A6DFD23CAEC36007DB965A25D3E:2 4C1000B69FF96A38A93233F52AFD74A7FF5:2 4EF189AE5F0FD8689E0509B3B83FCCDA065:2 4F486BBEB886416124D743C74E38C355312:6 4F51C90CECFA4C93845D0EF912FFD0D53AC:1 5055B063A6E2B656CE5CC828C94C0A2C651:7 50F3EA256B13AF3586EC3E0880B46B330DB:1 51C5D06F1DA3868A4B45C2AC0C13F01A88C:2 51DAB3BD2CA5BC5A12C993E7DD7524D1FDA:1 5217430F9EB15C5B259CC1295CDEC750C99:6 538A1DF282AA1481EEB8F01C49D1E3332C1:1 539644701B53DA1028396158EF490262D2E:1 53A961DF595D1F80524CE7900A1E107A941:2 541DF822567128E98BBA210E1731DF674B4:2 5636DD61E40C8F333BED313CC55985C3260:3 566A7551FF3B83FF511F03BD7645804DBED:3 56A7653412B2196E8F02FD5E8480AB1C3C3:3 56F33A2F2128D42390781BBC1C6C5EA49FD:3 56FD3E50D21610EC46A12B340029D1540B5:2 574B768EEFFC32593DB817E3F9458419749:2 57986A405A70D478AB818EFBE13C8EAF01C:2 5859DB0C43EBAFFC1E7DEA8D8AE68ABBD61:4 58E0B742240BA78B772D03F794769438E62:3 5902ABB6A4C0A3C6C3AAD69318F57E67E65:1 593C0D6F2724CA9FD459AF544675EB2E8F5:126 595045AA5C037CE7A8907D42CD503056665:1 59C69A1E90A3F364BB6AB1CFE1F58B75759:4 5A04A0727E35212BF3E288F18270DD44BD5:4 5B2DF0E6DA6BC2F7CE46CB4606FBF668AB1:1 5B64978270EDA41C9A61508311FBDE8BFC1:25 5CB66D04DA973AD381AD05AD3038FE9F652:2 5D1374FEB99CA2A30F627ACDA10CA35B696:8 5DC2E3F67289C38E38B8C6146C6C7F7DA87:3 5DD805E17DF4EAB9C79EAFA19505C846897:1 5E538E772E0E22DD0D1C2D323A8BC99FA82:1 5E59EBE6A72FA70DFE43B33D94541CB0DC4:3 5E64136CB77DF3B966D7ADA29BED55D7E3B:1 5EB24DC67AFCF404356C5ABB3F21694996A:4 60910CCED1542070FD763D0D80770F0BC39:3 61386005F28E1075FDE5AD6DDCC4D7D1698:1 613EC92793236C177F974873C3EB036E2E7:2 61475F6084609C6EA4906CC7A9DA850143B:3 61E3FDB7C1CF0B50AC71B0CAC440C4C2477:2 62C275DCF82C3BEB093E660F1120F0AFFCD:3 6324BCA826D133A71F76C5F6F6E5B3996E6:2 64633DF62221D46785D4C26260410CECFAC:4 647AA3891B535634E4B58145DA0292519E2:2 64DE389A3D54055DE2CA03D034A65B49E4D:5 64FA823B43C0F2A10A8AE16437376087241:2 6607D9E12D84C34DC8A1FE0C09F9C928DA5:5 6608605DEC3D88121D9119D3DCA546D0345:8 66BF6FE5F2BD89C8583488439F2AE034E1A:1 66FC2E0A6800E87F2110855DF4E86306D2A:1 689FBEC7FB47CB8A27E2EAA2F4B0C20FD26:1 68AB3477559D2B2966B59CA0F415D34E269:2 6AE8FC557EA95FBAD0899F5D89AD678D53F:2 6B50E481DCAF2AB70165F1F08AEF0BAE214:2 6CB8817293485D7D697729392E69885E810:2 6CC18441F64A6A3912B75F13269EC30BCB3:3 6DBA67B08191E1DAA5060658A34F3927D4A:1 6DC6A584342A36967BB7E8860B9FAE6A063:1 6DCD4A4C28AE5B324026C7F3FFB34E92514:2 6E0D373F6981BD47930F4A56C4C7E08155A:1 6E43B226EBBE36A9A7175B81E94A6A17120:3 6E5E01883CE777D41286AE822A96E1D31F5:2 6FA57594BC01BD05E66E8A3CCD246D1BD33:1 7118901357A7F1C26B5A7D5BBBCEE746A31:1 71AA924424D3AC16DD1E8F38B9BABF8CC66:2 71F2EBDD6D5F226ED8A2B1B2C96A8AFBDFA:2 72812979401206FCAE9365548D965254DCE:1 73AF3A4B50CDC1D33AC0486058B91E81C6D:1 741D40D547B37A948D99A2174B04366EB14:3 74439891C8FED22022532967E48971AA2C3:2 74B6B8D03B94856084B0461DCF457DD8579:10 74CA186B0BBF7B6411C83C49179C9706E9F:2 76E30736CB99547A786CD23872E47726875:2 7712EA10BD04D77052785EBD04B306E262F:1 77170C450D3F8453751CAC0AD43ED8D4CE2:7 780D1679417E51653947DD0D0B0D20462F8:2 78AB0D277B5B67714F481E086E82102710B:2 78BC3B1E5570B2FD901B72ACCC5EA4E07D1:1 79777FEE6AD7AB97E7F2815C38D2105B23E:3 7A556B54F85B14A4EA4B855D567722ECFB6:3 7A936EE328C6906F08245F74657D42E690E:5 7A9FD995B65CB90D652AFA629EA4EB9B75E:2 7BEF7CD90527CDD45AE57FD54D0982121C7:3 7BF11C5E1AA98A9773C1EC6CD49C8C92EB8:2 7C38F34FDCBF65D8818DB0F11CA2E0D1DB6:1 7C513186CA452C9D04E50AE4CF2A99F49E6:4 7C6EAC3A4B5691F231EB89B43D92DF3E212:2 7DCB092016F7988A52026764BAD7B16E9B6:3 7E649081A3D86EF4D54DCE71635D76923B6:1 7F52B3BA9470E5E2FD3A80C689B4A7202BB:1 7F85C62E818FC95FEABF63A6567EFD82C14:1 7FA01144F7D9DEF6EEDFD4C95449BE604AE:3 80553EE51F892A6253D750C9664297BD2D2:1 81E21C305EC0861C99F99BFF50035DA5714:1 824D7FFBF7FBD80C57526190054EE2FAF94:4 831174A845D467869948EFB0D55FB0EAB16:4 83CC74FB6BD9DCC15A0C8B7AFDEA28EAF5C:1 846B3DE3A043DBA21279917F1075F1C87DA:12 8506A8BFDA9146551AC965FAF0EE33CCB1E:4 85588793E2BC7CDDD91FD2EE6687767C625:1 86204767D950BC178752B789250FA1951A7:2 866AE5C9B47EE9799FA9DE8287EE5F92160:1 86813A557CE096216F2C789C8B5B38ACC1C:4 873543B8084458A5A8D64D7A037BE237EB6:5 87F29D9004A062DF6C3E5677A7B9E51700F:8 88650F85CE60D59336B7B550C8DED7C1629:2 88D9AF4E55A9003404D438488CCBA254255:2 8963045DE4AF6B497C6A44D235927AA06D4:1 8A03958ED504BCC270351A222275F694D1B:1 8B1439F16867B8970AAA8F5887D71961C9B:1 8BAA0A48822C8C4D2E2CC8DB100EBD4CC10:2 8CB5BBE983314E9D51A87F15DFBDDD208E1:1 8CFAC2AD594EA6973A394067FD90DFE4F4C:1 8EE74C747990A5383DFE98CB09903E2A441:12 8F61FC0B22A1ED668B0C38AEACF6BBBD532:2 9067848425AC6E3A99230338B54E1B73ACD:28 90B830D465A3AD20610CBAC0DE1BBAB27AF:2 90BA96BF63F438682B411065984E23B42B2:1 90F504682DC0D621C73CB8D9DCA64DE2AD3:1 92FE443CD39E9FFC799DD00650DAD4506D9:10 93A61FB8F69A5615D50B28E6A19503CC4DB:4 955CDC3DAE4F9BC8D0DF682163E178A134A:3 9565C104761CB68D99A8B4908B1E1D8FC17:2 95A36EBB6B37416AB7F92ACD80725FA971B:2 95E12C96B61C1006B1260447CCFCE3E9AAE:6 960F3EAE324BDC39326F64F8B3C5B1C43B9:2 962009258BB125EF02F9420CBCDD84F0D7F:3 9715281C7AA292ED92EC05D659321307D63:3 97691DC92E99FD6A8AA581AF7999EA2CC40:2 979178F32F3E5B7F1B714C8EF77DA328C78:5 98A16185733ED923079E839E3C4074FD139:1 99CC23968ED935A2C0454593518559F5AC4:17 9A9D0D0EF781883CAFFAEB3DF2BE8FB0179:12 9AA8F765F6A0A2685F305A68A402A4F31CC:7 9AD24138A817EE75C9E430956AEA6FA73EF:2 9B2F3D4B7ED2FE150B19E19C1E819390240:2 9B4B775C9EC42C90038779AF44A377C84B6:4 9BADDB23F48B9CC14BB2181FC62E811F78D:3 9BBBB1EEACED3B52E54F44576AAF0D77D96:514780 9CA29FC04D017ED4C109EF2ADC5EF14024E:3 9DB80D391CBD1CFD17D5A712040EB4B765B:1 9DC907D1119E717AC968327DE3EE1990F07:2 9E4DCB22E470C51FE480892CF96E3429948:3 9E8B5853B50C2B6850CA76275297BC0CD87:1 9E9C6FD8AB732FC38F731AF781A37F05379:2 9EA3432A56A75EBB32F73979C78EE36623D:2 9F70C00BEA91DD60B38530D54F600E2B05E:28 9FF668FE9660EA15AF550390CC781E85C07:3 A1C813690B89FEC9CA7B1F235287DD427A4:1 A2349972A986FDDC945EEF0C600789349B1:1 A234C98FC53D10CE55BB39F1220D6F6E614:1 A2BF81A797268C1E9EEA46DAF3EC19BC518:5 A367F10C022C0D175CB268EC810A9E12A94:1 A38C0704396F36963376E241CF4EB81DC0E:2 A51C994BA20F97C3A1D8DBAD23E12561BB0:2 A5543BA889F421A2E4124A8F5664BCF692B:4 A556C58AD4AA4B8BBE7DD6CF5DE4B78194F:1 A564C4D44CBF6753E7928F4304905021C78:3 A651DFF1FF53D86CD6D34F6720BFE139749:2 A67D122777174A27DC88D2CA1A250CA6607:1 A7145F67B39B490C5DF37161F24DC4ABFB6:2 A84DF047119820B3820F08DE072D72D4CB7:1 A8BB8B130CBC8605E5937D198870F200899:1 A8C800803CC37B1BB71F0EE58D6405D1392:1 A8EBCCF466587BBEB4071DC3FE04EEF3AD1:2 A9081B97CC141FB26749004FF8988794724:10 A9C94C7821EF4F2BD36F9788B2364A94BAB:4 AC587B7B1CA81D53B69861F87B36B9EC394:3 AC90FBAB1F177D913F7B3E82EC4BAED9E3E:1 ACA267D4B1A7AD74789B12197898D6B8E9A:1 ACE918664FCCE918D4DE56D18489CCDFB46:5 AD917404A05A7E183B55DB1D22ABE39B1B1:3 AE452C1905A0DCA7F2718552E70CADDDEA8:5 AE6F8885070746C5C36C46A413007A59335:3 AF6B7DEC97D3E0B09236BEA120D6580C30D:1 AF701031143661DA7F853554E82E71AF7E1:1 AF70E78F0FCBF7EF2C9D0F2FA4DFA3FCF1F:1 AF755BEA42C6CF817A7DCC608C8F0642E47:3 B1CBB503ADA165C2266661953368C31F20B:4 B1DC12029E01A8054DD6A82B1BC4919E5FA:2 B1DC948D79F8306A298BA78A8B38410BEF4:1 B2A164DA818387688192D9A6FE5141F2881:1 B2B80E721E97330384C346A701FE35C2955:4 B47348CADC38957691A36D185039B799ECE:2 B5C7BB5BB17BB32B383DCA3259E259176C2:1 B61BD6CFC7D9F44361DFB1D3399C2F9EE4E:8 B74D785244C6C47D00F9B9589BA0E433994:1 B7A224C1F6CBBFAC4D5BBF2543893EDCF23:5 B83B74383253A1269F52C5CCA266CCB3C9A:1 B8B3478F96E0E598A39E8C61A6985970524:1 B8C6D3EF2DF858F8980455A01172E6DA239:2 B8DD367330758BCFD57716F0F8F64390843:1 B8FC47BE9A4D0B2540534C7C38583F754DF:1 B93D561BFBDF00C23545D1F03B562CA1DB5:2 B9712D9D3AC1D555D0BEBF147BD17511B5B:3 BA3290DA02BEF4A008843E97309FB815146:3 BAA8401AA6F7245312CCBB2F1752B22D86D:2 BAE0A09F1F00AE97A0FE13B55B766062637:2 BAF573F6C3D5B0C5AB0558CBC5B02AEFDAE:3 BC00635F1CB1A87D9205E6C0E8091785105:2 BD6F4F1B69B2196B5C6CF033718F574EC07:2 BDB1DDCC228BE9F7FB35EEF6AF5113AF73E:4 BE146DED014E4D1F66D577D2D14D8135DF3:1 BE70DCBAE2F79C46225CB2B9BDD65F1AB3A:4 BE90622F1FFCC28BA2C7A0AC039643B4C54:27 C02C14DE7103830953582B7393D71A32EC2:4 C065390F044A0733C62EFFD26C7BC9E5C0A:4 C069578DF1863522C57972C993C74EDA915:2 C17EAB25AA71E786892A6EA72B0966AAD6A:1 C1ADA5AD77F58D11542594DE65BCE3D1EDF:1 C1BFC70CA9C7A42528493171C882FA7C417:3 C2E0DF0AE878FF0FAC08D2C289833B51E58:2 C2EE82E916065EE6D864F275F311ACE61C9:10 C342BDFB47690A964704AAA2271A725CCE7:4 C383EBB71D19EC43FE5AFE35258E754DDC7:3 C3C95C722170002A1AD91D143E180EAB1E7:2 C40BA356F488EF52E2396A2E46569DD768F:2 C427749A32159BD6D7CD8B2ADF92FB1F832:24 C42B61033860FE10F17A4FA7FD99C9AC833:9 C447BAE41CB8EE62527EB64A6F5FE9CF478:1 C46C421AA6A899409ABA61633BDA8D66972:3 C64BB58C11AC8FCF9EEE1D520A6BF627B78:2 C67266A679B412A4BB4A3C6008A7B9DAA87:1 C71ED4BADEBE21EDE7AC71A8FED4F52008E:1 C803ADE6E741B4D5851D712047DF03FBD36:3 CA2F8699ADC9CAC35D6751970EFC11A4273:1 CA5C3E40B7F064088261816AD2888EB9B5E:1 CA81B22EC34A8DD2D112BE8A8BD9F56D100:2 CB16866ECD76A98EEA229DF3D79EA89B3D6:4 CBCBF62F09255D7BBA936414ECED1A67BA0:4 CC98AB04707CD69D15C388DA10AA56679F1:1 CCA035AA895B0EA8188F1CBC7804A8CAFC2:1 CD34C7E8CA4E4618D5CCB9EAC5557C3E30A:2 CD7D00C4A077103B1963DC634F165D7F0BE:1 CD82178053185D54C63C43D726A8561C525:2 CE952275CB4048AD5557A578182F946ACE9:2 CF05ADEEC343EF4344A3E9E7791B0786ED3:2 CF88AD9C21E356F0E508AB2B9B1034AB4BF:1 D00CF8A1BAF5D4B98DF2F93E229BE6A1504:2 D11041C636E15B723A67AB06393481922E7:8 D1ACDBBCC31EDB46C17BBB18A52EC9AC84A:1 D36BD2C30C77F0579246E51EB0C9CA15F3F:2 D412374C03007172DC190D1041BC624A987:2 D473AF390CE7667A7150AA79DCD36F4770D:2 D49C0B15FD180F4888FC7BF039B066E03BE:5 D5D25E77982F28739452CCB9B78C8A179FD:1 D65861F0BBEFB5EB0FE0D5318A1BF0F9FDC:4 D6CD8865B7B37E3780AFF1B17D028D406B7:2 D71FB1FCE65FBAAD5ED83C39509A922FC46:2 D79A244777E6E96C0C2597C273C4C03C54F:3 D7ED8EEB37E8EA3B7E7A94C7FC9A6D669E9:2 D7F077C52487CCEAA92ADD2B0C6EB01F384:1 D80D5E2950FB9B1176D91A7B05DA9B2DD58:1 D87A63C6B084CE5A490C3C58F5CD21A4CCE:2 D8C641931B0532C3AF145A7269BD3D13751:3 D94FEF8F82FB19C79125D8A6C241EE21659:7 D9BBFA213D99BCEB24D105F60883772BB28:1 DA30A95C801D6DAAC206774F550BF9A3780:1 DA8485F5355CA5897505FF131A4FBC5689C:1 DB4AB6C872594C86DE61952319D4E8113F1:1 DD54432092FE8AF9A9989A671CF30F41453:1 DD8827FDAE633D8C3DDE92CE340448C5FC0:2 DD900A16EED4ABBCED95727A6ADA1768DF1:2 DE911C5A4E78C1724BF9781B3D7CDC1A876:8 DEB6D6BF137BE132DBC7A2460972887F2F4:1 DF14FB996ECC3AA5D2F8C4A6D0E58B619DE:1 DF72602EE2EBC8AA211AD19E0AE99CD3C79:1 DFA04413E112FB760E5F63FDD1101D66D7B:4 E00198653017C8A9FEF5692FA9A34FE56F2:2 E050DDE60C393C83837491D8506B6CDE13C:11 E0E34404EEB668C870BE21100BE2D93C3D4:2 E0F399997E6F9473478B3DA378104AF99CC:2 E12D8F3E9A5D7ED3619100FEC9E840891B9:2 E1EBD9264316BF61CF4A57220515629B914:2 E1FDE65F4AF0AEBE3E7BC1DF9E111258B9C:1 E226D1DC125529CA74AB35CE29CFB843AB2:4 E24AA431A18597225AFD480A09AD37E6EDF:1 E2B13A612DF68ED2E2A740F6A3762A1628B:3 E326FA55A7C9EDD8D3B65838EB5470A521D:6 E33DF201133C0ED09E04C1020ABEA0F3E06:9 E36466033C1B0888121BF02D918410A70E9:2 E366F1E21138C1487E77F3032D80BEB377A:2 E52067FB4CE0B7E26B9E4BB307B26CC9254:2 E65D96D93846AB37052F5D26DFCA82A3B20:5 E66296ED8E76E1164C45ABF5D505CEE5C96:4 E66831A66807F98D0B589FC1D2EC7B5025C:2 E6E4819C437B5B4CC7C3613FC0FEF92777B:4 E7149CC9CAAB44B75BEEEDFC2DB911B220C:1 E742FCC827D15E2E3C0C16A8D123E923B4B:2 E80D4052DC51EB0FF0E24272966F0A6D9B8:1 E8A013C059CE52F9ACF4D846B1ECDF2A4A7:1 E8BAE5966D8B08DC4A4688044A37C506B09:5 EAF279A80A926293110FDCE5F4D5B666131:4 EB1169745BFB899D08CC201CAE987A82EDC:1 EB2F9AE57CEB1526DE1ECFEE5FAB2F2C134:3 EC3428101C99E3DD004C30118F26BB933F8:1 EC48CC72308314F0D83BC34413082658709:2 EC5EE696325A6E43E3113739E5FB457625E:2 EC7DCAA7F5A26724F16FF9B5238ACD43C0B:1 ECA8984DDEB11D75081EA10F8B92105466E:6 ED0B255C69A349D6A26DE71FFA8E374C429:1 ED330B743D94014E7431F1B1030EFACE4DF:2 ED6A73D7532F3F1EA9F9D5CA10C7553C6E4:11 ED909FB31E41C764FB7AFEF09EB4B60E76F:2 EDC47316ED80259983A280379829565DEF9:2 EDF816C5AB148DDF8F478F83656AAC7127A:30 EE85BA2F1E4E589CE6BE41542A950278E00:2 EEA8C1A6750C8F8A856BDEC098D8DBFB994:2 EFAF45F12963B29F3C515917B5F7B217D20:2 EFCE4F6E54E4E6CECD1FCDE54AE1E5536B6:3 F086DD2F38003DFE50E523875FADC2B8356:1 F0BCEB3CC0350941574E0704A743939266F:3 F10E05B0D4D94EEF84B9DA3DD0D59B17D55:6 F156D5216AE61BE9DC244114E803DE5B870:475 F1B9479ADE5FE0EBBAB138A45D3001958A8:2 F1F139F40FB8CD86725F9A9FE635D431150:2 F21A06E40A14623E79EDCC798EFF5B34743:5 F2478367D4B3264811BD74D9401E34E331D:158 F2E8204B0F5C21CB7B878879642B16C79C8:5 F35D472DB8E0FF810D76AF3EAF68C6192AB:1 F3B18D1F588210C0430A52F8C5E25298521:2 F41FCC62A47725102AABD806F4226E0D3BF:1 F42B67E0378DC81A7AF84A76814B6FFFEAD:1 F4A948CFFC3EA827CFA0BE4C3FC666E3724:1 F4E8C571660587A612F0F7828BD4053036B:4 F4F8CA8882862BE5E7FE4EC41CD17C315BD:3 F6121069443D63BD16E1C8DD8461F4E66DE:1 F6417F38A1431A6C526ABDF2CF795D00391:5 F6A3FA911781DEFC57D94A0DEB28B972AB1:7 F7222846AFA839F746C659D50F8DC382A56:2 F768DA97EB02A921AD864D28166DE257678:2 F7C663A1BD8D52A52E69CCC642CFBDC8FE8:1 F877BAC857742968E442A8A6972E2975D60:4 F9398A82D8DB3DB65145284E201BD73009D:2 FA3719FBE7A40DD97C7DB8ECC5FA675C705:2 FA7F650EE5C7FC09025A8E9319C44E08E0E:1 FAEF4F3518F723115DCFE1A411F79C72C67:1 FAFEF4FCB684EEB28553D23ECAA7391B037:2 FBA1245A47B13B5EDED9FC2BF805F246FE9:1 FC07D1D2A1070A50D96FE7CF9DFFE44BEC0:6 FC51D20F3F227A533924F7314FC7DB28A97:1 FCB4D5332B740D1A60C6FCAE2D169A61F8A:1 FCCFFDC0EB33DDDA658369682C08B5B872F:4 FD2F6A8A5ECA0EDAB1A739FFD01ABB6213D:2 FD39BA245AE25049AE80F67CAE0C82E8196:1 FF2FD2B9B042840F2957F6583D5EE2D3CDE:3 """
true
module Tests exposing (suite) import Expect exposing (Expectation) import Fuzz exposing (Fuzzer, int, list, string) import IsPasswordKnown exposing (IsPasswordKnown(..), isPasswordKnown) import Test exposing (..) suite : Test suite = describe "The IsPasswordKnown module" [ describe "parseResponse" [ test "finds one correct entry for one response" <| \_ -> Expect.equal (FoundInBreachedDataTimes 1) (isPasswordKnown "pass" "PI:PASSWORD:<PASSWORD>END_PI:1" ) , test "does not find on randomly non matching strings" <| \_ -> Expect.equal PasswordUnknown (isPasswordKnown "PI:PASSWORD:<PASSWORD>END_PI" """00169791E84389EFBAA05C2EAE449D45D00:1 01BC5A02D8F0DDA6DB019ACDD3F36051F7F:1""") ] , test "finds match in cached real response" <| \_ -> Expect.equal (FoundInBreachedDataTimes 514780) (isPasswordKnown "PI:PASSWORD:<PASSWORD>END_PI" answer_for_asdfghjkl) ] answer_for_asdfghjkl = """00721DAB885B3C745FAF8E13A2C0A23D22B:2 007EFFB71339AFB4FD1D2D5F1F42B07E833:5 00CDC5D3BA289D3726A7637FE66F2DB0EEE:2 01783EEEAF576CDBBB176C06DACCBCCE334:1 01C07AD380C2369A7F1AD700C266EF997BB:4 01FE309477AA8EBD2FCE83D49D233749600:2 01FEA56B47DE74B260FEC85428E70910DDB:10 0232868600EEB190903A13EA07B79A98C59:6 03479ACE8B47C73FF8890F597CD9F1D4558:1 0393336444E8781E9C6905680B28A85166C:1 0394BCD985574FDA0C1EBDD20FBF1C5847F:1 04567E14C1A8B13FC5B470D0B310E798302:3 04E99C31F147533385CCF3B2A8A8A14BCB5:1 05CA309B6F64021C7C5F9748CFF5BD2ED31:4 05D421DAD791F043EF707236552A715D7E7:1 05EBF5ABB5895336BF00C1AE599D81371AF:11 06245BD27A61D79557875FD695B4324B898:9 069293AEC0FE7FAD6E41AAE074FC3F7B5D4:2 07C3881213DC5C8E156C3448E23DA4F17DE:1 07DDEDECD2267C01344AB7241A38978EDD3:1 0901174943A08895B24493BF6E5E56617F4:4 09EB15A56E74A1E80CB9D21FE927C9F1E85:2 09FA313908A020D96CCA0F9AC23652DCA9B:2 0A03777C21B91779E56AFC90FB0451AD9D6:2 0A24A581A6D20824BF6056873139763CC97:2 0A41DE34570251F0A60BA2BA8D2D7721450:2 0AB4774B461DC5BD5F3DE0FE26FAA0E873A:4 0AC153318E44010790460BB00966DB1C084:1 0C589B4D612F94B9C5B6AB0A3BB89296BEC:1 0C629CE13AD7B9475C7F449D3782A1DBC4C:1 0DAD6D88F2A916D32449C0B2B0310886D24:1 0E38BD95BE4F4BEF29E24346BD80AA83444:11 0EE0C3728353F3F86CBD0976B7658EA04F6:2 0F22720FD09C07EF87450FB80EC037FA4B0:4 0FF9AE9009E184D136CE2D9B855A6F8820E:1 10864862DCD10FD6AA209B455C174D2ADA6:3 10FAD02E1CB7D7ECC1D5A1DFE9263886191:4 11008E9A3C6359542BC16DA9BB2A589EA8E:2 126860AC140FC59E9C1F1AC1AE5511CB26D:4 126BE3A23967EF77D9D7FE9512F1899F1BA:2 12D860AA1388251CC7772882E1B6284649C:2 14F2F586C2BFBB68FC5F7FAC945F54487BE:6 15437B38123F10F592D7EAD1878882D1FD8:1 163F56A3089A582AABBB1AD73AD71F121FB:2 164D36AE8C54636F1D5A979E3C8FB09DC69:1 16632C8F83178A7FD1DD9D830536043F95F:1 17519400D1D5F0AD33E654081CD0C6144B2:1 18A450C29C0AD55408E223CEB32758C5AC6:2 18ED7902EC2B462823974DC8CCFC251F015:8 1998BD853445F8E1C5EA171FEADDA7DEDB1:1 19A7FEC6493CDB7B884265C2F8EA9C72216:15 19FBE83CF8B2E0BF214C4BFD2689C52AF38:7 1A093C719525C386B19F9E97DB4530B48A1:1 1AA91ECABA1C20AE5A037D2D463DCEF7D91:20 1AD409E0F12AAC85273000AAC7CE3E54AD8:2 1AEF6E9BFD1E3073C26CB456CF92901CE46:2 1B4430D4CD06259BFA8B4733104490D3264:2 1B5BBF1A4AC86FBD61D8888CDBD9769D080:2 1BB241A6117C61C24826663446E5849C0F1:4 1C75B8A438B8D17ADE9A8E78160B9F4D09E:1 1D42E4758B48150CD50988F8F8C27D615B4:1 1DE11C305A0F504CEBB6CD253992C6FDE7D:1 1EC6B682185B78E51CEEE150773341372A2:2 1F54CAC0C2D568468959BA0C2CE91292610:1 1F808B64A66AE837D2532F88D41B9F451B3:1 1FE78BF7A49D8AEAE78FBCC78193B2F635A:2 216895287B44C4C45C05DCD76ABA41C2892:3 2183353C95A554F6019AEB92F5278CD7244:2 22828741EEC825D579C039AD1881879AA2C:2 22C598A8533BA4F3000929A919DBB16481E:2 22D3FD712963EA1BEAB3F46EDF393A3C0CE:3 22DB2E13CEA5805BC73C66533B99C9A38F8:6 231D70B838BE2E479EF847725D89540B818:2 23336F586DFA8C07CE7C853A0E522592CD4:1 24B29E6F3441163D292218B3DD040B414B9:4 24DFD27191A597EA25B8C10A420558D26FB:2 2621E72F01EAED166A188AA397B4A97E8D4:1 27161124353A80163C7B10AF97BEFB60176:2 27B8BE3468A9C4577CC60D720E6E585A51C:2 29765C786F73A2C0C53A736375AF4463998:3 29A414B0C005C881FBED6D584C4B0117C48:3 2A6350DB8E1DC47831AEECAD6DCEA53A9F1:2 2A7357EC8CE4CACD53C2716CF99C9E44D51:2 2B06A1CC1317EB17D110E89AF8DD246DA0E:4 2C66632A8A8B71D4229D1B06258E8926C97:3 2CBC4F49CDCE84C5134E0DFD1662E720840:5 2CCCF84A52E8E837C84973A629FD032F197:3 2CFCA5999FC7214BE1BDECE241B48C89C06:5 2DB8D71F2D0C850AD73099BE98E5281907D:2 2ED3B9F24BBEDFC1F534797DCA07E690E5B:3 2F2720BB4F73465D1068FB901DB96089E11:2 2F5A767880EFBFD9C472532E8634F9639A6:1 2FD4C80277EA030BA3E969B29C5CFDB8801:4 2FF853397752F070BEAA1BBD1561C80A2AC:1 3076C4D371C055271B64DFDBD5EED444A6A:1 3223AB3906BD1D33EE31788FFDD592218B8:1 32A0B41397288EAABB5232159401EBC6394:22 3338A0E0513CC4109081E456AA375AD5330:2 3371529480C679815232254E541036979CA:1 33978346B6561BF28959244BE1CE4CDAAEA:2 3450EB7DA4296AF3458C7ED3DAB62243D95:2 355E4670416E53887B1876B8C98F3958F73:2 3590148DE4FFB4A31384C2F88DB1E043DC2:9 37389ED6092FA06690AEEDE4ED2630541E4:2 37468FD8D42038EEA23E98BE6D962F1ABCF:9 38608D6012F25E8963BE2B8BA0A6BE20D0E:12 387B78E43B006DD40121EB39844D1E72445:1 3884A27824CFEA69ADA4D255682871585F7:17 38B6D136029E5729ACC76D5BF3F04BFF785:1 396028FB0D5CA885D5D832D6BAED526FB2C:2 397249BB1CD9BCE72107BEAE4ACA72C3ACB:2 39ED15BF5EB200FC85DE650CE94A03E3C89:4 3B57ABD02E77BAD30D6554DE2BF85E94041:1 3B9481F2F95E5304C6FE76BBC6C986100C4:2 3C4A8A59AFA8D9715B5E583E00EDBCF537E:5 3C70E1F8B1FD34E2A359FA9B3CBE3B4CDCB:13 3C770D319CB6CDBCBA52107C7E6B9C41B8F:6 3CDA3DBD91503DF5D0614AB2262D6F7BD7C:5 3D477BD978C16590151A200DB7DDC1B08C0:1 3DCB3915D02D4773791EF7245531529C6DC:3 3E28783B84A393041D3B5A40E2D0AFAC9ED:1 3ECE7E8794ED029F801F3F16212259A9A0A:1 3EF396196869133E0345B5363622C329622:2 3EFBF7342ECCF7C9A0472A3DC888342E849:2 409A55DB312EFAED0C60D79C820123857ED:4 40C479428CA2E2A17C62E3EC9A8D1263D3B:7 40CE9A7B9B8E58542678800A6C623E9A13A:1 40E66F71BEA945D1124A204E94E56DBDD4C:4 4161134763027BF30812D76BD89CEEE4313:1 42C4F4E94CDEB8C2E59DCB2B71C52AAFECE:1 42DD8371560C9A999D5A83B0F9B62A1C232:2 43355AF1376084DDAACE8E48DDD1B301358:2 43379662DD408EB8BEFD7FBDC7BA139C7ED:3 446401FBEDC423BFECA860CE2515FEBBC64:1 44AFD5CF7AD0D3A18955ED037AB4B104E34:2 45C626376FA22BF7C3961A93BCBC7715BBB:2 463F55F95E6C74F72BC0DC2A0549309AD9B:1 465EE874FD8477775A92EBFB48DDCFE8F69:1 468E11280C3DBE4205933675F32B5C5315E:2 46F017EAEF24880BD83882BE05DE5EBA7E4:4 472C8500206084F880FB704A0CC765FCCA8:1 480855A5D696E7DE951245F6CDC1FFA99A9:1 48D6E8F7D39CDC429F7DA1F210D275D43D4:3 491104F690968038C0B8B5B907A7666E17B:2 4944FD7BED9E76CCB8D50A24801F417ABD1:4 49D63F70FA89FCBD865EC380E730A54536F:1 4A323CA77F38E34E252F803F2312685BBD0:1 4AB15955A6DFD23CAEC36007DB965A25D3E:2 4C1000B69FF96A38A93233F52AFD74A7FF5:2 4EF189AE5F0FD8689E0509B3B83FCCDA065:2 4F486BBEB886416124D743C74E38C355312:6 4F51C90CECFA4C93845D0EF912FFD0D53AC:1 5055B063A6E2B656CE5CC828C94C0A2C651:7 50F3EA256B13AF3586EC3E0880B46B330DB:1 51C5D06F1DA3868A4B45C2AC0C13F01A88C:2 51DAB3BD2CA5BC5A12C993E7DD7524D1FDA:1 5217430F9EB15C5B259CC1295CDEC750C99:6 538A1DF282AA1481EEB8F01C49D1E3332C1:1 539644701B53DA1028396158EF490262D2E:1 53A961DF595D1F80524CE7900A1E107A941:2 541DF822567128E98BBA210E1731DF674B4:2 5636DD61E40C8F333BED313CC55985C3260:3 566A7551FF3B83FF511F03BD7645804DBED:3 56A7653412B2196E8F02FD5E8480AB1C3C3:3 56F33A2F2128D42390781BBC1C6C5EA49FD:3 56FD3E50D21610EC46A12B340029D1540B5:2 574B768EEFFC32593DB817E3F9458419749:2 57986A405A70D478AB818EFBE13C8EAF01C:2 5859DB0C43EBAFFC1E7DEA8D8AE68ABBD61:4 58E0B742240BA78B772D03F794769438E62:3 5902ABB6A4C0A3C6C3AAD69318F57E67E65:1 593C0D6F2724CA9FD459AF544675EB2E8F5:126 595045AA5C037CE7A8907D42CD503056665:1 59C69A1E90A3F364BB6AB1CFE1F58B75759:4 5A04A0727E35212BF3E288F18270DD44BD5:4 5B2DF0E6DA6BC2F7CE46CB4606FBF668AB1:1 5B64978270EDA41C9A61508311FBDE8BFC1:25 5CB66D04DA973AD381AD05AD3038FE9F652:2 5D1374FEB99CA2A30F627ACDA10CA35B696:8 5DC2E3F67289C38E38B8C6146C6C7F7DA87:3 5DD805E17DF4EAB9C79EAFA19505C846897:1 5E538E772E0E22DD0D1C2D323A8BC99FA82:1 5E59EBE6A72FA70DFE43B33D94541CB0DC4:3 5E64136CB77DF3B966D7ADA29BED55D7E3B:1 5EB24DC67AFCF404356C5ABB3F21694996A:4 60910CCED1542070FD763D0D80770F0BC39:3 61386005F28E1075FDE5AD6DDCC4D7D1698:1 613EC92793236C177F974873C3EB036E2E7:2 61475F6084609C6EA4906CC7A9DA850143B:3 61E3FDB7C1CF0B50AC71B0CAC440C4C2477:2 62C275DCF82C3BEB093E660F1120F0AFFCD:3 6324BCA826D133A71F76C5F6F6E5B3996E6:2 64633DF62221D46785D4C26260410CECFAC:4 647AA3891B535634E4B58145DA0292519E2:2 64DE389A3D54055DE2CA03D034A65B49E4D:5 64FA823B43C0F2A10A8AE16437376087241:2 6607D9E12D84C34DC8A1FE0C09F9C928DA5:5 6608605DEC3D88121D9119D3DCA546D0345:8 66BF6FE5F2BD89C8583488439F2AE034E1A:1 66FC2E0A6800E87F2110855DF4E86306D2A:1 689FBEC7FB47CB8A27E2EAA2F4B0C20FD26:1 68AB3477559D2B2966B59CA0F415D34E269:2 6AE8FC557EA95FBAD0899F5D89AD678D53F:2 6B50E481DCAF2AB70165F1F08AEF0BAE214:2 6CB8817293485D7D697729392E69885E810:2 6CC18441F64A6A3912B75F13269EC30BCB3:3 6DBA67B08191E1DAA5060658A34F3927D4A:1 6DC6A584342A36967BB7E8860B9FAE6A063:1 6DCD4A4C28AE5B324026C7F3FFB34E92514:2 6E0D373F6981BD47930F4A56C4C7E08155A:1 6E43B226EBBE36A9A7175B81E94A6A17120:3 6E5E01883CE777D41286AE822A96E1D31F5:2 6FA57594BC01BD05E66E8A3CCD246D1BD33:1 7118901357A7F1C26B5A7D5BBBCEE746A31:1 71AA924424D3AC16DD1E8F38B9BABF8CC66:2 71F2EBDD6D5F226ED8A2B1B2C96A8AFBDFA:2 72812979401206FCAE9365548D965254DCE:1 73AF3A4B50CDC1D33AC0486058B91E81C6D:1 741D40D547B37A948D99A2174B04366EB14:3 74439891C8FED22022532967E48971AA2C3:2 74B6B8D03B94856084B0461DCF457DD8579:10 74CA186B0BBF7B6411C83C49179C9706E9F:2 76E30736CB99547A786CD23872E47726875:2 7712EA10BD04D77052785EBD04B306E262F:1 77170C450D3F8453751CAC0AD43ED8D4CE2:7 780D1679417E51653947DD0D0B0D20462F8:2 78AB0D277B5B67714F481E086E82102710B:2 78BC3B1E5570B2FD901B72ACCC5EA4E07D1:1 79777FEE6AD7AB97E7F2815C38D2105B23E:3 7A556B54F85B14A4EA4B855D567722ECFB6:3 7A936EE328C6906F08245F74657D42E690E:5 7A9FD995B65CB90D652AFA629EA4EB9B75E:2 7BEF7CD90527CDD45AE57FD54D0982121C7:3 7BF11C5E1AA98A9773C1EC6CD49C8C92EB8:2 7C38F34FDCBF65D8818DB0F11CA2E0D1DB6:1 7C513186CA452C9D04E50AE4CF2A99F49E6:4 7C6EAC3A4B5691F231EB89B43D92DF3E212:2 7DCB092016F7988A52026764BAD7B16E9B6:3 7E649081A3D86EF4D54DCE71635D76923B6:1 7F52B3BA9470E5E2FD3A80C689B4A7202BB:1 7F85C62E818FC95FEABF63A6567EFD82C14:1 7FA01144F7D9DEF6EEDFD4C95449BE604AE:3 80553EE51F892A6253D750C9664297BD2D2:1 81E21C305EC0861C99F99BFF50035DA5714:1 824D7FFBF7FBD80C57526190054EE2FAF94:4 831174A845D467869948EFB0D55FB0EAB16:4 83CC74FB6BD9DCC15A0C8B7AFDEA28EAF5C:1 846B3DE3A043DBA21279917F1075F1C87DA:12 8506A8BFDA9146551AC965FAF0EE33CCB1E:4 85588793E2BC7CDDD91FD2EE6687767C625:1 86204767D950BC178752B789250FA1951A7:2 866AE5C9B47EE9799FA9DE8287EE5F92160:1 86813A557CE096216F2C789C8B5B38ACC1C:4 873543B8084458A5A8D64D7A037BE237EB6:5 87F29D9004A062DF6C3E5677A7B9E51700F:8 88650F85CE60D59336B7B550C8DED7C1629:2 88D9AF4E55A9003404D438488CCBA254255:2 8963045DE4AF6B497C6A44D235927AA06D4:1 8A03958ED504BCC270351A222275F694D1B:1 8B1439F16867B8970AAA8F5887D71961C9B:1 8BAA0A48822C8C4D2E2CC8DB100EBD4CC10:2 8CB5BBE983314E9D51A87F15DFBDDD208E1:1 8CFAC2AD594EA6973A394067FD90DFE4F4C:1 8EE74C747990A5383DFE98CB09903E2A441:12 8F61FC0B22A1ED668B0C38AEACF6BBBD532:2 9067848425AC6E3A99230338B54E1B73ACD:28 90B830D465A3AD20610CBAC0DE1BBAB27AF:2 90BA96BF63F438682B411065984E23B42B2:1 90F504682DC0D621C73CB8D9DCA64DE2AD3:1 92FE443CD39E9FFC799DD00650DAD4506D9:10 93A61FB8F69A5615D50B28E6A19503CC4DB:4 955CDC3DAE4F9BC8D0DF682163E178A134A:3 9565C104761CB68D99A8B4908B1E1D8FC17:2 95A36EBB6B37416AB7F92ACD80725FA971B:2 95E12C96B61C1006B1260447CCFCE3E9AAE:6 960F3EAE324BDC39326F64F8B3C5B1C43B9:2 962009258BB125EF02F9420CBCDD84F0D7F:3 9715281C7AA292ED92EC05D659321307D63:3 97691DC92E99FD6A8AA581AF7999EA2CC40:2 979178F32F3E5B7F1B714C8EF77DA328C78:5 98A16185733ED923079E839E3C4074FD139:1 99CC23968ED935A2C0454593518559F5AC4:17 9A9D0D0EF781883CAFFAEB3DF2BE8FB0179:12 9AA8F765F6A0A2685F305A68A402A4F31CC:7 9AD24138A817EE75C9E430956AEA6FA73EF:2 9B2F3D4B7ED2FE150B19E19C1E819390240:2 9B4B775C9EC42C90038779AF44A377C84B6:4 9BADDB23F48B9CC14BB2181FC62E811F78D:3 9BBBB1EEACED3B52E54F44576AAF0D77D96:514780 9CA29FC04D017ED4C109EF2ADC5EF14024E:3 9DB80D391CBD1CFD17D5A712040EB4B765B:1 9DC907D1119E717AC968327DE3EE1990F07:2 9E4DCB22E470C51FE480892CF96E3429948:3 9E8B5853B50C2B6850CA76275297BC0CD87:1 9E9C6FD8AB732FC38F731AF781A37F05379:2 9EA3432A56A75EBB32F73979C78EE36623D:2 9F70C00BEA91DD60B38530D54F600E2B05E:28 9FF668FE9660EA15AF550390CC781E85C07:3 A1C813690B89FEC9CA7B1F235287DD427A4:1 A2349972A986FDDC945EEF0C600789349B1:1 A234C98FC53D10CE55BB39F1220D6F6E614:1 A2BF81A797268C1E9EEA46DAF3EC19BC518:5 A367F10C022C0D175CB268EC810A9E12A94:1 A38C0704396F36963376E241CF4EB81DC0E:2 A51C994BA20F97C3A1D8DBAD23E12561BB0:2 A5543BA889F421A2E4124A8F5664BCF692B:4 A556C58AD4AA4B8BBE7DD6CF5DE4B78194F:1 A564C4D44CBF6753E7928F4304905021C78:3 A651DFF1FF53D86CD6D34F6720BFE139749:2 A67D122777174A27DC88D2CA1A250CA6607:1 A7145F67B39B490C5DF37161F24DC4ABFB6:2 A84DF047119820B3820F08DE072D72D4CB7:1 A8BB8B130CBC8605E5937D198870F200899:1 A8C800803CC37B1BB71F0EE58D6405D1392:1 A8EBCCF466587BBEB4071DC3FE04EEF3AD1:2 A9081B97CC141FB26749004FF8988794724:10 A9C94C7821EF4F2BD36F9788B2364A94BAB:4 AC587B7B1CA81D53B69861F87B36B9EC394:3 AC90FBAB1F177D913F7B3E82EC4BAED9E3E:1 ACA267D4B1A7AD74789B12197898D6B8E9A:1 ACE918664FCCE918D4DE56D18489CCDFB46:5 AD917404A05A7E183B55DB1D22ABE39B1B1:3 AE452C1905A0DCA7F2718552E70CADDDEA8:5 AE6F8885070746C5C36C46A413007A59335:3 AF6B7DEC97D3E0B09236BEA120D6580C30D:1 AF701031143661DA7F853554E82E71AF7E1:1 AF70E78F0FCBF7EF2C9D0F2FA4DFA3FCF1F:1 AF755BEA42C6CF817A7DCC608C8F0642E47:3 B1CBB503ADA165C2266661953368C31F20B:4 B1DC12029E01A8054DD6A82B1BC4919E5FA:2 B1DC948D79F8306A298BA78A8B38410BEF4:1 B2A164DA818387688192D9A6FE5141F2881:1 B2B80E721E97330384C346A701FE35C2955:4 B47348CADC38957691A36D185039B799ECE:2 B5C7BB5BB17BB32B383DCA3259E259176C2:1 B61BD6CFC7D9F44361DFB1D3399C2F9EE4E:8 B74D785244C6C47D00F9B9589BA0E433994:1 B7A224C1F6CBBFAC4D5BBF2543893EDCF23:5 B83B74383253A1269F52C5CCA266CCB3C9A:1 B8B3478F96E0E598A39E8C61A6985970524:1 B8C6D3EF2DF858F8980455A01172E6DA239:2 B8DD367330758BCFD57716F0F8F64390843:1 B8FC47BE9A4D0B2540534C7C38583F754DF:1 B93D561BFBDF00C23545D1F03B562CA1DB5:2 B9712D9D3AC1D555D0BEBF147BD17511B5B:3 BA3290DA02BEF4A008843E97309FB815146:3 BAA8401AA6F7245312CCBB2F1752B22D86D:2 BAE0A09F1F00AE97A0FE13B55B766062637:2 BAF573F6C3D5B0C5AB0558CBC5B02AEFDAE:3 BC00635F1CB1A87D9205E6C0E8091785105:2 BD6F4F1B69B2196B5C6CF033718F574EC07:2 BDB1DDCC228BE9F7FB35EEF6AF5113AF73E:4 BE146DED014E4D1F66D577D2D14D8135DF3:1 BE70DCBAE2F79C46225CB2B9BDD65F1AB3A:4 BE90622F1FFCC28BA2C7A0AC039643B4C54:27 C02C14DE7103830953582B7393D71A32EC2:4 C065390F044A0733C62EFFD26C7BC9E5C0A:4 C069578DF1863522C57972C993C74EDA915:2 C17EAB25AA71E786892A6EA72B0966AAD6A:1 C1ADA5AD77F58D11542594DE65BCE3D1EDF:1 C1BFC70CA9C7A42528493171C882FA7C417:3 C2E0DF0AE878FF0FAC08D2C289833B51E58:2 C2EE82E916065EE6D864F275F311ACE61C9:10 C342BDFB47690A964704AAA2271A725CCE7:4 C383EBB71D19EC43FE5AFE35258E754DDC7:3 C3C95C722170002A1AD91D143E180EAB1E7:2 C40BA356F488EF52E2396A2E46569DD768F:2 C427749A32159BD6D7CD8B2ADF92FB1F832:24 C42B61033860FE10F17A4FA7FD99C9AC833:9 C447BAE41CB8EE62527EB64A6F5FE9CF478:1 C46C421AA6A899409ABA61633BDA8D66972:3 C64BB58C11AC8FCF9EEE1D520A6BF627B78:2 C67266A679B412A4BB4A3C6008A7B9DAA87:1 C71ED4BADEBE21EDE7AC71A8FED4F52008E:1 C803ADE6E741B4D5851D712047DF03FBD36:3 CA2F8699ADC9CAC35D6751970EFC11A4273:1 CA5C3E40B7F064088261816AD2888EB9B5E:1 CA81B22EC34A8DD2D112BE8A8BD9F56D100:2 CB16866ECD76A98EEA229DF3D79EA89B3D6:4 CBCBF62F09255D7BBA936414ECED1A67BA0:4 CC98AB04707CD69D15C388DA10AA56679F1:1 CCA035AA895B0EA8188F1CBC7804A8CAFC2:1 CD34C7E8CA4E4618D5CCB9EAC5557C3E30A:2 CD7D00C4A077103B1963DC634F165D7F0BE:1 CD82178053185D54C63C43D726A8561C525:2 CE952275CB4048AD5557A578182F946ACE9:2 CF05ADEEC343EF4344A3E9E7791B0786ED3:2 CF88AD9C21E356F0E508AB2B9B1034AB4BF:1 D00CF8A1BAF5D4B98DF2F93E229BE6A1504:2 D11041C636E15B723A67AB06393481922E7:8 D1ACDBBCC31EDB46C17BBB18A52EC9AC84A:1 D36BD2C30C77F0579246E51EB0C9CA15F3F:2 D412374C03007172DC190D1041BC624A987:2 D473AF390CE7667A7150AA79DCD36F4770D:2 D49C0B15FD180F4888FC7BF039B066E03BE:5 D5D25E77982F28739452CCB9B78C8A179FD:1 D65861F0BBEFB5EB0FE0D5318A1BF0F9FDC:4 D6CD8865B7B37E3780AFF1B17D028D406B7:2 D71FB1FCE65FBAAD5ED83C39509A922FC46:2 D79A244777E6E96C0C2597C273C4C03C54F:3 D7ED8EEB37E8EA3B7E7A94C7FC9A6D669E9:2 D7F077C52487CCEAA92ADD2B0C6EB01F384:1 D80D5E2950FB9B1176D91A7B05DA9B2DD58:1 D87A63C6B084CE5A490C3C58F5CD21A4CCE:2 D8C641931B0532C3AF145A7269BD3D13751:3 D94FEF8F82FB19C79125D8A6C241EE21659:7 D9BBFA213D99BCEB24D105F60883772BB28:1 DA30A95C801D6DAAC206774F550BF9A3780:1 DA8485F5355CA5897505FF131A4FBC5689C:1 DB4AB6C872594C86DE61952319D4E8113F1:1 DD54432092FE8AF9A9989A671CF30F41453:1 DD8827FDAE633D8C3DDE92CE340448C5FC0:2 DD900A16EED4ABBCED95727A6ADA1768DF1:2 DE911C5A4E78C1724BF9781B3D7CDC1A876:8 DEB6D6BF137BE132DBC7A2460972887F2F4:1 DF14FB996ECC3AA5D2F8C4A6D0E58B619DE:1 DF72602EE2EBC8AA211AD19E0AE99CD3C79:1 DFA04413E112FB760E5F63FDD1101D66D7B:4 E00198653017C8A9FEF5692FA9A34FE56F2:2 E050DDE60C393C83837491D8506B6CDE13C:11 E0E34404EEB668C870BE21100BE2D93C3D4:2 E0F399997E6F9473478B3DA378104AF99CC:2 E12D8F3E9A5D7ED3619100FEC9E840891B9:2 E1EBD9264316BF61CF4A57220515629B914:2 E1FDE65F4AF0AEBE3E7BC1DF9E111258B9C:1 E226D1DC125529CA74AB35CE29CFB843AB2:4 E24AA431A18597225AFD480A09AD37E6EDF:1 E2B13A612DF68ED2E2A740F6A3762A1628B:3 E326FA55A7C9EDD8D3B65838EB5470A521D:6 E33DF201133C0ED09E04C1020ABEA0F3E06:9 E36466033C1B0888121BF02D918410A70E9:2 E366F1E21138C1487E77F3032D80BEB377A:2 E52067FB4CE0B7E26B9E4BB307B26CC9254:2 E65D96D93846AB37052F5D26DFCA82A3B20:5 E66296ED8E76E1164C45ABF5D505CEE5C96:4 E66831A66807F98D0B589FC1D2EC7B5025C:2 E6E4819C437B5B4CC7C3613FC0FEF92777B:4 E7149CC9CAAB44B75BEEEDFC2DB911B220C:1 E742FCC827D15E2E3C0C16A8D123E923B4B:2 E80D4052DC51EB0FF0E24272966F0A6D9B8:1 E8A013C059CE52F9ACF4D846B1ECDF2A4A7:1 E8BAE5966D8B08DC4A4688044A37C506B09:5 EAF279A80A926293110FDCE5F4D5B666131:4 EB1169745BFB899D08CC201CAE987A82EDC:1 EB2F9AE57CEB1526DE1ECFEE5FAB2F2C134:3 EC3428101C99E3DD004C30118F26BB933F8:1 EC48CC72308314F0D83BC34413082658709:2 EC5EE696325A6E43E3113739E5FB457625E:2 EC7DCAA7F5A26724F16FF9B5238ACD43C0B:1 ECA8984DDEB11D75081EA10F8B92105466E:6 ED0B255C69A349D6A26DE71FFA8E374C429:1 ED330B743D94014E7431F1B1030EFACE4DF:2 ED6A73D7532F3F1EA9F9D5CA10C7553C6E4:11 ED909FB31E41C764FB7AFEF09EB4B60E76F:2 EDC47316ED80259983A280379829565DEF9:2 EDF816C5AB148DDF8F478F83656AAC7127A:30 EE85BA2F1E4E589CE6BE41542A950278E00:2 EEA8C1A6750C8F8A856BDEC098D8DBFB994:2 EFAF45F12963B29F3C515917B5F7B217D20:2 EFCE4F6E54E4E6CECD1FCDE54AE1E5536B6:3 F086DD2F38003DFE50E523875FADC2B8356:1 F0BCEB3CC0350941574E0704A743939266F:3 F10E05B0D4D94EEF84B9DA3DD0D59B17D55:6 F156D5216AE61BE9DC244114E803DE5B870:475 F1B9479ADE5FE0EBBAB138A45D3001958A8:2 F1F139F40FB8CD86725F9A9FE635D431150:2 F21A06E40A14623E79EDCC798EFF5B34743:5 F2478367D4B3264811BD74D9401E34E331D:158 F2E8204B0F5C21CB7B878879642B16C79C8:5 F35D472DB8E0FF810D76AF3EAF68C6192AB:1 F3B18D1F588210C0430A52F8C5E25298521:2 F41FCC62A47725102AABD806F4226E0D3BF:1 F42B67E0378DC81A7AF84A76814B6FFFEAD:1 F4A948CFFC3EA827CFA0BE4C3FC666E3724:1 F4E8C571660587A612F0F7828BD4053036B:4 F4F8CA8882862BE5E7FE4EC41CD17C315BD:3 F6121069443D63BD16E1C8DD8461F4E66DE:1 F6417F38A1431A6C526ABDF2CF795D00391:5 F6A3FA911781DEFC57D94A0DEB28B972AB1:7 F7222846AFA839F746C659D50F8DC382A56:2 F768DA97EB02A921AD864D28166DE257678:2 F7C663A1BD8D52A52E69CCC642CFBDC8FE8:1 F877BAC857742968E442A8A6972E2975D60:4 F9398A82D8DB3DB65145284E201BD73009D:2 FA3719FBE7A40DD97C7DB8ECC5FA675C705:2 FA7F650EE5C7FC09025A8E9319C44E08E0E:1 FAEF4F3518F723115DCFE1A411F79C72C67:1 FAFEF4FCB684EEB28553D23ECAA7391B037:2 FBA1245A47B13B5EDED9FC2BF805F246FE9:1 FC07D1D2A1070A50D96FE7CF9DFFE44BEC0:6 FC51D20F3F227A533924F7314FC7DB28A97:1 FCB4D5332B740D1A60C6FCAE2D169A61F8A:1 FCCFFDC0EB33DDDA658369682C08B5B872F:4 FD2F6A8A5ECA0EDAB1A739FFD01ABB6213D:2 FD39BA245AE25049AE80F67CAE0C82E8196:1 FF2FD2B9B042840F2957F6583D5EE2D3CDE:3 """
elm
[ { "context": "trings here.\r\n\r\n@docs Config\r\n\r\nCopyright (c) 2016 Robin Luiten\r\n-}\r\n\r\nimport Date exposing (Day, Month)\r\n\r\n\r\n{-|", "end": 241, "score": 0.999866128, "start": 229, "tag": "NAME", "value": "Robin Luiten" } ]
src/Date/Config.elm
altworx/elm-date-extra
0
module Date.Config where {-| Date configuration. For i18n for day and month names. Parameter to Format.format* functions. There is scope to put in some default format strings here. @docs Config Copyright (c) 2016 Robin Luiten -} import Date exposing (Day, Month) {-| Configuration for formatting dates. -} type alias Config = { i18n : { dayShort : Day -> String , dayName : Day -> String , monthShort : Month -> String , monthName : Month -> String } , format : { date : String , longDate : String , time : String , longTime : String , dateTime : String , firstDayOfWeek : Date.Day } }
13490
module Date.Config where {-| Date configuration. For i18n for day and month names. Parameter to Format.format* functions. There is scope to put in some default format strings here. @docs Config Copyright (c) 2016 <NAME> -} import Date exposing (Day, Month) {-| Configuration for formatting dates. -} type alias Config = { i18n : { dayShort : Day -> String , dayName : Day -> String , monthShort : Month -> String , monthName : Month -> String } , format : { date : String , longDate : String , time : String , longTime : String , dateTime : String , firstDayOfWeek : Date.Day } }
true
module Date.Config where {-| Date configuration. For i18n for day and month names. Parameter to Format.format* functions. There is scope to put in some default format strings here. @docs Config Copyright (c) 2016 PI:NAME:<NAME>END_PI -} import Date exposing (Day, Month) {-| Configuration for formatting dates. -} type alias Config = { i18n : { dayShort : Day -> String , dayName : Day -> String , monthShort : Month -> String , monthName : Month -> String } , format : { date : String , longDate : String , time : String , longTime : String , dateTime : String , firstDayOfWeek : Date.Day } }
elm
[ { "context": "Model Medium intro\n\n\nintro : String\nintro = \"\"\"\n\n# Anna Karenina\n\n## Chapter 1\n\nHappy families are all alike; ever", "end": 638, "score": 0.9998347163, "start": 625, "tag": "NAME", "value": "Anna Karenina" } ]
examples/IO/RadioButtons.elm
chrilves/elm-io
38
module IO.RadioButtons exposing (main) {-| @docs main -} import Html exposing (Html, Attribute, div, fieldset, input, label, text) import Html.Attributes exposing (name, style, type_) import Html.Events exposing (onClick) import Markdown import IO exposing (..) {-|-} main: IO.Program () Model Msg main = IO.sandbox { init = \_ -> (chapter1, IO.none), view = view, subscriptions = IO.dummySub } -- MODEL type alias Model = { fontSize : FontSize , content : String } type FontSize = Small | Medium | Large chapter1 : Model chapter1 = Model Medium intro intro : String intro = """ # Anna Karenina ## Chapter 1 Happy families are all alike; every unhappy family is unhappy in its own way. Everything was in confusion in the Oblonskys’ house. The wife had discovered that the husband was carrying on an intrigue with a French girl, who had been a governess in their family, and she had announced to her husband that she could not go on living in the same house with him... """ -- UPDATE type alias Msg = () switchTo : FontSize -> IO Model Msg switchTo newFontSize = IO.modify (\model -> { model | fontSize = newFontSize }) -- VIEW view : Model -> Html (IO Model Msg) view model = div [] [ fieldset [] [ radio "Small" (switchTo Small) , radio "Medium" (switchTo Medium) , radio "Large" (switchTo Large) ] , Markdown.toHtml [ sizeToStyle model.fontSize ] model.content ] radio : String -> msg -> Html msg radio value msg = label [ style "padding" "20px"] [ input [ type_ "radio", name "font-size", onClick msg ] [] , text value ] sizeToStyle : FontSize -> Attribute msg sizeToStyle fontSize = let size = case fontSize of Small -> "0.8em" Medium -> "1em" Large -> "1.2em" in style "font-size" size
51
module IO.RadioButtons exposing (main) {-| @docs main -} import Html exposing (Html, Attribute, div, fieldset, input, label, text) import Html.Attributes exposing (name, style, type_) import Html.Events exposing (onClick) import Markdown import IO exposing (..) {-|-} main: IO.Program () Model Msg main = IO.sandbox { init = \_ -> (chapter1, IO.none), view = view, subscriptions = IO.dummySub } -- MODEL type alias Model = { fontSize : FontSize , content : String } type FontSize = Small | Medium | Large chapter1 : Model chapter1 = Model Medium intro intro : String intro = """ # <NAME> ## Chapter 1 Happy families are all alike; every unhappy family is unhappy in its own way. Everything was in confusion in the Oblonskys’ house. The wife had discovered that the husband was carrying on an intrigue with a French girl, who had been a governess in their family, and she had announced to her husband that she could not go on living in the same house with him... """ -- UPDATE type alias Msg = () switchTo : FontSize -> IO Model Msg switchTo newFontSize = IO.modify (\model -> { model | fontSize = newFontSize }) -- VIEW view : Model -> Html (IO Model Msg) view model = div [] [ fieldset [] [ radio "Small" (switchTo Small) , radio "Medium" (switchTo Medium) , radio "Large" (switchTo Large) ] , Markdown.toHtml [ sizeToStyle model.fontSize ] model.content ] radio : String -> msg -> Html msg radio value msg = label [ style "padding" "20px"] [ input [ type_ "radio", name "font-size", onClick msg ] [] , text value ] sizeToStyle : FontSize -> Attribute msg sizeToStyle fontSize = let size = case fontSize of Small -> "0.8em" Medium -> "1em" Large -> "1.2em" in style "font-size" size
true
module IO.RadioButtons exposing (main) {-| @docs main -} import Html exposing (Html, Attribute, div, fieldset, input, label, text) import Html.Attributes exposing (name, style, type_) import Html.Events exposing (onClick) import Markdown import IO exposing (..) {-|-} main: IO.Program () Model Msg main = IO.sandbox { init = \_ -> (chapter1, IO.none), view = view, subscriptions = IO.dummySub } -- MODEL type alias Model = { fontSize : FontSize , content : String } type FontSize = Small | Medium | Large chapter1 : Model chapter1 = Model Medium intro intro : String intro = """ # PI:NAME:<NAME>END_PI ## Chapter 1 Happy families are all alike; every unhappy family is unhappy in its own way. Everything was in confusion in the Oblonskys’ house. The wife had discovered that the husband was carrying on an intrigue with a French girl, who had been a governess in their family, and she had announced to her husband that she could not go on living in the same house with him... """ -- UPDATE type alias Msg = () switchTo : FontSize -> IO Model Msg switchTo newFontSize = IO.modify (\model -> { model | fontSize = newFontSize }) -- VIEW view : Model -> Html (IO Model Msg) view model = div [] [ fieldset [] [ radio "Small" (switchTo Small) , radio "Medium" (switchTo Medium) , radio "Large" (switchTo Large) ] , Markdown.toHtml [ sizeToStyle model.fontSize ] model.content ] radio : String -> msg -> Html msg radio value msg = label [ style "padding" "20px"] [ input [ type_ "radio", name "font-size", onClick msg ] [] , text value ] sizeToStyle : FontSize -> Attribute msg sizeToStyle fontSize = let size = case fontSize of Small -> "0.8em" Medium -> "1em" Large -> "1.2em" in style "font-size" size
elm
[ { "context": "venenatis in euismod ut.\"\n , author = \"Marcia Hill, Digital Marketing Manager\"\n , avatar ", "end": 7035, "score": 0.9998939037, "start": 7024, "tag": "NAME", "value": "Marcia Hill" } ]
src/Components/Slices/FeatureSideBySide.elm
supermario/azimutt
0
module Components.Slices.FeatureSideBySide exposing (Description, Model, Position(..), Quote, doc, imageSlice, imageSwapSlice) import Components.Atoms.Icon as Icon exposing (Icon(..)) import ElmBook.Chapter exposing (Chapter, chapter, renderComponentList) import Html exposing (Html, a, blockquote, div, footer, h2, img, p, span, text) import Html.Attributes exposing (alt, class, href, src) import Libs.Bool as B import Libs.Html.Attributes exposing (css, track) import Libs.Maybe as Maybe import Libs.Models exposing (Image, TrackedLink) import Libs.Tailwind exposing (hover, lg, md, sm) type alias Model msg = { image : Image , imagePosition : Position , icon : Maybe Icon , description : Description msg , cta : Maybe TrackedLink , quote : Maybe Quote } type Position = Left | Right type alias Description msg = { title : String, content : List (Html msg) } type alias Quote = { text : String, author : String, avatar : Image } imageSlice : Model msg -> Html msg imageSlice model = slice model imageLeft imageRight imageSwapSlice : Image -> Model msg -> Html msg imageSwapSlice swap model = slice model (imageLeftSwap swap) (imageRightSwap swap) slice : Model msg -> (Image -> Html msg) -> (Image -> Html msg) -> Html msg slice model buildImageLeft buildImageRight = div [ css [ "pb-32 relative overflow-hidden" ] ] [ div [ css [ lg [ "mx-auto max-w-7xl px-8 grid grid-cols-2 grid-flow-col-dense gap-24" ] ] ] [ details model.imagePosition model, B.cond (model.imagePosition == Left) buildImageLeft buildImageRight model.image ] ] imageLeft : Image -> Html msg imageLeft image = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-1" ] ] ] [ div [ css [ "pr-4 -ml-48", sm [ "pr-6" ], md [ "-ml-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute right-0 h-full w-auto max-w-none" ] ], src image.src, alt image.alt ] [] ] ] imageRight : Image -> Html msg imageRight image = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-2" ] ] ] [ div [ css [ "pl-4 -mr-48", sm [ "pl-6" ], md [ "-mr-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute left-0 h-full w-auto max-w-none" ] ], src image.src, alt image.alt ] [] ] ] imageLeftSwap : Image -> Image -> Html msg imageLeftSwap swap base = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-1" ] ] ] [ div [ css [ "pr-4 -ml-48", sm [ "pr-6" ], md [ "-ml-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ span [ class "img-swipe" ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute right-0 h-full w-auto max-w-none" ] ], src base.src, alt base.alt, class "img-default" ] [] , img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute right-0 h-full w-auto max-w-none" ] ], src swap.src, alt swap.alt, class "img-hover" ] [] ] ] ] imageRightSwap : Image -> Image -> Html msg imageRightSwap swap base = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-2" ] ] ] [ div [ css [ "pl-4 -mr-48", sm [ "pl-6" ], md [ "-mr-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ span [ class "img-swipe" ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute left-0 h-full w-auto max-w-none" ] ], src base.src, alt base.alt, class "img-default" ] [] , img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute left-0 h-full w-auto max-w-none" ] ], src swap.src, alt swap.alt, class "img-hover" ] [] ] ] ] details : Position -> Model msg -> Html msg details position model = div [ css [ "px-4 max-w-xl mx-auto", sm [ "px-6" ], lg [ "py-32 max-w-none mx-0 px-0", B.cond (position == Right) "col-start-1" "col-start-2" ] ] ] (List.filterMap identity [ model.icon |> Maybe.map featureIcon , Just model.description |> Maybe.map featureDescription , model.cta |> Maybe.map featureCta , model.quote |> Maybe.map featureQuote ] ) featureIcon : Icon -> Html msg featureIcon icon = span [ css [ "h-12 w-12 rounded-md flex items-center justify-center bg-gradient-to-r from-green-600 to-indigo-600" ] ] [ Icon.outline icon "text-white" ] featureDescription : Description msg -> Html msg featureDescription d = div [ css [ "mt-6" ] ] [ h2 [ css [ "text-3xl font-extrabold tracking-tight text-gray-900" ] ] [ text d.title ] , p [ css [ "mt-4 text-lg text-gray-500" ] ] d.content ] featureCta : TrackedLink -> Html msg featureCta cta = div [ css [ "mt-6" ] ] [ a ([ href cta.url , css [ "inline-flex px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-gradient-to-r from-green-600 to-indigo-600", hover [ "text-white from-green-700 to-indigo-700" ] ] ] ++ (cta.track |> Maybe.mapOrElse track []) ) [ text cta.text ] ] featureQuote : Quote -> Html msg featureQuote quote = div [ css [ "mt-8 border-t border-gray-200 pt-6" ] ] [ blockquote [] [ div [] [ p [ css [ "text-base text-gray-500" ] ] [ text ("“" ++ quote.text ++ "”") ] ] , footer [ css [ "mt-3" ] ] [ div [ css [ "flex items-center space-x-3" ] ] [ div [ css [ "flex-shrink-0" ] ] [ img [ src quote.avatar.src, alt quote.avatar.alt, css [ "h-6 w-6 rounded-full" ] ] [] ] , div [ css [ "text-base font-medium text-gray-700" ] ] [ text quote.author ] ] ] ] ] -- DOCUMENTATION dsModelFull : Model msg dsModelFull = { image = { src = "https://tailwindui.com/img/component-images/inbox-app-screenshot-2.jpg", alt = "Customer profile user interface" } , imagePosition = Right , icon = Just Sparkles , description = { title = "Better understand your customers" , content = [ text "Semper curabitur ullamcorper posuere nunc sed. Ornare iaculis bibendum malesuada faucibus lacinia porttitor. Pulvinar laoreet sagittis viverra duis. In venenatis sem arcu pretium pharetra at. Lectus viverra dui tellus ornare pharetra." ] } , cta = Just { url = "#", text = "Get started", track = Nothing } , quote = Just { text = "Cras velit quis eros eget rhoncus lacus ultrices sed diam. Sit orci risus aenean curabitur donec aliquet. Mi venenatis in euismod ut." , author = "Marcia Hill, Digital Marketing Manager" , avatar = { src = "https://images.unsplash.com/photo-1509783236416-c9ad59bae472?ixlib=rb-=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=8&w=1024&h=1024&q=80", alt = "Georges" } } } dsSwapImage : Image dsSwapImage = { src = "https://tailwindui.com/img/component-images/top-nav-with-multi-column-layout-screenshot.jpg", alt = "Basic text" } doc : Chapter x doc = chapter "FeatureSideBySide" |> renderComponentList [ ( "imageSlice", imageSlice dsModelFull ) , ( "imageSlice, imagePosition left", imageSlice { dsModelFull | imagePosition = Left } ) , ( "imageSlice, no quote", imageSlice { dsModelFull | quote = Nothing } ) , ( "imageSlice, no quote, no cta", imageSlice { dsModelFull | cta = Nothing, quote = Nothing } ) , ( "imageSlice, no quote, no cta, no icon", imageSlice { dsModelFull | icon = Nothing, cta = Nothing, quote = Nothing } ) , ( "imageSwapSlice", imageSwapSlice dsSwapImage dsModelFull ) , ( "imageSwapSlice, imagePosition left", imageSwapSlice dsSwapImage { dsModelFull | imagePosition = Left } ) ]
13298
module Components.Slices.FeatureSideBySide exposing (Description, Model, Position(..), Quote, doc, imageSlice, imageSwapSlice) import Components.Atoms.Icon as Icon exposing (Icon(..)) import ElmBook.Chapter exposing (Chapter, chapter, renderComponentList) import Html exposing (Html, a, blockquote, div, footer, h2, img, p, span, text) import Html.Attributes exposing (alt, class, href, src) import Libs.Bool as B import Libs.Html.Attributes exposing (css, track) import Libs.Maybe as Maybe import Libs.Models exposing (Image, TrackedLink) import Libs.Tailwind exposing (hover, lg, md, sm) type alias Model msg = { image : Image , imagePosition : Position , icon : Maybe Icon , description : Description msg , cta : Maybe TrackedLink , quote : Maybe Quote } type Position = Left | Right type alias Description msg = { title : String, content : List (Html msg) } type alias Quote = { text : String, author : String, avatar : Image } imageSlice : Model msg -> Html msg imageSlice model = slice model imageLeft imageRight imageSwapSlice : Image -> Model msg -> Html msg imageSwapSlice swap model = slice model (imageLeftSwap swap) (imageRightSwap swap) slice : Model msg -> (Image -> Html msg) -> (Image -> Html msg) -> Html msg slice model buildImageLeft buildImageRight = div [ css [ "pb-32 relative overflow-hidden" ] ] [ div [ css [ lg [ "mx-auto max-w-7xl px-8 grid grid-cols-2 grid-flow-col-dense gap-24" ] ] ] [ details model.imagePosition model, B.cond (model.imagePosition == Left) buildImageLeft buildImageRight model.image ] ] imageLeft : Image -> Html msg imageLeft image = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-1" ] ] ] [ div [ css [ "pr-4 -ml-48", sm [ "pr-6" ], md [ "-ml-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute right-0 h-full w-auto max-w-none" ] ], src image.src, alt image.alt ] [] ] ] imageRight : Image -> Html msg imageRight image = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-2" ] ] ] [ div [ css [ "pl-4 -mr-48", sm [ "pl-6" ], md [ "-mr-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute left-0 h-full w-auto max-w-none" ] ], src image.src, alt image.alt ] [] ] ] imageLeftSwap : Image -> Image -> Html msg imageLeftSwap swap base = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-1" ] ] ] [ div [ css [ "pr-4 -ml-48", sm [ "pr-6" ], md [ "-ml-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ span [ class "img-swipe" ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute right-0 h-full w-auto max-w-none" ] ], src base.src, alt base.alt, class "img-default" ] [] , img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute right-0 h-full w-auto max-w-none" ] ], src swap.src, alt swap.alt, class "img-hover" ] [] ] ] ] imageRightSwap : Image -> Image -> Html msg imageRightSwap swap base = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-2" ] ] ] [ div [ css [ "pl-4 -mr-48", sm [ "pl-6" ], md [ "-mr-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ span [ class "img-swipe" ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute left-0 h-full w-auto max-w-none" ] ], src base.src, alt base.alt, class "img-default" ] [] , img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute left-0 h-full w-auto max-w-none" ] ], src swap.src, alt swap.alt, class "img-hover" ] [] ] ] ] details : Position -> Model msg -> Html msg details position model = div [ css [ "px-4 max-w-xl mx-auto", sm [ "px-6" ], lg [ "py-32 max-w-none mx-0 px-0", B.cond (position == Right) "col-start-1" "col-start-2" ] ] ] (List.filterMap identity [ model.icon |> Maybe.map featureIcon , Just model.description |> Maybe.map featureDescription , model.cta |> Maybe.map featureCta , model.quote |> Maybe.map featureQuote ] ) featureIcon : Icon -> Html msg featureIcon icon = span [ css [ "h-12 w-12 rounded-md flex items-center justify-center bg-gradient-to-r from-green-600 to-indigo-600" ] ] [ Icon.outline icon "text-white" ] featureDescription : Description msg -> Html msg featureDescription d = div [ css [ "mt-6" ] ] [ h2 [ css [ "text-3xl font-extrabold tracking-tight text-gray-900" ] ] [ text d.title ] , p [ css [ "mt-4 text-lg text-gray-500" ] ] d.content ] featureCta : TrackedLink -> Html msg featureCta cta = div [ css [ "mt-6" ] ] [ a ([ href cta.url , css [ "inline-flex px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-gradient-to-r from-green-600 to-indigo-600", hover [ "text-white from-green-700 to-indigo-700" ] ] ] ++ (cta.track |> Maybe.mapOrElse track []) ) [ text cta.text ] ] featureQuote : Quote -> Html msg featureQuote quote = div [ css [ "mt-8 border-t border-gray-200 pt-6" ] ] [ blockquote [] [ div [] [ p [ css [ "text-base text-gray-500" ] ] [ text ("“" ++ quote.text ++ "”") ] ] , footer [ css [ "mt-3" ] ] [ div [ css [ "flex items-center space-x-3" ] ] [ div [ css [ "flex-shrink-0" ] ] [ img [ src quote.avatar.src, alt quote.avatar.alt, css [ "h-6 w-6 rounded-full" ] ] [] ] , div [ css [ "text-base font-medium text-gray-700" ] ] [ text quote.author ] ] ] ] ] -- DOCUMENTATION dsModelFull : Model msg dsModelFull = { image = { src = "https://tailwindui.com/img/component-images/inbox-app-screenshot-2.jpg", alt = "Customer profile user interface" } , imagePosition = Right , icon = Just Sparkles , description = { title = "Better understand your customers" , content = [ text "Semper curabitur ullamcorper posuere nunc sed. Ornare iaculis bibendum malesuada faucibus lacinia porttitor. Pulvinar laoreet sagittis viverra duis. In venenatis sem arcu pretium pharetra at. Lectus viverra dui tellus ornare pharetra." ] } , cta = Just { url = "#", text = "Get started", track = Nothing } , quote = Just { text = "Cras velit quis eros eget rhoncus lacus ultrices sed diam. Sit orci risus aenean curabitur donec aliquet. Mi venenatis in euismod ut." , author = "<NAME>, Digital Marketing Manager" , avatar = { src = "https://images.unsplash.com/photo-1509783236416-c9ad59bae472?ixlib=rb-=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=8&w=1024&h=1024&q=80", alt = "Georges" } } } dsSwapImage : Image dsSwapImage = { src = "https://tailwindui.com/img/component-images/top-nav-with-multi-column-layout-screenshot.jpg", alt = "Basic text" } doc : Chapter x doc = chapter "FeatureSideBySide" |> renderComponentList [ ( "imageSlice", imageSlice dsModelFull ) , ( "imageSlice, imagePosition left", imageSlice { dsModelFull | imagePosition = Left } ) , ( "imageSlice, no quote", imageSlice { dsModelFull | quote = Nothing } ) , ( "imageSlice, no quote, no cta", imageSlice { dsModelFull | cta = Nothing, quote = Nothing } ) , ( "imageSlice, no quote, no cta, no icon", imageSlice { dsModelFull | icon = Nothing, cta = Nothing, quote = Nothing } ) , ( "imageSwapSlice", imageSwapSlice dsSwapImage dsModelFull ) , ( "imageSwapSlice, imagePosition left", imageSwapSlice dsSwapImage { dsModelFull | imagePosition = Left } ) ]
true
module Components.Slices.FeatureSideBySide exposing (Description, Model, Position(..), Quote, doc, imageSlice, imageSwapSlice) import Components.Atoms.Icon as Icon exposing (Icon(..)) import ElmBook.Chapter exposing (Chapter, chapter, renderComponentList) import Html exposing (Html, a, blockquote, div, footer, h2, img, p, span, text) import Html.Attributes exposing (alt, class, href, src) import Libs.Bool as B import Libs.Html.Attributes exposing (css, track) import Libs.Maybe as Maybe import Libs.Models exposing (Image, TrackedLink) import Libs.Tailwind exposing (hover, lg, md, sm) type alias Model msg = { image : Image , imagePosition : Position , icon : Maybe Icon , description : Description msg , cta : Maybe TrackedLink , quote : Maybe Quote } type Position = Left | Right type alias Description msg = { title : String, content : List (Html msg) } type alias Quote = { text : String, author : String, avatar : Image } imageSlice : Model msg -> Html msg imageSlice model = slice model imageLeft imageRight imageSwapSlice : Image -> Model msg -> Html msg imageSwapSlice swap model = slice model (imageLeftSwap swap) (imageRightSwap swap) slice : Model msg -> (Image -> Html msg) -> (Image -> Html msg) -> Html msg slice model buildImageLeft buildImageRight = div [ css [ "pb-32 relative overflow-hidden" ] ] [ div [ css [ lg [ "mx-auto max-w-7xl px-8 grid grid-cols-2 grid-flow-col-dense gap-24" ] ] ] [ details model.imagePosition model, B.cond (model.imagePosition == Left) buildImageLeft buildImageRight model.image ] ] imageLeft : Image -> Html msg imageLeft image = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-1" ] ] ] [ div [ css [ "pr-4 -ml-48", sm [ "pr-6" ], md [ "-ml-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute right-0 h-full w-auto max-w-none" ] ], src image.src, alt image.alt ] [] ] ] imageRight : Image -> Html msg imageRight image = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-2" ] ] ] [ div [ css [ "pl-4 -mr-48", sm [ "pl-6" ], md [ "-mr-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute left-0 h-full w-auto max-w-none" ] ], src image.src, alt image.alt ] [] ] ] imageLeftSwap : Image -> Image -> Html msg imageLeftSwap swap base = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-1" ] ] ] [ div [ css [ "pr-4 -ml-48", sm [ "pr-6" ], md [ "-ml-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ span [ class "img-swipe" ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute right-0 h-full w-auto max-w-none" ] ], src base.src, alt base.alt, class "img-default" ] [] , img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute right-0 h-full w-auto max-w-none" ] ], src swap.src, alt swap.alt, class "img-hover" ] [] ] ] ] imageRightSwap : Image -> Image -> Html msg imageRightSwap swap base = div [ css [ "mt-12", sm [ "mt-16" ], lg [ "col-start-2" ] ] ] [ div [ css [ "pl-4 -mr-48", sm [ "pl-6" ], md [ "-mr-16" ], lg [ "px-0 m-0 relative h-full" ] ] ] [ span [ class "img-swipe" ] [ img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute left-0 h-full w-auto max-w-none" ] ], src base.src, alt base.alt, class "img-default" ] [] , img [ css [ "w-full rounded-xl shadow-xl ring-1 ring-black ring-opacity-5", lg [ "absolute left-0 h-full w-auto max-w-none" ] ], src swap.src, alt swap.alt, class "img-hover" ] [] ] ] ] details : Position -> Model msg -> Html msg details position model = div [ css [ "px-4 max-w-xl mx-auto", sm [ "px-6" ], lg [ "py-32 max-w-none mx-0 px-0", B.cond (position == Right) "col-start-1" "col-start-2" ] ] ] (List.filterMap identity [ model.icon |> Maybe.map featureIcon , Just model.description |> Maybe.map featureDescription , model.cta |> Maybe.map featureCta , model.quote |> Maybe.map featureQuote ] ) featureIcon : Icon -> Html msg featureIcon icon = span [ css [ "h-12 w-12 rounded-md flex items-center justify-center bg-gradient-to-r from-green-600 to-indigo-600" ] ] [ Icon.outline icon "text-white" ] featureDescription : Description msg -> Html msg featureDescription d = div [ css [ "mt-6" ] ] [ h2 [ css [ "text-3xl font-extrabold tracking-tight text-gray-900" ] ] [ text d.title ] , p [ css [ "mt-4 text-lg text-gray-500" ] ] d.content ] featureCta : TrackedLink -> Html msg featureCta cta = div [ css [ "mt-6" ] ] [ a ([ href cta.url , css [ "inline-flex px-4 py-2 border border-transparent text-base font-medium rounded-md shadow-sm text-white bg-gradient-to-r from-green-600 to-indigo-600", hover [ "text-white from-green-700 to-indigo-700" ] ] ] ++ (cta.track |> Maybe.mapOrElse track []) ) [ text cta.text ] ] featureQuote : Quote -> Html msg featureQuote quote = div [ css [ "mt-8 border-t border-gray-200 pt-6" ] ] [ blockquote [] [ div [] [ p [ css [ "text-base text-gray-500" ] ] [ text ("“" ++ quote.text ++ "”") ] ] , footer [ css [ "mt-3" ] ] [ div [ css [ "flex items-center space-x-3" ] ] [ div [ css [ "flex-shrink-0" ] ] [ img [ src quote.avatar.src, alt quote.avatar.alt, css [ "h-6 w-6 rounded-full" ] ] [] ] , div [ css [ "text-base font-medium text-gray-700" ] ] [ text quote.author ] ] ] ] ] -- DOCUMENTATION dsModelFull : Model msg dsModelFull = { image = { src = "https://tailwindui.com/img/component-images/inbox-app-screenshot-2.jpg", alt = "Customer profile user interface" } , imagePosition = Right , icon = Just Sparkles , description = { title = "Better understand your customers" , content = [ text "Semper curabitur ullamcorper posuere nunc sed. Ornare iaculis bibendum malesuada faucibus lacinia porttitor. Pulvinar laoreet sagittis viverra duis. In venenatis sem arcu pretium pharetra at. Lectus viverra dui tellus ornare pharetra." ] } , cta = Just { url = "#", text = "Get started", track = Nothing } , quote = Just { text = "Cras velit quis eros eget rhoncus lacus ultrices sed diam. Sit orci risus aenean curabitur donec aliquet. Mi venenatis in euismod ut." , author = "PI:NAME:<NAME>END_PI, Digital Marketing Manager" , avatar = { src = "https://images.unsplash.com/photo-1509783236416-c9ad59bae472?ixlib=rb-=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=8&w=1024&h=1024&q=80", alt = "Georges" } } } dsSwapImage : Image dsSwapImage = { src = "https://tailwindui.com/img/component-images/top-nav-with-multi-column-layout-screenshot.jpg", alt = "Basic text" } doc : Chapter x doc = chapter "FeatureSideBySide" |> renderComponentList [ ( "imageSlice", imageSlice dsModelFull ) , ( "imageSlice, imagePosition left", imageSlice { dsModelFull | imagePosition = Left } ) , ( "imageSlice, no quote", imageSlice { dsModelFull | quote = Nothing } ) , ( "imageSlice, no quote, no cta", imageSlice { dsModelFull | cta = Nothing, quote = Nothing } ) , ( "imageSlice, no quote, no cta, no icon", imageSlice { dsModelFull | icon = Nothing, cta = Nothing, quote = Nothing } ) , ( "imageSwapSlice", imageSwapSlice dsSwapImage dsModelFull ) , ( "imageSwapSlice, imagePosition left", imageSwapSlice dsSwapImage { dsModelFull | imagePosition = Left } ) ]
elm
[ { "context": " lastName : String }\nuserExample =\n { email = \"taro@example.com\"\n , firstName = \"firstName\"\n , lastName = \"", "end": 1397, "score": 0.9999086857, "start": 1381, "tag": "EMAIL", "value": "taro@example.com" }, { "context": " { email = \"taro@example.com\"\n , firstName = \"firstName\"\n , lastName = \"lastName\"\n }\n\n\n{-| -}\nclose", "end": 1427, "score": 0.9766128063, "start": 1418, "tag": "NAME", "value": "firstName" }, { "context": "\"\n , firstName = \"firstName\"\n , lastName = \"lastName\"\n }\n\n\n{-| -}\ncloseMenu : Header -> Header\nclos", "end": 1455, "score": 0.9238930345, "start": 1447, "tag": "NAME", "value": "lastName" }, { "context": "scription Tasty CSS-animated hamburgers\n * @author Jonathan Suh @jonsuh\n * @site https://jonsuh.com/hamburgers\n *", "end": 8033, "score": 0.9999011755, "start": 8021, "tag": "NAME", "value": "Jonathan Suh" }, { "context": "ty CSS-animated hamburgers\n * @author Jonathan Suh @jonsuh\n * @site https://jonsuh.com/hamburgers\n * @link h", "end": 8041, "score": 0.9988255501, "start": 8034, "tag": "USERNAME", "value": "@jonsuh" }, { "context": "jonsuh.com/hamburgers\n * @link https://github.com/jonsuh/hamburgers\n */\n \n .hamburger:focus {\n outline", "end": 8115, "score": 0.9988886714, "start": 8109, "tag": "USERNAME", "value": "jonsuh" } ]
src/R10/Header.elm
rakutentech/rakuten-ui
0
module R10.Header exposing (view, Header, LanguageSystem(..), Msg(..), Session(..), SessionData, ViewArgs, attrsLink, closeMenu, decodeSession, extraCss, getSession, init, languageMenu, loginLink, logoutLink, menuSeparator, menuTitle, subscriptions, update, userExample) {-| This create a generic header. @docs view, Header, LanguageSystem, Msg, Session, SessionData, ViewArgs, attrsLink, closeMenu, decodeSession, extraCss, getSession, init, languageMenu, loginLink, logoutLink, menuSeparator, menuTitle, subscriptions, update, userExample -} import Browser.Events import Color import Color.Convert import Element.WithContext exposing (..) import Element.WithContext.Background as Background import Element.WithContext.Border as Border import Element.WithContext.Events as Events import Element.WithContext.Font as Font import Element.WithContext.Input as Input import Html import Html.Attributes import Http import Json.Decode import Process import R10.Card import R10.Color.AttrsBackground import R10.Color.Internal.Primary import R10.Color.Svg import R10.Color.Utils import R10.Context exposing (..) import R10.FontSize import R10.I18n import R10.Language import R10.Libu import R10.Mode import R10.Theme import R10.Transition import R10.Translations import Task {-| -} userExample : { email : String, firstName : String, lastName : String } userExample = { email = "taro@example.com" , firstName = "firstName" , lastName = "lastName" } {-| -} closeMenu : Header -> Header closeMenu model = { model | sideMenuOpen = False } {-| -} type alias SessionData = { email : String , firstName : String , lastName : String } {-| -} type Session = SessionNotRequired | SessionNotRequested | SessionFetching | SessionSuccess SessionData | SessionError Http.Error {-| -} type alias Header = { sideMenuOpen : Bool , userMenuOpen : Bool , maxWidth : Int , padding : Int , supportedLanguageList : List R10.Language.Language , urlLogin : String , urlLogout : String , session : Session , debuggingMode : Bool , backgroundColor : Maybe Color } {-| -} type alias ViewArgs z msg route = { extraContent : List (Element (R10.Context.ContextInternal z) msg) , extraContentRightSide : List (Element (R10.Context.ContextInternal z) msg) , from : String , msgMapper : Msg -> msg , isTop : Bool , isMobile : Bool , onClick : String -> msg , urlTop : String , languageSystem : LanguageSystem route , logoOnDark : Element (R10.Context.ContextInternal z) msg , logoOnLight : Element (R10.Context.ContextInternal z) msg , darkHeader : Bool , theme : R10.Theme.Theme } {-| -} init : Header init = { sideMenuOpen = False , userMenuOpen = False , maxWidth = 1000 , padding = 20 , supportedLanguageList = R10.Language.defaultSupportedLanguageList , urlLogin = "/api/session/redirect" , urlLogout = "/api/logout" , session = SessionNotRequested , debuggingMode = False , backgroundColor = Nothing } {-| -} defaultTheme : R10.Theme.Theme defaultTheme = { mode = R10.Mode.Light , primaryColor = R10.Color.Internal.Primary.CrimsonRed } {-| -} type Msg = ToggleSideMenu | ToggleUserMenu | Logout | Login | CloseUserMenu | KeyDown KeyPressed | Click (List String) | GotSession (Result Http.Error SessionData) {-| -} getSession : Float -> Cmd Msg getSession delay = Process.sleep delay |> Task.andThen (\_ -> getSessionTask) |> Task.attempt GotSession {-| -} getSessionTask : Task.Task Http.Error SessionData getSessionTask = Http.task { method = "GET" , headers = [] , url = "/api/session" , body = Http.emptyBody , resolver = Http.stringResolver responseToResult , timeout = Nothing } {-| -} responseToResult : Http.Response String -> Result Http.Error SessionData responseToResult responseString = case responseString of Http.BadUrl_ url -> Err <| Http.BadUrl url Http.Timeout_ -> Err <| Http.Timeout Http.NetworkError_ -> Err <| Http.NetworkError Http.BadStatus_ metadata _ -> Err <| Http.BadStatus metadata.statusCode Http.GoodStatus_ _ body -> case Json.Decode.decodeString decodeSession body of Err err -> Err <| Http.BadBody (Json.Decode.errorToString err) Ok ok -> Ok ok {-| -} decodeSession : Json.Decode.Decoder SessionData decodeSession = Json.Decode.map3 SessionData (Json.Decode.field "email" Json.Decode.string) (Json.Decode.field "first_name" Json.Decode.string) (Json.Decode.field "last_name" Json.Decode.string) {-| -} update : Msg -> Header -> Header update msg model = case msg of Logout -> { model | session = SessionError Http.NetworkError , userMenuOpen = False , sideMenuOpen = False } Login -> { model | session = SessionSuccess userExample , userMenuOpen = False , sideMenuOpen = False } Click ids -> if model.userMenuOpen && not (List.member userMenuId ids) && not (List.member userMenuButtonId ids) then { model | userMenuOpen = False } else model ToggleUserMenu -> { model | userMenuOpen = not model.userMenuOpen } -- model ToggleSideMenu -> { model | sideMenuOpen = not model.sideMenuOpen } CloseUserMenu -> { model | userMenuOpen = False } KeyDown key -> case key of Escape -> { model | userMenuOpen = False , sideMenuOpen = False } _ -> model GotSession result -> case result of Ok session -> { model | session = SessionSuccess session } Err error -> { model | session = SessionError error } {-| -} menuTitle : List (Element (R10.Context.ContextInternal z) msg) -> Element (R10.Context.ContextInternal z) msg menuTitle elements = paragraph [ width fill , Font.light , paddingEach { top = 40, right = 20, bottom = 15, left = 20 } , Font.size 26 -- , Border.widthEach { bottom = 1, left = 0, right = 0, top = 0 } -- , Border.color <| rgba 0 0 0 0.1 ] <| elements {-| -} menuSeparator : List (Element (R10.Context.ContextInternal z) msg) menuSeparator = [ el [ width fill , Border.widthEach { bottom = 1, left = 0, right = 0, top = 0 } , Border.color <| rgba 0.6 0.6 0.6 0.2 , height <| px 10 ] <| text "" , el [ height <| px 10 ] <| text "" ] {-| -} subscriptions : Header -> (Msg -> msg) -> List (Sub msg) subscriptions model msgMapper = if model.userMenuOpen then [ Sub.map msgMapper <| Browser.Events.onClick (Json.Decode.map Click decoderPart1) , Sub.map msgMapper <| Browser.Events.onKeyDown (Json.Decode.map KeyDown keyDecoder) ] else if model.sideMenuOpen then [ Sub.map msgMapper <| Browser.Events.onKeyDown (Json.Decode.map KeyDown keyDecoder) ] else [] {-| -} type LanguageSystem route = LanguageInRoute { routeToPath : R10.Language.Language -> route -> String , route : route , routeToLanguage : route -> R10.Language.Language } -- -- TODO - Finish to implement "LanguageInModel" -- | LanguageInModel {-| -} css : String -> String css color = """/*! * Hamburgers * @description Tasty CSS-animated hamburgers * @author Jonathan Suh @jonsuh * @site https://jonsuh.com/hamburgers * @link https://github.com/jonsuh/hamburgers */ .hamburger:focus { outline: -webkit-focus-ring-color auto 0px; } .hamburger { padding: 15px 15px; display: inline-block; cursor: pointer; transition-property: opacity, filter; transition-duration: 0.15s; transition-timing-function: linear; font: inherit; color: inherit; text-transform: none; background-color: transparent; border: 0; margin: 0; overflow: visible; } .hamburger:hover { opacity: 0.7; } .hamburger.is-active:hover { opacity: 0.7; } .hamburger.is-active .hamburger-inner, .hamburger.is-active .hamburger-inner::before, .hamburger.is-active .hamburger-inner::after { background-color: """ ++ color ++ """; } .hamburger-box { width: 30px; height: 24px; display: inline-block; position: relative; } .hamburger-inner { display: block; top: 50%; margin-top: -2px; } .hamburger-inner, .hamburger-inner::before, .hamburger-inner::after { width: 30px; height: 3px; background-color: """ ++ color ++ """; border-radius: 3px; position: absolute; transition-property: transform; transition-duration: 0.15s; transition-timing-function: ease; } .hamburger-inner::before, .hamburger-inner::after { content: ""; display: block; } .hamburger-inner::before { top: -10px; } .hamburger-inner::after { bottom: -10px; } /* * Elastic */ .hamburger--elastic .hamburger-inner { top: 2px; transition-duration: 0.275s; transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); } .hamburger--elastic .hamburger-inner::before { top: 10px; transition: opacity 0.125s 0.275s ease; } .hamburger--elastic .hamburger-inner::after { top: 20px; transition: transform 0.275s cubic-bezier(0.68, -0.55, 0.265, 1.55); } .hamburger--elastic.is-active .hamburger-inner { transform: translate3d(0, 10px, 0) rotate(135deg); transition-delay: 0.075s; } .hamburger--elastic.is-active .hamburger-inner::before { transition-delay: 0s; opacity: 0; } .hamburger--elastic.is-active .hamburger-inner::after { transform: translate3d(0, -20px, 0) rotate(-270deg); transition-delay: 0.075s; }""" fontColorHeader : { a | darkHeader : Bool , theme : { mode : R10.Mode.Mode , primaryColor : R10.Color.Internal.Primary.Color } } -> Color fontColorHeader args = let theme = args.theme in if args.darkHeader then -- The header is always dark R10.Color.Svg.fontHighEmphasis { theme | mode = R10.Mode.Dark } else R10.Color.Svg.fontHighEmphasis theme {-| -} view : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg view model args = el [ padding 0 , width fill , R10.Transition.transition "background 0.4s" , htmlAttribute <| Html.Attributes.style "z-index" "20" , if args.darkHeader then case model.backgroundColor of Nothing -> R10.Color.AttrsBackground.buttonPrimary Just color -> Background.color color else Background.color <| rgba 1 1 1 (if args.isTop then 0.6 else 1 ) , let hamburgerColor = if model.sideMenuOpen then R10.Color.Svg.fontHighEmphasis args.theme else fontColorHeader args in inFront <| html <| Html.node "style" [] [ Html.text (css <| R10.Color.Utils.toCssRgba hamburgerColor) ] , inFront <| cover model args , inFront <| sideMenu model args , inFront <| humbergAndLogo model args ] <| header model args {-| -} header : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg header model args = el [ width fill , centerX , R10.FontSize.normal , paddingXY 30 0 , R10.Transition.transition "height 0.3s, box-shadow 0.5s" , Border.shadow { offset = ( 0, 0 ) , size = 0 , blur = 8 , color = rgba 0 0 0 (if args.isTop then 0 else 0.3 ) } , height <| px (if args.isTop then 80 else 60 ) ] <| row [ alignRight , moveDown (fromTop args.isTop + 10) , spacing 30 ] (args.extraContentRightSide ++ userSection model args ) {-| -} userSection : Header -> ViewArgs z msg route -> List (Element (R10.Context.ContextInternal z) msg) userSection model args = [ el [ R10.Transition.transition "transform 0.2s" , inFront <| if model.userMenuOpen then userMenu model args else none ] <| let transition = R10.Transition.transition "opacity 0.5s" emptyButton = el [ alpha 0, transition ] none in case model.session of SessionNotRequired -> rightArea model args emptyButton SessionNotRequested -> rightArea model args emptyButton SessionFetching -> rightArea model args emptyButton SessionSuccess user -> rightArea model args (el [ transition , htmlAttribute <| Html.Attributes.class "visibleDesktop" ] <| text user.email ) SessionError _ -> rightArea model args (el [ transition , htmlAttribute <| Html.Attributes.class "visibleDesktop" ] <| loginButton model args ) ] {-| -} rightArea : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg -> Element (R10.Context.ContextInternal z) msg rightArea model args loginButtonElement = map args.msgMapper <| Input.button [ alignRight , htmlAttribute <| Html.Attributes.id userMenuId ] { label = row [] [ loginButtonElement , rightMenuButton args.darkHeader args.theme ] , onPress = Just ToggleUserMenu } {-| -} rightMenuButton : Bool -> R10.Theme.Theme -> Element (R10.Context.ContextInternal z) msg rightMenuButton darkHeader theme = el [ Font.size 26 , paddingXY 14 6 , Border.rounded 60 , Font.bold , Font.color <| logoColor darkHeader theme , mouseOver [ Background.color <| rgba 0 0 0 0.05 ] , R10.Transition.transition "background 0.2s" ] <| text "⋮" userMenuId : String userMenuId = "5gwi9fvj5" userMenuButtonId : String userMenuButtonId = "gl49gncaq" {-| -} dontBreakOut : List (Attribute (R10.Context.ContextInternal z) msg) dontBreakOut = -- -- From https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/ -- -- /* These are technically the same, but use both */ [ htmlAttribute <| Html.Attributes.style "overflow-wrap" "break-word" , htmlAttribute <| Html.Attributes.style "word-wrap" "break-word" , htmlAttribute <| Html.Attributes.style "-ms-word-break" "break-all" -- /* This is the dangerous one in WebKit, as it breaks things wherever */ , htmlAttribute <| Html.Attributes.style "word-break" "break-all" -- /* Instead use this non-standard one: */ , htmlAttribute <| Html.Attributes.style "word-break" "break-word" -- /* Adds a hyphen where the word breaks, if supported (No Blink) */ -- -ms-hyphens: auto; -- -moz-hyphens: auto; -- -webkit-hyphens: auto; -- hyphens: auto; ] {-| -} userMenu : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg userMenu model args = let loginArea = [ map args.msgMapper <| el [ centerX, paddingXY 0 30 ] <| loginButton model args ] in el (R10.Card.normal ++ [ height <| px 320 , width <| px 280 , moveDown 40 , moveRight 10 , alignRight , R10.FontSize.normal , htmlAttribute <| Html.Attributes.id userMenuId , R10.Color.AttrsBackground.surface2dp , padding 0 ] ) <| column [ scrollbarY , width fill ] <| [] -- TODO - change this so that it always work, also when user -- is not logged in -- -- loginButton model args.from ++ (case model.session of SessionNotRequired -> [ none ] SessionNotRequested -> [ none ] SessionFetching -> [ none ] SessionSuccess user -> [ column [ paddingXY 10 40 , Font.center , width fill , spacing 10 ] [ paragraph ([ Font.size 24 , spacing 0 , width fill ] ++ dontBreakOut ) [ text <| user.firstName ++ " " ++ user.lastName ] , paragraph ([ width fill ] ++ dontBreakOut) [ text user.email ] ] ] ++ menuSeparator SessionError _ -> loginArea ) ++ languageMenu model args ++ (case model.session of SessionNotRequired -> [] SessionNotRequested -> [] SessionFetching -> [] SessionSuccess _ -> [] ++ menuSeparator ++ [ map args.msgMapper <| logoutLink model args ] SessionError _ -> [] ) {-| -} logoutLink : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg logoutLink model args = if model.debuggingMode then Input.button attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signOut } , onPress = Just Logout } else link attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signOut } , url = model.urlLogout ++ "?from=" ++ args.from } {-| -} loginLink : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg loginLink model args = if model.debuggingMode then Input.button attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , onPress = Just Login } else link attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , url = loginUrl model args } {-| -} loginUrl : Header -> ViewArgs z msg route -> String loginUrl model args = model.urlLogin ++ "?from=" ++ args.from {-| -} loginButton : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg loginButton model args = if model.debuggingMode then Input.button (attrsButton ++ [ alignRight ]) { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , onPress = Just Login } else link (attrsButton ++ [ alignRight ]) { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , url = loginUrl model args } {-| -} attrsLink : List (Attribute (R10.Context.ContextInternal z) msg) attrsLink = [ mouseOver [ Background.color <| rgba 0 0 0 0.05 ] , R10.Transition.transition "background 0.2s" , width fill , paddingXY 20 13 ] {-| -} attrsButton : List (Attribute (R10.Context.ContextInternal z) msg) attrsButton = attrsLink ++ [ Border.width 1 , Border.color <| rgba 0 0 0 0.3 , Border.rounded 5 , paddingXY 20 10 , width shrink ] {-| -} fromTop : Bool -> number fromTop isTop = if isTop then 13 else 0 {-| -} logoColorAsString : Bool -> R10.Theme.Theme -> String logoColorAsString darkHeader theme = Color.Convert.colorToCssRgba <| logoColorColor darkHeader theme {-| -} logoColorColor : Bool -> R10.Theme.Theme -> Color.Color logoColorColor darkHeader theme = if darkHeader then Color.rgb 1 1 1 else R10.Color.Internal.Primary.toColor theme theme.primaryColor {-| -} logoColor : Bool -> R10.Theme.Theme -> Color logoColor darkHeader theme = R10.Color.Utils.fromColorColor <| logoColorColor darkHeader theme {-| -} humbergAndLogo : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg humbergAndLogo model args = row [ paddingXY 10 0 , spacing 10 ] [ map args.msgMapper <| el [ moveDown (fromTop args.isTop) , R10.Transition.transition "transform 0.2s" ] <| hamburger model.sideMenuOpen , R10.Libu.view [ moveDown (fromTop args.isTop + 2) , R10.Transition.transition "transform 0.2s" ] { label = logo (if model.sideMenuOpen then if R10.Mode.isLight args.theme.mode then args.logoOnLight else args.logoOnDark else args.logoOnDark ) , type_ = R10.Libu.LiInternal args.urlTop args.onClick } ] hamburger : Bool -> Element (R10.Context.ContextInternal z) Msg hamburger sideMenuOpen = -- From https://jonsuh.com/hamburgers/ Input.button [ htmlAttribute <| Html.Attributes.class "hamburger" , htmlAttribute <| Html.Attributes.class "hamburger--elastic" , htmlAttribute <| Html.Attributes.classList [ ( "is-active", sideMenuOpen ) ] , htmlAttribute <| Html.Attributes.attribute "aria-label" "Left Side Menu button" , Border.rounded 60 , width <| px 60 , height <| px 60 , mouseOver [ Background.color <| rgba 0 0 0 0.05 ] , R10.Transition.transition "background 0.2s" , scale 0.7 ] { label = html <| Html.span [ Html.Attributes.class "hamburger-box" ] [ Html.span [ Html.Attributes.class "hamburger-inner" ] [] ] , onPress = Just ToggleSideMenu } {-| -} logo : Element (R10.Context.ContextInternal z) msg -> Element (R10.Context.ContextInternal z) msg logo elementLogo = el [ spacing 20 , htmlAttribute <| Html.Attributes.attribute "aria-label" "Top page" ] <| elementLogo {-| -} cover : { a | sideMenuOpen : Bool } -> { b | msgMapper : Msg -> msg } -> Element (R10.Context.ContextInternal z) msg cover model args = map args.msgMapper <| el ([ width fill , Background.color <| rgba 0 0 0 0.5 , htmlAttribute <| Html.Attributes.style "position" "fixed" , htmlAttribute <| Html.Attributes.style "height" "100vh" , R10.Transition.transition "opacity 0.2s, visibility 0.2s" , Events.onClick ToggleSideMenu ] ++ (if model.sideMenuOpen then [ alpha 1 , htmlAttribute <| Html.Attributes.style "visibility" "visible" ] else [ alpha 0 , htmlAttribute <| Html.Attributes.style "visibility" "hidden" ] ) ) none {-| -} argsToLanguage : ViewArgs z msg route -> R10.Language.Language argsToLanguage args = case args.languageSystem of LanguageInRoute languageInRoute -> languageInRoute.routeToLanguage languageInRoute.route LanguageInModel -> -- TODO - finish this part R10.Language.default {-| -} sideMenu : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg sideMenu model args = column [ R10.Color.AttrsBackground.surface2dp , Border.shadow { offset = ( 0, 0 ), size = 0, blur = 12, color = rgba 0 0 0 0.3 } , R10.FontSize.normal , width <| px 300 , paddingEach { top = 60, right = 0, bottom = 20, left = 0 } , R10.Transition.transition "transform 0.2s" , htmlAttribute <| Html.Attributes.style "position" "fixed" , htmlAttribute <| Html.Attributes.style "height" "100vh" , scrollbarY , moveLeft <| if model.sideMenuOpen then 0 else 310 ] <| [] ++ args.extraContent ++ [ menuTitle [ R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.language } ] ] ++ menuSeparator ++ languageMenu model args ++ menuSeparator ++ [ case model.session of SessionNotRequired -> none SessionNotRequested -> none SessionFetching -> none SessionSuccess _ -> map args.msgMapper <| logoutLink model args SessionError _ -> map args.msgMapper <| loginLink model args ] {-| -} languageMenu : Header -> ViewArgs z msg route -> List (Element (R10.Context.ContextInternal z) msg) languageMenu model args = List.map (\language -> let int = R10.Language.toStringLong R10.Language.International language loc = R10.Language.toStringLong R10.Language.Localization language label = text <| if int == loc then int else int ++ " (" ++ loc ++ ")" in -- Here we may need 2 ways for the language to work. -- -- One where the language is stored in the url. -- -- Another where the language is stored in the model -- -- if language == (argsToLanguage args) then if language == argsToLanguage args then el (attrsLink ++ [ Font.bold , htmlAttribute <| Html.Attributes.style "pointer-events" "none" ] ) label else case args.languageSystem of LanguageInRoute languageInRoute -> -- R10.Libu.view (attrsLink ++ [ map args.msgMapper <| Events.onClick CloseUserMenu ]) el [ mapAttribute args.msgMapper <| Events.onClick CloseUserMenu, width fill ] <| R10.Libu.view attrsLink -- R10.Libu.view attrsLink { label = label , type_ = R10.Libu.LiInternal (languageInRoute.routeToPath language languageInRoute.route) args.onClick } LanguageInModel -> -- TODO - Finish this part -- R10.Libu.view attrsLink -- { label = label -- , type_ = R10.Libu.Bu (Just <| languageInModel.changeLanguage language) -- } none ) model.supportedLanguageList -- EVENT DECODERS {-| -} keyDecoder : Json.Decode.Decoder KeyPressed keyDecoder = Json.Decode.field "key" Json.Decode.string |> Json.Decode.map toKeyPressed -- keyDecoder : Json.Decode.Decoder ( Msg, Bool ) -- keyDecoder = -- Json.Decode.field "key" Json.Decode.string -- |> Json.Decode.map toKeyPressed -- |> Json.Decode.map -- (\key -> -- ( KeyDown key, True ) -- ) {-| -} type KeyPressed = Escape | Enter | Space | Other {-| -} toKeyPressed : String -> KeyPressed toKeyPressed key = case key of "Escape" -> Escape "Enter" -> Enter " " -> Space _ -> Other -- Here we decode recursive stuff like -- [ "target", "parentNode", "parentNode", "parentNode", "parentNode", "id" ] {-| -} decoderPart1 : Json.Decode.Decoder (List String) decoderPart1 = Json.Decode.field "target" (decoderPart2 []) {-| -} decoderPart2 : List String -> Json.Decode.Decoder (List String) decoderPart2 acc = Json.Decode.oneOf [ Json.Decode.field "id" Json.Decode.string |> Json.Decode.andThen (\id -> Json.Decode.lazy (\_ -> decoderPart2 (id :: acc) |> Json.Decode.field "parentNode") ) , Json.Decode.succeed acc ] {-| -} extraCss : String extraCss = String.join "\n" [ -- -- "flext is a shorthand for the following CSS properties: -- -- flex-grow This property specifies how much of the remaining space in the flex container should be assigned to the item (the flex grow factor). -- Default to 0 -- -- flex-grow: inherit; -- flex-grow: initial; -- flex-grow: unset; -- -- flex-shrink -- flex-basis -- """ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { .s { flex-basis: auto !important; } .s.r > .s { flex-basis: 0% !important; /* border: 1px solid red !important; */ } } """ ]
12378
module R10.Header exposing (view, Header, LanguageSystem(..), Msg(..), Session(..), SessionData, ViewArgs, attrsLink, closeMenu, decodeSession, extraCss, getSession, init, languageMenu, loginLink, logoutLink, menuSeparator, menuTitle, subscriptions, update, userExample) {-| This create a generic header. @docs view, Header, LanguageSystem, Msg, Session, SessionData, ViewArgs, attrsLink, closeMenu, decodeSession, extraCss, getSession, init, languageMenu, loginLink, logoutLink, menuSeparator, menuTitle, subscriptions, update, userExample -} import Browser.Events import Color import Color.Convert import Element.WithContext exposing (..) import Element.WithContext.Background as Background import Element.WithContext.Border as Border import Element.WithContext.Events as Events import Element.WithContext.Font as Font import Element.WithContext.Input as Input import Html import Html.Attributes import Http import Json.Decode import Process import R10.Card import R10.Color.AttrsBackground import R10.Color.Internal.Primary import R10.Color.Svg import R10.Color.Utils import R10.Context exposing (..) import R10.FontSize import R10.I18n import R10.Language import R10.Libu import R10.Mode import R10.Theme import R10.Transition import R10.Translations import Task {-| -} userExample : { email : String, firstName : String, lastName : String } userExample = { email = "<EMAIL>" , firstName = "<NAME>" , lastName = "<NAME>" } {-| -} closeMenu : Header -> Header closeMenu model = { model | sideMenuOpen = False } {-| -} type alias SessionData = { email : String , firstName : String , lastName : String } {-| -} type Session = SessionNotRequired | SessionNotRequested | SessionFetching | SessionSuccess SessionData | SessionError Http.Error {-| -} type alias Header = { sideMenuOpen : Bool , userMenuOpen : Bool , maxWidth : Int , padding : Int , supportedLanguageList : List R10.Language.Language , urlLogin : String , urlLogout : String , session : Session , debuggingMode : Bool , backgroundColor : Maybe Color } {-| -} type alias ViewArgs z msg route = { extraContent : List (Element (R10.Context.ContextInternal z) msg) , extraContentRightSide : List (Element (R10.Context.ContextInternal z) msg) , from : String , msgMapper : Msg -> msg , isTop : Bool , isMobile : Bool , onClick : String -> msg , urlTop : String , languageSystem : LanguageSystem route , logoOnDark : Element (R10.Context.ContextInternal z) msg , logoOnLight : Element (R10.Context.ContextInternal z) msg , darkHeader : Bool , theme : R10.Theme.Theme } {-| -} init : Header init = { sideMenuOpen = False , userMenuOpen = False , maxWidth = 1000 , padding = 20 , supportedLanguageList = R10.Language.defaultSupportedLanguageList , urlLogin = "/api/session/redirect" , urlLogout = "/api/logout" , session = SessionNotRequested , debuggingMode = False , backgroundColor = Nothing } {-| -} defaultTheme : R10.Theme.Theme defaultTheme = { mode = R10.Mode.Light , primaryColor = R10.Color.Internal.Primary.CrimsonRed } {-| -} type Msg = ToggleSideMenu | ToggleUserMenu | Logout | Login | CloseUserMenu | KeyDown KeyPressed | Click (List String) | GotSession (Result Http.Error SessionData) {-| -} getSession : Float -> Cmd Msg getSession delay = Process.sleep delay |> Task.andThen (\_ -> getSessionTask) |> Task.attempt GotSession {-| -} getSessionTask : Task.Task Http.Error SessionData getSessionTask = Http.task { method = "GET" , headers = [] , url = "/api/session" , body = Http.emptyBody , resolver = Http.stringResolver responseToResult , timeout = Nothing } {-| -} responseToResult : Http.Response String -> Result Http.Error SessionData responseToResult responseString = case responseString of Http.BadUrl_ url -> Err <| Http.BadUrl url Http.Timeout_ -> Err <| Http.Timeout Http.NetworkError_ -> Err <| Http.NetworkError Http.BadStatus_ metadata _ -> Err <| Http.BadStatus metadata.statusCode Http.GoodStatus_ _ body -> case Json.Decode.decodeString decodeSession body of Err err -> Err <| Http.BadBody (Json.Decode.errorToString err) Ok ok -> Ok ok {-| -} decodeSession : Json.Decode.Decoder SessionData decodeSession = Json.Decode.map3 SessionData (Json.Decode.field "email" Json.Decode.string) (Json.Decode.field "first_name" Json.Decode.string) (Json.Decode.field "last_name" Json.Decode.string) {-| -} update : Msg -> Header -> Header update msg model = case msg of Logout -> { model | session = SessionError Http.NetworkError , userMenuOpen = False , sideMenuOpen = False } Login -> { model | session = SessionSuccess userExample , userMenuOpen = False , sideMenuOpen = False } Click ids -> if model.userMenuOpen && not (List.member userMenuId ids) && not (List.member userMenuButtonId ids) then { model | userMenuOpen = False } else model ToggleUserMenu -> { model | userMenuOpen = not model.userMenuOpen } -- model ToggleSideMenu -> { model | sideMenuOpen = not model.sideMenuOpen } CloseUserMenu -> { model | userMenuOpen = False } KeyDown key -> case key of Escape -> { model | userMenuOpen = False , sideMenuOpen = False } _ -> model GotSession result -> case result of Ok session -> { model | session = SessionSuccess session } Err error -> { model | session = SessionError error } {-| -} menuTitle : List (Element (R10.Context.ContextInternal z) msg) -> Element (R10.Context.ContextInternal z) msg menuTitle elements = paragraph [ width fill , Font.light , paddingEach { top = 40, right = 20, bottom = 15, left = 20 } , Font.size 26 -- , Border.widthEach { bottom = 1, left = 0, right = 0, top = 0 } -- , Border.color <| rgba 0 0 0 0.1 ] <| elements {-| -} menuSeparator : List (Element (R10.Context.ContextInternal z) msg) menuSeparator = [ el [ width fill , Border.widthEach { bottom = 1, left = 0, right = 0, top = 0 } , Border.color <| rgba 0.6 0.6 0.6 0.2 , height <| px 10 ] <| text "" , el [ height <| px 10 ] <| text "" ] {-| -} subscriptions : Header -> (Msg -> msg) -> List (Sub msg) subscriptions model msgMapper = if model.userMenuOpen then [ Sub.map msgMapper <| Browser.Events.onClick (Json.Decode.map Click decoderPart1) , Sub.map msgMapper <| Browser.Events.onKeyDown (Json.Decode.map KeyDown keyDecoder) ] else if model.sideMenuOpen then [ Sub.map msgMapper <| Browser.Events.onKeyDown (Json.Decode.map KeyDown keyDecoder) ] else [] {-| -} type LanguageSystem route = LanguageInRoute { routeToPath : R10.Language.Language -> route -> String , route : route , routeToLanguage : route -> R10.Language.Language } -- -- TODO - Finish to implement "LanguageInModel" -- | LanguageInModel {-| -} css : String -> String css color = """/*! * Hamburgers * @description Tasty CSS-animated hamburgers * @author <NAME> @jonsuh * @site https://jonsuh.com/hamburgers * @link https://github.com/jonsuh/hamburgers */ .hamburger:focus { outline: -webkit-focus-ring-color auto 0px; } .hamburger { padding: 15px 15px; display: inline-block; cursor: pointer; transition-property: opacity, filter; transition-duration: 0.15s; transition-timing-function: linear; font: inherit; color: inherit; text-transform: none; background-color: transparent; border: 0; margin: 0; overflow: visible; } .hamburger:hover { opacity: 0.7; } .hamburger.is-active:hover { opacity: 0.7; } .hamburger.is-active .hamburger-inner, .hamburger.is-active .hamburger-inner::before, .hamburger.is-active .hamburger-inner::after { background-color: """ ++ color ++ """; } .hamburger-box { width: 30px; height: 24px; display: inline-block; position: relative; } .hamburger-inner { display: block; top: 50%; margin-top: -2px; } .hamburger-inner, .hamburger-inner::before, .hamburger-inner::after { width: 30px; height: 3px; background-color: """ ++ color ++ """; border-radius: 3px; position: absolute; transition-property: transform; transition-duration: 0.15s; transition-timing-function: ease; } .hamburger-inner::before, .hamburger-inner::after { content: ""; display: block; } .hamburger-inner::before { top: -10px; } .hamburger-inner::after { bottom: -10px; } /* * Elastic */ .hamburger--elastic .hamburger-inner { top: 2px; transition-duration: 0.275s; transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); } .hamburger--elastic .hamburger-inner::before { top: 10px; transition: opacity 0.125s 0.275s ease; } .hamburger--elastic .hamburger-inner::after { top: 20px; transition: transform 0.275s cubic-bezier(0.68, -0.55, 0.265, 1.55); } .hamburger--elastic.is-active .hamburger-inner { transform: translate3d(0, 10px, 0) rotate(135deg); transition-delay: 0.075s; } .hamburger--elastic.is-active .hamburger-inner::before { transition-delay: 0s; opacity: 0; } .hamburger--elastic.is-active .hamburger-inner::after { transform: translate3d(0, -20px, 0) rotate(-270deg); transition-delay: 0.075s; }""" fontColorHeader : { a | darkHeader : Bool , theme : { mode : R10.Mode.Mode , primaryColor : R10.Color.Internal.Primary.Color } } -> Color fontColorHeader args = let theme = args.theme in if args.darkHeader then -- The header is always dark R10.Color.Svg.fontHighEmphasis { theme | mode = R10.Mode.Dark } else R10.Color.Svg.fontHighEmphasis theme {-| -} view : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg view model args = el [ padding 0 , width fill , R10.Transition.transition "background 0.4s" , htmlAttribute <| Html.Attributes.style "z-index" "20" , if args.darkHeader then case model.backgroundColor of Nothing -> R10.Color.AttrsBackground.buttonPrimary Just color -> Background.color color else Background.color <| rgba 1 1 1 (if args.isTop then 0.6 else 1 ) , let hamburgerColor = if model.sideMenuOpen then R10.Color.Svg.fontHighEmphasis args.theme else fontColorHeader args in inFront <| html <| Html.node "style" [] [ Html.text (css <| R10.Color.Utils.toCssRgba hamburgerColor) ] , inFront <| cover model args , inFront <| sideMenu model args , inFront <| humbergAndLogo model args ] <| header model args {-| -} header : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg header model args = el [ width fill , centerX , R10.FontSize.normal , paddingXY 30 0 , R10.Transition.transition "height 0.3s, box-shadow 0.5s" , Border.shadow { offset = ( 0, 0 ) , size = 0 , blur = 8 , color = rgba 0 0 0 (if args.isTop then 0 else 0.3 ) } , height <| px (if args.isTop then 80 else 60 ) ] <| row [ alignRight , moveDown (fromTop args.isTop + 10) , spacing 30 ] (args.extraContentRightSide ++ userSection model args ) {-| -} userSection : Header -> ViewArgs z msg route -> List (Element (R10.Context.ContextInternal z) msg) userSection model args = [ el [ R10.Transition.transition "transform 0.2s" , inFront <| if model.userMenuOpen then userMenu model args else none ] <| let transition = R10.Transition.transition "opacity 0.5s" emptyButton = el [ alpha 0, transition ] none in case model.session of SessionNotRequired -> rightArea model args emptyButton SessionNotRequested -> rightArea model args emptyButton SessionFetching -> rightArea model args emptyButton SessionSuccess user -> rightArea model args (el [ transition , htmlAttribute <| Html.Attributes.class "visibleDesktop" ] <| text user.email ) SessionError _ -> rightArea model args (el [ transition , htmlAttribute <| Html.Attributes.class "visibleDesktop" ] <| loginButton model args ) ] {-| -} rightArea : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg -> Element (R10.Context.ContextInternal z) msg rightArea model args loginButtonElement = map args.msgMapper <| Input.button [ alignRight , htmlAttribute <| Html.Attributes.id userMenuId ] { label = row [] [ loginButtonElement , rightMenuButton args.darkHeader args.theme ] , onPress = Just ToggleUserMenu } {-| -} rightMenuButton : Bool -> R10.Theme.Theme -> Element (R10.Context.ContextInternal z) msg rightMenuButton darkHeader theme = el [ Font.size 26 , paddingXY 14 6 , Border.rounded 60 , Font.bold , Font.color <| logoColor darkHeader theme , mouseOver [ Background.color <| rgba 0 0 0 0.05 ] , R10.Transition.transition "background 0.2s" ] <| text "⋮" userMenuId : String userMenuId = "5gwi9fvj5" userMenuButtonId : String userMenuButtonId = "gl49gncaq" {-| -} dontBreakOut : List (Attribute (R10.Context.ContextInternal z) msg) dontBreakOut = -- -- From https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/ -- -- /* These are technically the same, but use both */ [ htmlAttribute <| Html.Attributes.style "overflow-wrap" "break-word" , htmlAttribute <| Html.Attributes.style "word-wrap" "break-word" , htmlAttribute <| Html.Attributes.style "-ms-word-break" "break-all" -- /* This is the dangerous one in WebKit, as it breaks things wherever */ , htmlAttribute <| Html.Attributes.style "word-break" "break-all" -- /* Instead use this non-standard one: */ , htmlAttribute <| Html.Attributes.style "word-break" "break-word" -- /* Adds a hyphen where the word breaks, if supported (No Blink) */ -- -ms-hyphens: auto; -- -moz-hyphens: auto; -- -webkit-hyphens: auto; -- hyphens: auto; ] {-| -} userMenu : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg userMenu model args = let loginArea = [ map args.msgMapper <| el [ centerX, paddingXY 0 30 ] <| loginButton model args ] in el (R10.Card.normal ++ [ height <| px 320 , width <| px 280 , moveDown 40 , moveRight 10 , alignRight , R10.FontSize.normal , htmlAttribute <| Html.Attributes.id userMenuId , R10.Color.AttrsBackground.surface2dp , padding 0 ] ) <| column [ scrollbarY , width fill ] <| [] -- TODO - change this so that it always work, also when user -- is not logged in -- -- loginButton model args.from ++ (case model.session of SessionNotRequired -> [ none ] SessionNotRequested -> [ none ] SessionFetching -> [ none ] SessionSuccess user -> [ column [ paddingXY 10 40 , Font.center , width fill , spacing 10 ] [ paragraph ([ Font.size 24 , spacing 0 , width fill ] ++ dontBreakOut ) [ text <| user.firstName ++ " " ++ user.lastName ] , paragraph ([ width fill ] ++ dontBreakOut) [ text user.email ] ] ] ++ menuSeparator SessionError _ -> loginArea ) ++ languageMenu model args ++ (case model.session of SessionNotRequired -> [] SessionNotRequested -> [] SessionFetching -> [] SessionSuccess _ -> [] ++ menuSeparator ++ [ map args.msgMapper <| logoutLink model args ] SessionError _ -> [] ) {-| -} logoutLink : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg logoutLink model args = if model.debuggingMode then Input.button attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signOut } , onPress = Just Logout } else link attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signOut } , url = model.urlLogout ++ "?from=" ++ args.from } {-| -} loginLink : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg loginLink model args = if model.debuggingMode then Input.button attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , onPress = Just Login } else link attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , url = loginUrl model args } {-| -} loginUrl : Header -> ViewArgs z msg route -> String loginUrl model args = model.urlLogin ++ "?from=" ++ args.from {-| -} loginButton : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg loginButton model args = if model.debuggingMode then Input.button (attrsButton ++ [ alignRight ]) { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , onPress = Just Login } else link (attrsButton ++ [ alignRight ]) { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , url = loginUrl model args } {-| -} attrsLink : List (Attribute (R10.Context.ContextInternal z) msg) attrsLink = [ mouseOver [ Background.color <| rgba 0 0 0 0.05 ] , R10.Transition.transition "background 0.2s" , width fill , paddingXY 20 13 ] {-| -} attrsButton : List (Attribute (R10.Context.ContextInternal z) msg) attrsButton = attrsLink ++ [ Border.width 1 , Border.color <| rgba 0 0 0 0.3 , Border.rounded 5 , paddingXY 20 10 , width shrink ] {-| -} fromTop : Bool -> number fromTop isTop = if isTop then 13 else 0 {-| -} logoColorAsString : Bool -> R10.Theme.Theme -> String logoColorAsString darkHeader theme = Color.Convert.colorToCssRgba <| logoColorColor darkHeader theme {-| -} logoColorColor : Bool -> R10.Theme.Theme -> Color.Color logoColorColor darkHeader theme = if darkHeader then Color.rgb 1 1 1 else R10.Color.Internal.Primary.toColor theme theme.primaryColor {-| -} logoColor : Bool -> R10.Theme.Theme -> Color logoColor darkHeader theme = R10.Color.Utils.fromColorColor <| logoColorColor darkHeader theme {-| -} humbergAndLogo : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg humbergAndLogo model args = row [ paddingXY 10 0 , spacing 10 ] [ map args.msgMapper <| el [ moveDown (fromTop args.isTop) , R10.Transition.transition "transform 0.2s" ] <| hamburger model.sideMenuOpen , R10.Libu.view [ moveDown (fromTop args.isTop + 2) , R10.Transition.transition "transform 0.2s" ] { label = logo (if model.sideMenuOpen then if R10.Mode.isLight args.theme.mode then args.logoOnLight else args.logoOnDark else args.logoOnDark ) , type_ = R10.Libu.LiInternal args.urlTop args.onClick } ] hamburger : Bool -> Element (R10.Context.ContextInternal z) Msg hamburger sideMenuOpen = -- From https://jonsuh.com/hamburgers/ Input.button [ htmlAttribute <| Html.Attributes.class "hamburger" , htmlAttribute <| Html.Attributes.class "hamburger--elastic" , htmlAttribute <| Html.Attributes.classList [ ( "is-active", sideMenuOpen ) ] , htmlAttribute <| Html.Attributes.attribute "aria-label" "Left Side Menu button" , Border.rounded 60 , width <| px 60 , height <| px 60 , mouseOver [ Background.color <| rgba 0 0 0 0.05 ] , R10.Transition.transition "background 0.2s" , scale 0.7 ] { label = html <| Html.span [ Html.Attributes.class "hamburger-box" ] [ Html.span [ Html.Attributes.class "hamburger-inner" ] [] ] , onPress = Just ToggleSideMenu } {-| -} logo : Element (R10.Context.ContextInternal z) msg -> Element (R10.Context.ContextInternal z) msg logo elementLogo = el [ spacing 20 , htmlAttribute <| Html.Attributes.attribute "aria-label" "Top page" ] <| elementLogo {-| -} cover : { a | sideMenuOpen : Bool } -> { b | msgMapper : Msg -> msg } -> Element (R10.Context.ContextInternal z) msg cover model args = map args.msgMapper <| el ([ width fill , Background.color <| rgba 0 0 0 0.5 , htmlAttribute <| Html.Attributes.style "position" "fixed" , htmlAttribute <| Html.Attributes.style "height" "100vh" , R10.Transition.transition "opacity 0.2s, visibility 0.2s" , Events.onClick ToggleSideMenu ] ++ (if model.sideMenuOpen then [ alpha 1 , htmlAttribute <| Html.Attributes.style "visibility" "visible" ] else [ alpha 0 , htmlAttribute <| Html.Attributes.style "visibility" "hidden" ] ) ) none {-| -} argsToLanguage : ViewArgs z msg route -> R10.Language.Language argsToLanguage args = case args.languageSystem of LanguageInRoute languageInRoute -> languageInRoute.routeToLanguage languageInRoute.route LanguageInModel -> -- TODO - finish this part R10.Language.default {-| -} sideMenu : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg sideMenu model args = column [ R10.Color.AttrsBackground.surface2dp , Border.shadow { offset = ( 0, 0 ), size = 0, blur = 12, color = rgba 0 0 0 0.3 } , R10.FontSize.normal , width <| px 300 , paddingEach { top = 60, right = 0, bottom = 20, left = 0 } , R10.Transition.transition "transform 0.2s" , htmlAttribute <| Html.Attributes.style "position" "fixed" , htmlAttribute <| Html.Attributes.style "height" "100vh" , scrollbarY , moveLeft <| if model.sideMenuOpen then 0 else 310 ] <| [] ++ args.extraContent ++ [ menuTitle [ R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.language } ] ] ++ menuSeparator ++ languageMenu model args ++ menuSeparator ++ [ case model.session of SessionNotRequired -> none SessionNotRequested -> none SessionFetching -> none SessionSuccess _ -> map args.msgMapper <| logoutLink model args SessionError _ -> map args.msgMapper <| loginLink model args ] {-| -} languageMenu : Header -> ViewArgs z msg route -> List (Element (R10.Context.ContextInternal z) msg) languageMenu model args = List.map (\language -> let int = R10.Language.toStringLong R10.Language.International language loc = R10.Language.toStringLong R10.Language.Localization language label = text <| if int == loc then int else int ++ " (" ++ loc ++ ")" in -- Here we may need 2 ways for the language to work. -- -- One where the language is stored in the url. -- -- Another where the language is stored in the model -- -- if language == (argsToLanguage args) then if language == argsToLanguage args then el (attrsLink ++ [ Font.bold , htmlAttribute <| Html.Attributes.style "pointer-events" "none" ] ) label else case args.languageSystem of LanguageInRoute languageInRoute -> -- R10.Libu.view (attrsLink ++ [ map args.msgMapper <| Events.onClick CloseUserMenu ]) el [ mapAttribute args.msgMapper <| Events.onClick CloseUserMenu, width fill ] <| R10.Libu.view attrsLink -- R10.Libu.view attrsLink { label = label , type_ = R10.Libu.LiInternal (languageInRoute.routeToPath language languageInRoute.route) args.onClick } LanguageInModel -> -- TODO - Finish this part -- R10.Libu.view attrsLink -- { label = label -- , type_ = R10.Libu.Bu (Just <| languageInModel.changeLanguage language) -- } none ) model.supportedLanguageList -- EVENT DECODERS {-| -} keyDecoder : Json.Decode.Decoder KeyPressed keyDecoder = Json.Decode.field "key" Json.Decode.string |> Json.Decode.map toKeyPressed -- keyDecoder : Json.Decode.Decoder ( Msg, Bool ) -- keyDecoder = -- Json.Decode.field "key" Json.Decode.string -- |> Json.Decode.map toKeyPressed -- |> Json.Decode.map -- (\key -> -- ( KeyDown key, True ) -- ) {-| -} type KeyPressed = Escape | Enter | Space | Other {-| -} toKeyPressed : String -> KeyPressed toKeyPressed key = case key of "Escape" -> Escape "Enter" -> Enter " " -> Space _ -> Other -- Here we decode recursive stuff like -- [ "target", "parentNode", "parentNode", "parentNode", "parentNode", "id" ] {-| -} decoderPart1 : Json.Decode.Decoder (List String) decoderPart1 = Json.Decode.field "target" (decoderPart2 []) {-| -} decoderPart2 : List String -> Json.Decode.Decoder (List String) decoderPart2 acc = Json.Decode.oneOf [ Json.Decode.field "id" Json.Decode.string |> Json.Decode.andThen (\id -> Json.Decode.lazy (\_ -> decoderPart2 (id :: acc) |> Json.Decode.field "parentNode") ) , Json.Decode.succeed acc ] {-| -} extraCss : String extraCss = String.join "\n" [ -- -- "flext is a shorthand for the following CSS properties: -- -- flex-grow This property specifies how much of the remaining space in the flex container should be assigned to the item (the flex grow factor). -- Default to 0 -- -- flex-grow: inherit; -- flex-grow: initial; -- flex-grow: unset; -- -- flex-shrink -- flex-basis -- """ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { .s { flex-basis: auto !important; } .s.r > .s { flex-basis: 0% !important; /* border: 1px solid red !important; */ } } """ ]
true
module R10.Header exposing (view, Header, LanguageSystem(..), Msg(..), Session(..), SessionData, ViewArgs, attrsLink, closeMenu, decodeSession, extraCss, getSession, init, languageMenu, loginLink, logoutLink, menuSeparator, menuTitle, subscriptions, update, userExample) {-| This create a generic header. @docs view, Header, LanguageSystem, Msg, Session, SessionData, ViewArgs, attrsLink, closeMenu, decodeSession, extraCss, getSession, init, languageMenu, loginLink, logoutLink, menuSeparator, menuTitle, subscriptions, update, userExample -} import Browser.Events import Color import Color.Convert import Element.WithContext exposing (..) import Element.WithContext.Background as Background import Element.WithContext.Border as Border import Element.WithContext.Events as Events import Element.WithContext.Font as Font import Element.WithContext.Input as Input import Html import Html.Attributes import Http import Json.Decode import Process import R10.Card import R10.Color.AttrsBackground import R10.Color.Internal.Primary import R10.Color.Svg import R10.Color.Utils import R10.Context exposing (..) import R10.FontSize import R10.I18n import R10.Language import R10.Libu import R10.Mode import R10.Theme import R10.Transition import R10.Translations import Task {-| -} userExample : { email : String, firstName : String, lastName : String } userExample = { email = "PI:EMAIL:<EMAIL>END_PI" , firstName = "PI:NAME:<NAME>END_PI" , lastName = "PI:NAME:<NAME>END_PI" } {-| -} closeMenu : Header -> Header closeMenu model = { model | sideMenuOpen = False } {-| -} type alias SessionData = { email : String , firstName : String , lastName : String } {-| -} type Session = SessionNotRequired | SessionNotRequested | SessionFetching | SessionSuccess SessionData | SessionError Http.Error {-| -} type alias Header = { sideMenuOpen : Bool , userMenuOpen : Bool , maxWidth : Int , padding : Int , supportedLanguageList : List R10.Language.Language , urlLogin : String , urlLogout : String , session : Session , debuggingMode : Bool , backgroundColor : Maybe Color } {-| -} type alias ViewArgs z msg route = { extraContent : List (Element (R10.Context.ContextInternal z) msg) , extraContentRightSide : List (Element (R10.Context.ContextInternal z) msg) , from : String , msgMapper : Msg -> msg , isTop : Bool , isMobile : Bool , onClick : String -> msg , urlTop : String , languageSystem : LanguageSystem route , logoOnDark : Element (R10.Context.ContextInternal z) msg , logoOnLight : Element (R10.Context.ContextInternal z) msg , darkHeader : Bool , theme : R10.Theme.Theme } {-| -} init : Header init = { sideMenuOpen = False , userMenuOpen = False , maxWidth = 1000 , padding = 20 , supportedLanguageList = R10.Language.defaultSupportedLanguageList , urlLogin = "/api/session/redirect" , urlLogout = "/api/logout" , session = SessionNotRequested , debuggingMode = False , backgroundColor = Nothing } {-| -} defaultTheme : R10.Theme.Theme defaultTheme = { mode = R10.Mode.Light , primaryColor = R10.Color.Internal.Primary.CrimsonRed } {-| -} type Msg = ToggleSideMenu | ToggleUserMenu | Logout | Login | CloseUserMenu | KeyDown KeyPressed | Click (List String) | GotSession (Result Http.Error SessionData) {-| -} getSession : Float -> Cmd Msg getSession delay = Process.sleep delay |> Task.andThen (\_ -> getSessionTask) |> Task.attempt GotSession {-| -} getSessionTask : Task.Task Http.Error SessionData getSessionTask = Http.task { method = "GET" , headers = [] , url = "/api/session" , body = Http.emptyBody , resolver = Http.stringResolver responseToResult , timeout = Nothing } {-| -} responseToResult : Http.Response String -> Result Http.Error SessionData responseToResult responseString = case responseString of Http.BadUrl_ url -> Err <| Http.BadUrl url Http.Timeout_ -> Err <| Http.Timeout Http.NetworkError_ -> Err <| Http.NetworkError Http.BadStatus_ metadata _ -> Err <| Http.BadStatus metadata.statusCode Http.GoodStatus_ _ body -> case Json.Decode.decodeString decodeSession body of Err err -> Err <| Http.BadBody (Json.Decode.errorToString err) Ok ok -> Ok ok {-| -} decodeSession : Json.Decode.Decoder SessionData decodeSession = Json.Decode.map3 SessionData (Json.Decode.field "email" Json.Decode.string) (Json.Decode.field "first_name" Json.Decode.string) (Json.Decode.field "last_name" Json.Decode.string) {-| -} update : Msg -> Header -> Header update msg model = case msg of Logout -> { model | session = SessionError Http.NetworkError , userMenuOpen = False , sideMenuOpen = False } Login -> { model | session = SessionSuccess userExample , userMenuOpen = False , sideMenuOpen = False } Click ids -> if model.userMenuOpen && not (List.member userMenuId ids) && not (List.member userMenuButtonId ids) then { model | userMenuOpen = False } else model ToggleUserMenu -> { model | userMenuOpen = not model.userMenuOpen } -- model ToggleSideMenu -> { model | sideMenuOpen = not model.sideMenuOpen } CloseUserMenu -> { model | userMenuOpen = False } KeyDown key -> case key of Escape -> { model | userMenuOpen = False , sideMenuOpen = False } _ -> model GotSession result -> case result of Ok session -> { model | session = SessionSuccess session } Err error -> { model | session = SessionError error } {-| -} menuTitle : List (Element (R10.Context.ContextInternal z) msg) -> Element (R10.Context.ContextInternal z) msg menuTitle elements = paragraph [ width fill , Font.light , paddingEach { top = 40, right = 20, bottom = 15, left = 20 } , Font.size 26 -- , Border.widthEach { bottom = 1, left = 0, right = 0, top = 0 } -- , Border.color <| rgba 0 0 0 0.1 ] <| elements {-| -} menuSeparator : List (Element (R10.Context.ContextInternal z) msg) menuSeparator = [ el [ width fill , Border.widthEach { bottom = 1, left = 0, right = 0, top = 0 } , Border.color <| rgba 0.6 0.6 0.6 0.2 , height <| px 10 ] <| text "" , el [ height <| px 10 ] <| text "" ] {-| -} subscriptions : Header -> (Msg -> msg) -> List (Sub msg) subscriptions model msgMapper = if model.userMenuOpen then [ Sub.map msgMapper <| Browser.Events.onClick (Json.Decode.map Click decoderPart1) , Sub.map msgMapper <| Browser.Events.onKeyDown (Json.Decode.map KeyDown keyDecoder) ] else if model.sideMenuOpen then [ Sub.map msgMapper <| Browser.Events.onKeyDown (Json.Decode.map KeyDown keyDecoder) ] else [] {-| -} type LanguageSystem route = LanguageInRoute { routeToPath : R10.Language.Language -> route -> String , route : route , routeToLanguage : route -> R10.Language.Language } -- -- TODO - Finish to implement "LanguageInModel" -- | LanguageInModel {-| -} css : String -> String css color = """/*! * Hamburgers * @description Tasty CSS-animated hamburgers * @author PI:NAME:<NAME>END_PI @jonsuh * @site https://jonsuh.com/hamburgers * @link https://github.com/jonsuh/hamburgers */ .hamburger:focus { outline: -webkit-focus-ring-color auto 0px; } .hamburger { padding: 15px 15px; display: inline-block; cursor: pointer; transition-property: opacity, filter; transition-duration: 0.15s; transition-timing-function: linear; font: inherit; color: inherit; text-transform: none; background-color: transparent; border: 0; margin: 0; overflow: visible; } .hamburger:hover { opacity: 0.7; } .hamburger.is-active:hover { opacity: 0.7; } .hamburger.is-active .hamburger-inner, .hamburger.is-active .hamburger-inner::before, .hamburger.is-active .hamburger-inner::after { background-color: """ ++ color ++ """; } .hamburger-box { width: 30px; height: 24px; display: inline-block; position: relative; } .hamburger-inner { display: block; top: 50%; margin-top: -2px; } .hamburger-inner, .hamburger-inner::before, .hamburger-inner::after { width: 30px; height: 3px; background-color: """ ++ color ++ """; border-radius: 3px; position: absolute; transition-property: transform; transition-duration: 0.15s; transition-timing-function: ease; } .hamburger-inner::before, .hamburger-inner::after { content: ""; display: block; } .hamburger-inner::before { top: -10px; } .hamburger-inner::after { bottom: -10px; } /* * Elastic */ .hamburger--elastic .hamburger-inner { top: 2px; transition-duration: 0.275s; transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55); } .hamburger--elastic .hamburger-inner::before { top: 10px; transition: opacity 0.125s 0.275s ease; } .hamburger--elastic .hamburger-inner::after { top: 20px; transition: transform 0.275s cubic-bezier(0.68, -0.55, 0.265, 1.55); } .hamburger--elastic.is-active .hamburger-inner { transform: translate3d(0, 10px, 0) rotate(135deg); transition-delay: 0.075s; } .hamburger--elastic.is-active .hamburger-inner::before { transition-delay: 0s; opacity: 0; } .hamburger--elastic.is-active .hamburger-inner::after { transform: translate3d(0, -20px, 0) rotate(-270deg); transition-delay: 0.075s; }""" fontColorHeader : { a | darkHeader : Bool , theme : { mode : R10.Mode.Mode , primaryColor : R10.Color.Internal.Primary.Color } } -> Color fontColorHeader args = let theme = args.theme in if args.darkHeader then -- The header is always dark R10.Color.Svg.fontHighEmphasis { theme | mode = R10.Mode.Dark } else R10.Color.Svg.fontHighEmphasis theme {-| -} view : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg view model args = el [ padding 0 , width fill , R10.Transition.transition "background 0.4s" , htmlAttribute <| Html.Attributes.style "z-index" "20" , if args.darkHeader then case model.backgroundColor of Nothing -> R10.Color.AttrsBackground.buttonPrimary Just color -> Background.color color else Background.color <| rgba 1 1 1 (if args.isTop then 0.6 else 1 ) , let hamburgerColor = if model.sideMenuOpen then R10.Color.Svg.fontHighEmphasis args.theme else fontColorHeader args in inFront <| html <| Html.node "style" [] [ Html.text (css <| R10.Color.Utils.toCssRgba hamburgerColor) ] , inFront <| cover model args , inFront <| sideMenu model args , inFront <| humbergAndLogo model args ] <| header model args {-| -} header : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg header model args = el [ width fill , centerX , R10.FontSize.normal , paddingXY 30 0 , R10.Transition.transition "height 0.3s, box-shadow 0.5s" , Border.shadow { offset = ( 0, 0 ) , size = 0 , blur = 8 , color = rgba 0 0 0 (if args.isTop then 0 else 0.3 ) } , height <| px (if args.isTop then 80 else 60 ) ] <| row [ alignRight , moveDown (fromTop args.isTop + 10) , spacing 30 ] (args.extraContentRightSide ++ userSection model args ) {-| -} userSection : Header -> ViewArgs z msg route -> List (Element (R10.Context.ContextInternal z) msg) userSection model args = [ el [ R10.Transition.transition "transform 0.2s" , inFront <| if model.userMenuOpen then userMenu model args else none ] <| let transition = R10.Transition.transition "opacity 0.5s" emptyButton = el [ alpha 0, transition ] none in case model.session of SessionNotRequired -> rightArea model args emptyButton SessionNotRequested -> rightArea model args emptyButton SessionFetching -> rightArea model args emptyButton SessionSuccess user -> rightArea model args (el [ transition , htmlAttribute <| Html.Attributes.class "visibleDesktop" ] <| text user.email ) SessionError _ -> rightArea model args (el [ transition , htmlAttribute <| Html.Attributes.class "visibleDesktop" ] <| loginButton model args ) ] {-| -} rightArea : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg -> Element (R10.Context.ContextInternal z) msg rightArea model args loginButtonElement = map args.msgMapper <| Input.button [ alignRight , htmlAttribute <| Html.Attributes.id userMenuId ] { label = row [] [ loginButtonElement , rightMenuButton args.darkHeader args.theme ] , onPress = Just ToggleUserMenu } {-| -} rightMenuButton : Bool -> R10.Theme.Theme -> Element (R10.Context.ContextInternal z) msg rightMenuButton darkHeader theme = el [ Font.size 26 , paddingXY 14 6 , Border.rounded 60 , Font.bold , Font.color <| logoColor darkHeader theme , mouseOver [ Background.color <| rgba 0 0 0 0.05 ] , R10.Transition.transition "background 0.2s" ] <| text "⋮" userMenuId : String userMenuId = "5gwi9fvj5" userMenuButtonId : String userMenuButtonId = "gl49gncaq" {-| -} dontBreakOut : List (Attribute (R10.Context.ContextInternal z) msg) dontBreakOut = -- -- From https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/ -- -- /* These are technically the same, but use both */ [ htmlAttribute <| Html.Attributes.style "overflow-wrap" "break-word" , htmlAttribute <| Html.Attributes.style "word-wrap" "break-word" , htmlAttribute <| Html.Attributes.style "-ms-word-break" "break-all" -- /* This is the dangerous one in WebKit, as it breaks things wherever */ , htmlAttribute <| Html.Attributes.style "word-break" "break-all" -- /* Instead use this non-standard one: */ , htmlAttribute <| Html.Attributes.style "word-break" "break-word" -- /* Adds a hyphen where the word breaks, if supported (No Blink) */ -- -ms-hyphens: auto; -- -moz-hyphens: auto; -- -webkit-hyphens: auto; -- hyphens: auto; ] {-| -} userMenu : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg userMenu model args = let loginArea = [ map args.msgMapper <| el [ centerX, paddingXY 0 30 ] <| loginButton model args ] in el (R10.Card.normal ++ [ height <| px 320 , width <| px 280 , moveDown 40 , moveRight 10 , alignRight , R10.FontSize.normal , htmlAttribute <| Html.Attributes.id userMenuId , R10.Color.AttrsBackground.surface2dp , padding 0 ] ) <| column [ scrollbarY , width fill ] <| [] -- TODO - change this so that it always work, also when user -- is not logged in -- -- loginButton model args.from ++ (case model.session of SessionNotRequired -> [ none ] SessionNotRequested -> [ none ] SessionFetching -> [ none ] SessionSuccess user -> [ column [ paddingXY 10 40 , Font.center , width fill , spacing 10 ] [ paragraph ([ Font.size 24 , spacing 0 , width fill ] ++ dontBreakOut ) [ text <| user.firstName ++ " " ++ user.lastName ] , paragraph ([ width fill ] ++ dontBreakOut) [ text user.email ] ] ] ++ menuSeparator SessionError _ -> loginArea ) ++ languageMenu model args ++ (case model.session of SessionNotRequired -> [] SessionNotRequested -> [] SessionFetching -> [] SessionSuccess _ -> [] ++ menuSeparator ++ [ map args.msgMapper <| logoutLink model args ] SessionError _ -> [] ) {-| -} logoutLink : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg logoutLink model args = if model.debuggingMode then Input.button attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signOut } , onPress = Just Logout } else link attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signOut } , url = model.urlLogout ++ "?from=" ++ args.from } {-| -} loginLink : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg loginLink model args = if model.debuggingMode then Input.button attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , onPress = Just Login } else link attrsLink { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , url = loginUrl model args } {-| -} loginUrl : Header -> ViewArgs z msg route -> String loginUrl model args = model.urlLogin ++ "?from=" ++ args.from {-| -} loginButton : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) Msg loginButton model args = if model.debuggingMode then Input.button (attrsButton ++ [ alignRight ]) { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , onPress = Just Login } else link (attrsButton ++ [ alignRight ]) { label = R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.signIn } , url = loginUrl model args } {-| -} attrsLink : List (Attribute (R10.Context.ContextInternal z) msg) attrsLink = [ mouseOver [ Background.color <| rgba 0 0 0 0.05 ] , R10.Transition.transition "background 0.2s" , width fill , paddingXY 20 13 ] {-| -} attrsButton : List (Attribute (R10.Context.ContextInternal z) msg) attrsButton = attrsLink ++ [ Border.width 1 , Border.color <| rgba 0 0 0 0.3 , Border.rounded 5 , paddingXY 20 10 , width shrink ] {-| -} fromTop : Bool -> number fromTop isTop = if isTop then 13 else 0 {-| -} logoColorAsString : Bool -> R10.Theme.Theme -> String logoColorAsString darkHeader theme = Color.Convert.colorToCssRgba <| logoColorColor darkHeader theme {-| -} logoColorColor : Bool -> R10.Theme.Theme -> Color.Color logoColorColor darkHeader theme = if darkHeader then Color.rgb 1 1 1 else R10.Color.Internal.Primary.toColor theme theme.primaryColor {-| -} logoColor : Bool -> R10.Theme.Theme -> Color logoColor darkHeader theme = R10.Color.Utils.fromColorColor <| logoColorColor darkHeader theme {-| -} humbergAndLogo : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg humbergAndLogo model args = row [ paddingXY 10 0 , spacing 10 ] [ map args.msgMapper <| el [ moveDown (fromTop args.isTop) , R10.Transition.transition "transform 0.2s" ] <| hamburger model.sideMenuOpen , R10.Libu.view [ moveDown (fromTop args.isTop + 2) , R10.Transition.transition "transform 0.2s" ] { label = logo (if model.sideMenuOpen then if R10.Mode.isLight args.theme.mode then args.logoOnLight else args.logoOnDark else args.logoOnDark ) , type_ = R10.Libu.LiInternal args.urlTop args.onClick } ] hamburger : Bool -> Element (R10.Context.ContextInternal z) Msg hamburger sideMenuOpen = -- From https://jonsuh.com/hamburgers/ Input.button [ htmlAttribute <| Html.Attributes.class "hamburger" , htmlAttribute <| Html.Attributes.class "hamburger--elastic" , htmlAttribute <| Html.Attributes.classList [ ( "is-active", sideMenuOpen ) ] , htmlAttribute <| Html.Attributes.attribute "aria-label" "Left Side Menu button" , Border.rounded 60 , width <| px 60 , height <| px 60 , mouseOver [ Background.color <| rgba 0 0 0 0.05 ] , R10.Transition.transition "background 0.2s" , scale 0.7 ] { label = html <| Html.span [ Html.Attributes.class "hamburger-box" ] [ Html.span [ Html.Attributes.class "hamburger-inner" ] [] ] , onPress = Just ToggleSideMenu } {-| -} logo : Element (R10.Context.ContextInternal z) msg -> Element (R10.Context.ContextInternal z) msg logo elementLogo = el [ spacing 20 , htmlAttribute <| Html.Attributes.attribute "aria-label" "Top page" ] <| elementLogo {-| -} cover : { a | sideMenuOpen : Bool } -> { b | msgMapper : Msg -> msg } -> Element (R10.Context.ContextInternal z) msg cover model args = map args.msgMapper <| el ([ width fill , Background.color <| rgba 0 0 0 0.5 , htmlAttribute <| Html.Attributes.style "position" "fixed" , htmlAttribute <| Html.Attributes.style "height" "100vh" , R10.Transition.transition "opacity 0.2s, visibility 0.2s" , Events.onClick ToggleSideMenu ] ++ (if model.sideMenuOpen then [ alpha 1 , htmlAttribute <| Html.Attributes.style "visibility" "visible" ] else [ alpha 0 , htmlAttribute <| Html.Attributes.style "visibility" "hidden" ] ) ) none {-| -} argsToLanguage : ViewArgs z msg route -> R10.Language.Language argsToLanguage args = case args.languageSystem of LanguageInRoute languageInRoute -> languageInRoute.routeToLanguage languageInRoute.route LanguageInModel -> -- TODO - finish this part R10.Language.default {-| -} sideMenu : Header -> ViewArgs z msg route -> Element (R10.Context.ContextInternal z) msg sideMenu model args = column [ R10.Color.AttrsBackground.surface2dp , Border.shadow { offset = ( 0, 0 ), size = 0, blur = 12, color = rgba 0 0 0 0.3 } , R10.FontSize.normal , width <| px 300 , paddingEach { top = 60, right = 0, bottom = 20, left = 0 } , R10.Transition.transition "transform 0.2s" , htmlAttribute <| Html.Attributes.style "position" "fixed" , htmlAttribute <| Html.Attributes.style "height" "100vh" , scrollbarY , moveLeft <| if model.sideMenuOpen then 0 else 310 ] <| [] ++ args.extraContent ++ [ menuTitle [ R10.I18n.paragraph [] { renderingMode = R10.I18n.Normal , tagReplacer = \_ string -> string , translation = R10.Translations.language } ] ] ++ menuSeparator ++ languageMenu model args ++ menuSeparator ++ [ case model.session of SessionNotRequired -> none SessionNotRequested -> none SessionFetching -> none SessionSuccess _ -> map args.msgMapper <| logoutLink model args SessionError _ -> map args.msgMapper <| loginLink model args ] {-| -} languageMenu : Header -> ViewArgs z msg route -> List (Element (R10.Context.ContextInternal z) msg) languageMenu model args = List.map (\language -> let int = R10.Language.toStringLong R10.Language.International language loc = R10.Language.toStringLong R10.Language.Localization language label = text <| if int == loc then int else int ++ " (" ++ loc ++ ")" in -- Here we may need 2 ways for the language to work. -- -- One where the language is stored in the url. -- -- Another where the language is stored in the model -- -- if language == (argsToLanguage args) then if language == argsToLanguage args then el (attrsLink ++ [ Font.bold , htmlAttribute <| Html.Attributes.style "pointer-events" "none" ] ) label else case args.languageSystem of LanguageInRoute languageInRoute -> -- R10.Libu.view (attrsLink ++ [ map args.msgMapper <| Events.onClick CloseUserMenu ]) el [ mapAttribute args.msgMapper <| Events.onClick CloseUserMenu, width fill ] <| R10.Libu.view attrsLink -- R10.Libu.view attrsLink { label = label , type_ = R10.Libu.LiInternal (languageInRoute.routeToPath language languageInRoute.route) args.onClick } LanguageInModel -> -- TODO - Finish this part -- R10.Libu.view attrsLink -- { label = label -- , type_ = R10.Libu.Bu (Just <| languageInModel.changeLanguage language) -- } none ) model.supportedLanguageList -- EVENT DECODERS {-| -} keyDecoder : Json.Decode.Decoder KeyPressed keyDecoder = Json.Decode.field "key" Json.Decode.string |> Json.Decode.map toKeyPressed -- keyDecoder : Json.Decode.Decoder ( Msg, Bool ) -- keyDecoder = -- Json.Decode.field "key" Json.Decode.string -- |> Json.Decode.map toKeyPressed -- |> Json.Decode.map -- (\key -> -- ( KeyDown key, True ) -- ) {-| -} type KeyPressed = Escape | Enter | Space | Other {-| -} toKeyPressed : String -> KeyPressed toKeyPressed key = case key of "Escape" -> Escape "Enter" -> Enter " " -> Space _ -> Other -- Here we decode recursive stuff like -- [ "target", "parentNode", "parentNode", "parentNode", "parentNode", "id" ] {-| -} decoderPart1 : Json.Decode.Decoder (List String) decoderPart1 = Json.Decode.field "target" (decoderPart2 []) {-| -} decoderPart2 : List String -> Json.Decode.Decoder (List String) decoderPart2 acc = Json.Decode.oneOf [ Json.Decode.field "id" Json.Decode.string |> Json.Decode.andThen (\id -> Json.Decode.lazy (\_ -> decoderPart2 (id :: acc) |> Json.Decode.field "parentNode") ) , Json.Decode.succeed acc ] {-| -} extraCss : String extraCss = String.join "\n" [ -- -- "flext is a shorthand for the following CSS properties: -- -- flex-grow This property specifies how much of the remaining space in the flex container should be assigned to the item (the flex grow factor). -- Default to 0 -- -- flex-grow: inherit; -- flex-grow: initial; -- flex-grow: unset; -- -- flex-shrink -- flex-basis -- """ @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { .s { flex-basis: auto !important; } .s.r > .s { flex-basis: 0% !important; /* border: 1px solid red !important; */ } } """ ]
elm
[ { "context": "cord identification strings.\n-- Copyright (c) 2019 Bill St. Clair <billstclair@gmail.com>\n-- Some rights reserved.\n", "end": 185, "score": 0.9998575449, "start": 171, "tag": "NAME", "value": "Bill St. Clair" }, { "context": "on strings.\n-- Copyright (c) 2019 Bill St. Clair <billstclair@gmail.com>\n-- Some rights reserved.\n-- Distributed under th", "end": 208, "score": 0.999931097, "start": 187, "tag": "EMAIL", "value": "billstclair@gmail.com" } ]
src/IdSearch.elm
billstclair/elm-id-search
1
---------------------------------------------------------------------- -- -- IdSearch.elm -- Search for substrings in record identification strings. -- Copyright (c) 2019 Bill St. Clair <billstclair@gmail.com> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE -- ---------------------------------------------------------------------- module IdSearch exposing ( Table, makeTable , insert, insertList, lookup, remove , findSubstrings ) {-| Indexes a set of records by identifying strings. ## Create a table @docs Table, makeTable ## Insert and lookup @docs insert, insertList, lookup, remove ## Utilities @docs findSubstrings -} import Dict exposing (Dict) import Dict.Extra as DE import List.Extra as LE {-| The table type. -} type alias Table a = { getIdentifiers : a -> List String , dictCount : Int , dicts : List (Dict String (List a)) } {-| Make a table. makeTable dictCount getIdentifiers `dictCount` is the number of dictionaries to populate. The dictionaries map prefixes of the search string to matches. If the search string is longer than `dictCount`, then a linear search is done on the results from the final dictionary. This provides a tradeoff between insertion speed, storage space, and lookup speed. A `dictCount` of 3 or 4 is probably right for most applications. The list of strings returned by `getIdentifiers` are the indices for an inserted element. Usually, there will only be one. -} makeTable : Int -> (a -> List String) -> Table a makeTable dictCount getIdentifiers = let cnt = max dictCount 1 in { getIdentifiers = getIdentifiers , dictCount = cnt , dicts = List.map (\_ -> Dict.empty) <| List.range 1 cnt } {-| Insert a record in the table. -} insert : a -> Table a -> Table a insert a table = let identifiers = table.getIdentifiers a dictInsert substr d = let elts = Dict.get substr d |> Maybe.withDefault [] in if List.member a elts then d else Dict.insert substr (a :: elts) d loop : Int -> List (Dict String (List a)) -> List (Dict String (List a)) -> List (Dict String (List a)) loop idx dicts res = case dicts of [] -> List.reverse res dict :: moreDicts -> let substrs = List.map (findSubstrings idx) identifiers |> List.concat newDict = List.foldl dictInsert dict substrs in loop (idx + 1) moreDicts (newDict :: res) in { table | dicts = loop 1 table.dicts [] } {-| Insert multiple elements into a table. -} insertList : List a -> Table a -> Table a insertList list table = List.foldl insert table list {-| Lookup a string in a table. -} lookup : String -> Table a -> List a lookup string table = let len = String.length string dictCount = table.dictCount ( idx, key ) = if dictCount < len then ( dictCount - 1, String.left dictCount string ) else ( len - 1, string ) dict = LE.getAt idx table.dicts |> Maybe.withDefault Dict.empty in case Dict.get key dict of Nothing -> [] Just hits -> if dictCount == len then hits else List.filter (\hit -> let ids = table.getIdentifiers hit in case LE.find (\id -> String.contains string id) ids of Nothing -> False Just _ -> True ) hits {-| Remove a record from a table. This implementation is slow, looping over every element of every dictionary, since I don't expect it to be used much. -} remove : a -> Table a -> Table a remove a table = let removeOne : Dict String (List a) -> Dict String (List a) removeOne dict = DE.filterMap (\_ l -> if List.member a l then case LE.remove a l of [] -> Nothing l2 -> Just l2 else Just l ) dict in { table | dicts = List.map removeOne table.dicts } {-| Get a string's substrings of a given length. If the length is 1, returns only the first character in the string. None of the substrings will contain spaces. Each element in the returned list will be unique. -} findSubstrings : Int -> String -> List String findSubstrings length string = if length == 0 then [] else if length == 1 then if String.length string > 0 then [ String.left 1 string ] else [] else let maxidx = String.length string - length loop : Int -> String -> List String -> List String loop idx tail res = if idx > maxidx then List.reverse res else let substr = String.left length tail in loop (idx + 1) (String.dropLeft 1 tail) (if String.contains " " substr || List.member substr res then res else String.left length tail :: res ) in loop 0 string []
43992
---------------------------------------------------------------------- -- -- IdSearch.elm -- Search for substrings in record identification strings. -- Copyright (c) 2019 <NAME> <<EMAIL>> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE -- ---------------------------------------------------------------------- module IdSearch exposing ( Table, makeTable , insert, insertList, lookup, remove , findSubstrings ) {-| Indexes a set of records by identifying strings. ## Create a table @docs Table, makeTable ## Insert and lookup @docs insert, insertList, lookup, remove ## Utilities @docs findSubstrings -} import Dict exposing (Dict) import Dict.Extra as DE import List.Extra as LE {-| The table type. -} type alias Table a = { getIdentifiers : a -> List String , dictCount : Int , dicts : List (Dict String (List a)) } {-| Make a table. makeTable dictCount getIdentifiers `dictCount` is the number of dictionaries to populate. The dictionaries map prefixes of the search string to matches. If the search string is longer than `dictCount`, then a linear search is done on the results from the final dictionary. This provides a tradeoff between insertion speed, storage space, and lookup speed. A `dictCount` of 3 or 4 is probably right for most applications. The list of strings returned by `getIdentifiers` are the indices for an inserted element. Usually, there will only be one. -} makeTable : Int -> (a -> List String) -> Table a makeTable dictCount getIdentifiers = let cnt = max dictCount 1 in { getIdentifiers = getIdentifiers , dictCount = cnt , dicts = List.map (\_ -> Dict.empty) <| List.range 1 cnt } {-| Insert a record in the table. -} insert : a -> Table a -> Table a insert a table = let identifiers = table.getIdentifiers a dictInsert substr d = let elts = Dict.get substr d |> Maybe.withDefault [] in if List.member a elts then d else Dict.insert substr (a :: elts) d loop : Int -> List (Dict String (List a)) -> List (Dict String (List a)) -> List (Dict String (List a)) loop idx dicts res = case dicts of [] -> List.reverse res dict :: moreDicts -> let substrs = List.map (findSubstrings idx) identifiers |> List.concat newDict = List.foldl dictInsert dict substrs in loop (idx + 1) moreDicts (newDict :: res) in { table | dicts = loop 1 table.dicts [] } {-| Insert multiple elements into a table. -} insertList : List a -> Table a -> Table a insertList list table = List.foldl insert table list {-| Lookup a string in a table. -} lookup : String -> Table a -> List a lookup string table = let len = String.length string dictCount = table.dictCount ( idx, key ) = if dictCount < len then ( dictCount - 1, String.left dictCount string ) else ( len - 1, string ) dict = LE.getAt idx table.dicts |> Maybe.withDefault Dict.empty in case Dict.get key dict of Nothing -> [] Just hits -> if dictCount == len then hits else List.filter (\hit -> let ids = table.getIdentifiers hit in case LE.find (\id -> String.contains string id) ids of Nothing -> False Just _ -> True ) hits {-| Remove a record from a table. This implementation is slow, looping over every element of every dictionary, since I don't expect it to be used much. -} remove : a -> Table a -> Table a remove a table = let removeOne : Dict String (List a) -> Dict String (List a) removeOne dict = DE.filterMap (\_ l -> if List.member a l then case LE.remove a l of [] -> Nothing l2 -> Just l2 else Just l ) dict in { table | dicts = List.map removeOne table.dicts } {-| Get a string's substrings of a given length. If the length is 1, returns only the first character in the string. None of the substrings will contain spaces. Each element in the returned list will be unique. -} findSubstrings : Int -> String -> List String findSubstrings length string = if length == 0 then [] else if length == 1 then if String.length string > 0 then [ String.left 1 string ] else [] else let maxidx = String.length string - length loop : Int -> String -> List String -> List String loop idx tail res = if idx > maxidx then List.reverse res else let substr = String.left length tail in loop (idx + 1) (String.dropLeft 1 tail) (if String.contains " " substr || List.member substr res then res else String.left length tail :: res ) in loop 0 string []
true
---------------------------------------------------------------------- -- -- IdSearch.elm -- Search for substrings in record identification strings. -- Copyright (c) 2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE -- ---------------------------------------------------------------------- module IdSearch exposing ( Table, makeTable , insert, insertList, lookup, remove , findSubstrings ) {-| Indexes a set of records by identifying strings. ## Create a table @docs Table, makeTable ## Insert and lookup @docs insert, insertList, lookup, remove ## Utilities @docs findSubstrings -} import Dict exposing (Dict) import Dict.Extra as DE import List.Extra as LE {-| The table type. -} type alias Table a = { getIdentifiers : a -> List String , dictCount : Int , dicts : List (Dict String (List a)) } {-| Make a table. makeTable dictCount getIdentifiers `dictCount` is the number of dictionaries to populate. The dictionaries map prefixes of the search string to matches. If the search string is longer than `dictCount`, then a linear search is done on the results from the final dictionary. This provides a tradeoff between insertion speed, storage space, and lookup speed. A `dictCount` of 3 or 4 is probably right for most applications. The list of strings returned by `getIdentifiers` are the indices for an inserted element. Usually, there will only be one. -} makeTable : Int -> (a -> List String) -> Table a makeTable dictCount getIdentifiers = let cnt = max dictCount 1 in { getIdentifiers = getIdentifiers , dictCount = cnt , dicts = List.map (\_ -> Dict.empty) <| List.range 1 cnt } {-| Insert a record in the table. -} insert : a -> Table a -> Table a insert a table = let identifiers = table.getIdentifiers a dictInsert substr d = let elts = Dict.get substr d |> Maybe.withDefault [] in if List.member a elts then d else Dict.insert substr (a :: elts) d loop : Int -> List (Dict String (List a)) -> List (Dict String (List a)) -> List (Dict String (List a)) loop idx dicts res = case dicts of [] -> List.reverse res dict :: moreDicts -> let substrs = List.map (findSubstrings idx) identifiers |> List.concat newDict = List.foldl dictInsert dict substrs in loop (idx + 1) moreDicts (newDict :: res) in { table | dicts = loop 1 table.dicts [] } {-| Insert multiple elements into a table. -} insertList : List a -> Table a -> Table a insertList list table = List.foldl insert table list {-| Lookup a string in a table. -} lookup : String -> Table a -> List a lookup string table = let len = String.length string dictCount = table.dictCount ( idx, key ) = if dictCount < len then ( dictCount - 1, String.left dictCount string ) else ( len - 1, string ) dict = LE.getAt idx table.dicts |> Maybe.withDefault Dict.empty in case Dict.get key dict of Nothing -> [] Just hits -> if dictCount == len then hits else List.filter (\hit -> let ids = table.getIdentifiers hit in case LE.find (\id -> String.contains string id) ids of Nothing -> False Just _ -> True ) hits {-| Remove a record from a table. This implementation is slow, looping over every element of every dictionary, since I don't expect it to be used much. -} remove : a -> Table a -> Table a remove a table = let removeOne : Dict String (List a) -> Dict String (List a) removeOne dict = DE.filterMap (\_ l -> if List.member a l then case LE.remove a l of [] -> Nothing l2 -> Just l2 else Just l ) dict in { table | dicts = List.map removeOne table.dicts } {-| Get a string's substrings of a given length. If the length is 1, returns only the first character in the string. None of the substrings will contain spaces. Each element in the returned list will be unique. -} findSubstrings : Int -> String -> List String findSubstrings length string = if length == 0 then [] else if length == 1 then if String.length string > 0 then [ String.left 1 string ] else [] else let maxidx = String.length string - length loop : Int -> String -> List String -> List String loop idx tail res = if idx > maxidx then List.reverse res else let substr = String.left length tail in loop (idx + 1) (String.dropLeft 1 tail) (if String.contains " " substr || List.member substr res then res else String.left length tail :: res ) in loop 0 string []
elm
[ { "context": "[ text <| String.fromChar (Char.fromCode 169) ++ \" Mark Farmiloe\"\n , p [] [ text <| String.fromInt model.us", "end": 7314, "score": 0.9998521805, "start": 7301, "tag": "NAME", "value": "Mark Farmiloe" } ]
src/Main.elm
MarkFarmiloe/rpsls-game
0
module Main exposing (..) import Browser import Delay import Html exposing (Html, button, div, h1, img, li, p, text) import Html.Attributes exposing (class, classList, src) import Html.Events exposing (onClick) import Html.Keyed as Keyed import Random type Stage = Start | UserSelected Gesture | ComputerHighlighting Gesture Gesture | Outcome Gesture Gesture type Gesture = Rock | Paper | Scissors | Lizard | Spock type Winner = Draw | User | Computer stageToString : Stage -> String stageToString stage = case stage of Start -> "Start" UserSelected ug -> "Playing " ++ gestureToString ug ComputerHighlighting _ cg -> "Computer highlighting " ++ gestureToString cg Outcome ug cg -> "Outcome " ++ gestureToString ug ++ " " ++ gestureToString cg gestureToString : Gesture -> String gestureToString gesture = case gesture of Rock -> "Rock" Paper -> "Paper" Scissors -> "Scissors" Lizard -> "Lizard" Spock -> "Spock" winnerToString : Winner -> String winnerToString result = case result of Draw -> "It's a draw - let's try again" User -> "You win" Computer -> "You lost" winner : Gesture -> Gesture -> Winner winner ug cg = if ug == cg then Draw else case ( ug, cg ) of ( Rock, Scissors ) -> User ( Rock, Lizard ) -> User ( Paper, Rock ) -> User ( Paper, Spock ) -> User ( Scissors, Paper ) -> User ( Scissors, Lizard ) -> User ( Lizard, Paper ) -> User ( Lizard, Spock ) -> User ( Spock, Rock ) -> User ( Spock, Scissors ) -> User ( _, _ ) -> Computer -- MAIN main : Program () Model Msg main = Browser.element { init = init , view = view , update = update , subscriptions = subscriptions } -- MODEL type alias Model = { stage : Stage , userScore : Int , computerScore : Int } init : () -> ( Model, Cmd Msg ) init _ = ( Model Start 0 0 , Cmd.none ) -- UPDATE type Msg = PlayAgain | UserGestureClicked Gesture | ComputerGestureSelected Int | ComputerGestureHighlighted Int Int | ShowOutcome Gesture intToGesture : Int -> Gesture intToGesture n = case modBy 5 n of 1 -> Rock 2 -> Paper 3 -> Scissors 4 -> Lizard _ -> Spock update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of UserGestureClicked gesture -> ( { model | stage = UserSelected gesture } , Random.generate ComputerGestureSelected (Random.int 1 5) ) ComputerGestureSelected n -> -- let -- steps = -- List.range 2 (n + 4) -- |> List.map (\x -> Delay.after (200 * x) (ComputerGestureHighlighted <| cg x)) -- in ( model, Delay.after 100 <| ComputerGestureHighlighted 1 (n + 5) ) -- <| cg 1) :: steps ++ [ Delay.after (200 * (n + 6)) (ShowOutcome <| cg n) ]) ) ComputerGestureHighlighted count n -> let userG = case model.stage of UserSelected ug -> ug ComputerHighlighting userg _ -> userg _ -> Rock in if count < n then ( { model | stage = ComputerHighlighting userG <| intToGesture count }, Delay.after 200 (ComputerGestureHighlighted (count + 1) n) ) else ( model, Delay.after 100 (ShowOutcome <| intToGesture n) ) ShowOutcome cg -> case model.stage of ComputerHighlighting userG _ -> let theWinner = winner userG cg newUserScore = model.userScore + (if theWinner == User then 1 else 0 ) newComputerScore = model.computerScore + (if theWinner == Computer then 1 else 0 ) in ( { model | stage = Outcome userG cg, userScore = newUserScore, computerScore = newComputerScore } , Cmd.none ) _ -> ( model, Cmd.none ) PlayAgain -> ( { model | stage = Start }, Cmd.none ) -- VIEW view : Model -> Html Msg view model = div [] (viewHeader model ++ (viewContent model :: viewFooter model)) viewHeader : Model -> List (Html msg) viewHeader model = let activeGame = model.userScore + model.computerScore > 0 in if activeGame then [ h1 [] [ text "Rock, Paper, Scissors, Lizard, Spock" ] , p [] [ text "Your chance to play the iconic game from The Big Bang Theory." ] , p [] [ text "Select your gesture to start the game." ] , p [] [ text ("Scores: You - " ++ String.fromInt model.userScore ++ " Computer - " ++ String.fromInt model.computerScore ) ] ] else [ h1 [] [ text "Rock, Paper, Scissors, Lizard, Spock" ] , p [] [ text "Your chance to play the iconic game from The Big Bang Theory." ] , p [] [ text "Select your gesture to start the game." ] ] viewContent : Model -> Html Msg viewContent model = Keyed.node "ul" [] (case model.stage of Start -> [ ( "user", viewUserGesture Nothing ) ] UserSelected gesture -> [ ( "user", viewUserGesture (Just gesture) ) ] ComputerHighlighting userG computerG -> [ ( "user", viewUserGesture (Just userG) ) , ( "computer", viewComputerGesture computerG Nothing ) ] Outcome userG computerG -> [ ( "user", viewUserGesture (Just userG) ) , ( "result", viewResult userG computerG ) , ( "computer", viewComputerGesture computerG (Just computerG) ) ] ) viewFooter : Model -> List (Html msg) viewFooter model = [ div [] [ text <| String.fromChar (Char.fromCode 169) ++ " Mark Farmiloe" , p [] [ text <| String.fromInt model.userScore ++ " " ++ String.fromInt model.computerScore ] -- , p [] [ text <| stageToString model.stage ] ] ] viewUserGesture : Maybe Gesture -> Html Msg viewUserGesture maybeGesture = viewGestureWheel Nothing maybeGesture viewResult : Gesture -> Gesture -> Html Msg viewResult userG computerG = div [ class "result" ] [ text <| winnerToString <| winner userG computerG , button [ onClick PlayAgain ] [ text "Play again" ] ] viewComputerGesture : Gesture -> Maybe Gesture -> Html Msg viewComputerGesture highlightedGesture maybeGesture = viewGestureWheel (Just highlightedGesture) maybeGesture viewGesture : Gesture -> Bool -> Bool -> Bool -> Html Msg viewGesture gesture selected highlighted clickable = let source = case gesture of Rock -> "assets/rock.png" Paper -> "assets/paper.png" Scissors -> "assets/scissors.png" Lizard -> "assets/lizard.png" Spock -> "assets/spock.png" in if clickable then div [ class "gesture-container", classList [ ( "selected", selected ), ( "highlighted", highlighted ) ], onClick (UserGestureClicked gesture) ] [ img [ class "gesture", src source ] [] ] else div [ class "gesture-container", classList [ ( "selected", selected ), ( "highlighted", highlighted ) ] ] [ img [ class "gesture", src source ] [] ] viewGestureWheel : Maybe Gesture -> Maybe Gesture -> Html Msg viewGestureWheel maybeHighlightedGesture maybeGesture = let highlighted gesture = case maybeHighlightedGesture of Just aGesture -> aGesture == gesture Nothing -> False selected gesture = case maybeGesture of Just aGesture -> aGesture == gesture Nothing -> False clickable = maybeHighlightedGesture == Nothing && maybeGesture == Nothing classA = if maybeHighlightedGesture == Nothing then "user" else "computer" in li [ classList [ ( "gesture-wheel", True ), ( classA, True ), ( "selected", maybeGesture /= Nothing ) ] ] [ viewGesture Rock (selected Rock) (highlighted Rock) clickable , viewGesture Paper (selected Paper) (highlighted Paper) clickable , viewGesture Scissors (selected Scissors) (highlighted Scissors) clickable , viewGesture Lizard (selected Lizard) (highlighted Lizard) clickable , viewGesture Spock (selected Spock) (highlighted Spock) clickable ] -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions _ = Sub.none
3247
module Main exposing (..) import Browser import Delay import Html exposing (Html, button, div, h1, img, li, p, text) import Html.Attributes exposing (class, classList, src) import Html.Events exposing (onClick) import Html.Keyed as Keyed import Random type Stage = Start | UserSelected Gesture | ComputerHighlighting Gesture Gesture | Outcome Gesture Gesture type Gesture = Rock | Paper | Scissors | Lizard | Spock type Winner = Draw | User | Computer stageToString : Stage -> String stageToString stage = case stage of Start -> "Start" UserSelected ug -> "Playing " ++ gestureToString ug ComputerHighlighting _ cg -> "Computer highlighting " ++ gestureToString cg Outcome ug cg -> "Outcome " ++ gestureToString ug ++ " " ++ gestureToString cg gestureToString : Gesture -> String gestureToString gesture = case gesture of Rock -> "Rock" Paper -> "Paper" Scissors -> "Scissors" Lizard -> "Lizard" Spock -> "Spock" winnerToString : Winner -> String winnerToString result = case result of Draw -> "It's a draw - let's try again" User -> "You win" Computer -> "You lost" winner : Gesture -> Gesture -> Winner winner ug cg = if ug == cg then Draw else case ( ug, cg ) of ( Rock, Scissors ) -> User ( Rock, Lizard ) -> User ( Paper, Rock ) -> User ( Paper, Spock ) -> User ( Scissors, Paper ) -> User ( Scissors, Lizard ) -> User ( Lizard, Paper ) -> User ( Lizard, Spock ) -> User ( Spock, Rock ) -> User ( Spock, Scissors ) -> User ( _, _ ) -> Computer -- MAIN main : Program () Model Msg main = Browser.element { init = init , view = view , update = update , subscriptions = subscriptions } -- MODEL type alias Model = { stage : Stage , userScore : Int , computerScore : Int } init : () -> ( Model, Cmd Msg ) init _ = ( Model Start 0 0 , Cmd.none ) -- UPDATE type Msg = PlayAgain | UserGestureClicked Gesture | ComputerGestureSelected Int | ComputerGestureHighlighted Int Int | ShowOutcome Gesture intToGesture : Int -> Gesture intToGesture n = case modBy 5 n of 1 -> Rock 2 -> Paper 3 -> Scissors 4 -> Lizard _ -> Spock update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of UserGestureClicked gesture -> ( { model | stage = UserSelected gesture } , Random.generate ComputerGestureSelected (Random.int 1 5) ) ComputerGestureSelected n -> -- let -- steps = -- List.range 2 (n + 4) -- |> List.map (\x -> Delay.after (200 * x) (ComputerGestureHighlighted <| cg x)) -- in ( model, Delay.after 100 <| ComputerGestureHighlighted 1 (n + 5) ) -- <| cg 1) :: steps ++ [ Delay.after (200 * (n + 6)) (ShowOutcome <| cg n) ]) ) ComputerGestureHighlighted count n -> let userG = case model.stage of UserSelected ug -> ug ComputerHighlighting userg _ -> userg _ -> Rock in if count < n then ( { model | stage = ComputerHighlighting userG <| intToGesture count }, Delay.after 200 (ComputerGestureHighlighted (count + 1) n) ) else ( model, Delay.after 100 (ShowOutcome <| intToGesture n) ) ShowOutcome cg -> case model.stage of ComputerHighlighting userG _ -> let theWinner = winner userG cg newUserScore = model.userScore + (if theWinner == User then 1 else 0 ) newComputerScore = model.computerScore + (if theWinner == Computer then 1 else 0 ) in ( { model | stage = Outcome userG cg, userScore = newUserScore, computerScore = newComputerScore } , Cmd.none ) _ -> ( model, Cmd.none ) PlayAgain -> ( { model | stage = Start }, Cmd.none ) -- VIEW view : Model -> Html Msg view model = div [] (viewHeader model ++ (viewContent model :: viewFooter model)) viewHeader : Model -> List (Html msg) viewHeader model = let activeGame = model.userScore + model.computerScore > 0 in if activeGame then [ h1 [] [ text "Rock, Paper, Scissors, Lizard, Spock" ] , p [] [ text "Your chance to play the iconic game from The Big Bang Theory." ] , p [] [ text "Select your gesture to start the game." ] , p [] [ text ("Scores: You - " ++ String.fromInt model.userScore ++ " Computer - " ++ String.fromInt model.computerScore ) ] ] else [ h1 [] [ text "Rock, Paper, Scissors, Lizard, Spock" ] , p [] [ text "Your chance to play the iconic game from The Big Bang Theory." ] , p [] [ text "Select your gesture to start the game." ] ] viewContent : Model -> Html Msg viewContent model = Keyed.node "ul" [] (case model.stage of Start -> [ ( "user", viewUserGesture Nothing ) ] UserSelected gesture -> [ ( "user", viewUserGesture (Just gesture) ) ] ComputerHighlighting userG computerG -> [ ( "user", viewUserGesture (Just userG) ) , ( "computer", viewComputerGesture computerG Nothing ) ] Outcome userG computerG -> [ ( "user", viewUserGesture (Just userG) ) , ( "result", viewResult userG computerG ) , ( "computer", viewComputerGesture computerG (Just computerG) ) ] ) viewFooter : Model -> List (Html msg) viewFooter model = [ div [] [ text <| String.fromChar (Char.fromCode 169) ++ " <NAME>" , p [] [ text <| String.fromInt model.userScore ++ " " ++ String.fromInt model.computerScore ] -- , p [] [ text <| stageToString model.stage ] ] ] viewUserGesture : Maybe Gesture -> Html Msg viewUserGesture maybeGesture = viewGestureWheel Nothing maybeGesture viewResult : Gesture -> Gesture -> Html Msg viewResult userG computerG = div [ class "result" ] [ text <| winnerToString <| winner userG computerG , button [ onClick PlayAgain ] [ text "Play again" ] ] viewComputerGesture : Gesture -> Maybe Gesture -> Html Msg viewComputerGesture highlightedGesture maybeGesture = viewGestureWheel (Just highlightedGesture) maybeGesture viewGesture : Gesture -> Bool -> Bool -> Bool -> Html Msg viewGesture gesture selected highlighted clickable = let source = case gesture of Rock -> "assets/rock.png" Paper -> "assets/paper.png" Scissors -> "assets/scissors.png" Lizard -> "assets/lizard.png" Spock -> "assets/spock.png" in if clickable then div [ class "gesture-container", classList [ ( "selected", selected ), ( "highlighted", highlighted ) ], onClick (UserGestureClicked gesture) ] [ img [ class "gesture", src source ] [] ] else div [ class "gesture-container", classList [ ( "selected", selected ), ( "highlighted", highlighted ) ] ] [ img [ class "gesture", src source ] [] ] viewGestureWheel : Maybe Gesture -> Maybe Gesture -> Html Msg viewGestureWheel maybeHighlightedGesture maybeGesture = let highlighted gesture = case maybeHighlightedGesture of Just aGesture -> aGesture == gesture Nothing -> False selected gesture = case maybeGesture of Just aGesture -> aGesture == gesture Nothing -> False clickable = maybeHighlightedGesture == Nothing && maybeGesture == Nothing classA = if maybeHighlightedGesture == Nothing then "user" else "computer" in li [ classList [ ( "gesture-wheel", True ), ( classA, True ), ( "selected", maybeGesture /= Nothing ) ] ] [ viewGesture Rock (selected Rock) (highlighted Rock) clickable , viewGesture Paper (selected Paper) (highlighted Paper) clickable , viewGesture Scissors (selected Scissors) (highlighted Scissors) clickable , viewGesture Lizard (selected Lizard) (highlighted Lizard) clickable , viewGesture Spock (selected Spock) (highlighted Spock) clickable ] -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions _ = Sub.none
true
module Main exposing (..) import Browser import Delay import Html exposing (Html, button, div, h1, img, li, p, text) import Html.Attributes exposing (class, classList, src) import Html.Events exposing (onClick) import Html.Keyed as Keyed import Random type Stage = Start | UserSelected Gesture | ComputerHighlighting Gesture Gesture | Outcome Gesture Gesture type Gesture = Rock | Paper | Scissors | Lizard | Spock type Winner = Draw | User | Computer stageToString : Stage -> String stageToString stage = case stage of Start -> "Start" UserSelected ug -> "Playing " ++ gestureToString ug ComputerHighlighting _ cg -> "Computer highlighting " ++ gestureToString cg Outcome ug cg -> "Outcome " ++ gestureToString ug ++ " " ++ gestureToString cg gestureToString : Gesture -> String gestureToString gesture = case gesture of Rock -> "Rock" Paper -> "Paper" Scissors -> "Scissors" Lizard -> "Lizard" Spock -> "Spock" winnerToString : Winner -> String winnerToString result = case result of Draw -> "It's a draw - let's try again" User -> "You win" Computer -> "You lost" winner : Gesture -> Gesture -> Winner winner ug cg = if ug == cg then Draw else case ( ug, cg ) of ( Rock, Scissors ) -> User ( Rock, Lizard ) -> User ( Paper, Rock ) -> User ( Paper, Spock ) -> User ( Scissors, Paper ) -> User ( Scissors, Lizard ) -> User ( Lizard, Paper ) -> User ( Lizard, Spock ) -> User ( Spock, Rock ) -> User ( Spock, Scissors ) -> User ( _, _ ) -> Computer -- MAIN main : Program () Model Msg main = Browser.element { init = init , view = view , update = update , subscriptions = subscriptions } -- MODEL type alias Model = { stage : Stage , userScore : Int , computerScore : Int } init : () -> ( Model, Cmd Msg ) init _ = ( Model Start 0 0 , Cmd.none ) -- UPDATE type Msg = PlayAgain | UserGestureClicked Gesture | ComputerGestureSelected Int | ComputerGestureHighlighted Int Int | ShowOutcome Gesture intToGesture : Int -> Gesture intToGesture n = case modBy 5 n of 1 -> Rock 2 -> Paper 3 -> Scissors 4 -> Lizard _ -> Spock update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of UserGestureClicked gesture -> ( { model | stage = UserSelected gesture } , Random.generate ComputerGestureSelected (Random.int 1 5) ) ComputerGestureSelected n -> -- let -- steps = -- List.range 2 (n + 4) -- |> List.map (\x -> Delay.after (200 * x) (ComputerGestureHighlighted <| cg x)) -- in ( model, Delay.after 100 <| ComputerGestureHighlighted 1 (n + 5) ) -- <| cg 1) :: steps ++ [ Delay.after (200 * (n + 6)) (ShowOutcome <| cg n) ]) ) ComputerGestureHighlighted count n -> let userG = case model.stage of UserSelected ug -> ug ComputerHighlighting userg _ -> userg _ -> Rock in if count < n then ( { model | stage = ComputerHighlighting userG <| intToGesture count }, Delay.after 200 (ComputerGestureHighlighted (count + 1) n) ) else ( model, Delay.after 100 (ShowOutcome <| intToGesture n) ) ShowOutcome cg -> case model.stage of ComputerHighlighting userG _ -> let theWinner = winner userG cg newUserScore = model.userScore + (if theWinner == User then 1 else 0 ) newComputerScore = model.computerScore + (if theWinner == Computer then 1 else 0 ) in ( { model | stage = Outcome userG cg, userScore = newUserScore, computerScore = newComputerScore } , Cmd.none ) _ -> ( model, Cmd.none ) PlayAgain -> ( { model | stage = Start }, Cmd.none ) -- VIEW view : Model -> Html Msg view model = div [] (viewHeader model ++ (viewContent model :: viewFooter model)) viewHeader : Model -> List (Html msg) viewHeader model = let activeGame = model.userScore + model.computerScore > 0 in if activeGame then [ h1 [] [ text "Rock, Paper, Scissors, Lizard, Spock" ] , p [] [ text "Your chance to play the iconic game from The Big Bang Theory." ] , p [] [ text "Select your gesture to start the game." ] , p [] [ text ("Scores: You - " ++ String.fromInt model.userScore ++ " Computer - " ++ String.fromInt model.computerScore ) ] ] else [ h1 [] [ text "Rock, Paper, Scissors, Lizard, Spock" ] , p [] [ text "Your chance to play the iconic game from The Big Bang Theory." ] , p [] [ text "Select your gesture to start the game." ] ] viewContent : Model -> Html Msg viewContent model = Keyed.node "ul" [] (case model.stage of Start -> [ ( "user", viewUserGesture Nothing ) ] UserSelected gesture -> [ ( "user", viewUserGesture (Just gesture) ) ] ComputerHighlighting userG computerG -> [ ( "user", viewUserGesture (Just userG) ) , ( "computer", viewComputerGesture computerG Nothing ) ] Outcome userG computerG -> [ ( "user", viewUserGesture (Just userG) ) , ( "result", viewResult userG computerG ) , ( "computer", viewComputerGesture computerG (Just computerG) ) ] ) viewFooter : Model -> List (Html msg) viewFooter model = [ div [] [ text <| String.fromChar (Char.fromCode 169) ++ " PI:NAME:<NAME>END_PI" , p [] [ text <| String.fromInt model.userScore ++ " " ++ String.fromInt model.computerScore ] -- , p [] [ text <| stageToString model.stage ] ] ] viewUserGesture : Maybe Gesture -> Html Msg viewUserGesture maybeGesture = viewGestureWheel Nothing maybeGesture viewResult : Gesture -> Gesture -> Html Msg viewResult userG computerG = div [ class "result" ] [ text <| winnerToString <| winner userG computerG , button [ onClick PlayAgain ] [ text "Play again" ] ] viewComputerGesture : Gesture -> Maybe Gesture -> Html Msg viewComputerGesture highlightedGesture maybeGesture = viewGestureWheel (Just highlightedGesture) maybeGesture viewGesture : Gesture -> Bool -> Bool -> Bool -> Html Msg viewGesture gesture selected highlighted clickable = let source = case gesture of Rock -> "assets/rock.png" Paper -> "assets/paper.png" Scissors -> "assets/scissors.png" Lizard -> "assets/lizard.png" Spock -> "assets/spock.png" in if clickable then div [ class "gesture-container", classList [ ( "selected", selected ), ( "highlighted", highlighted ) ], onClick (UserGestureClicked gesture) ] [ img [ class "gesture", src source ] [] ] else div [ class "gesture-container", classList [ ( "selected", selected ), ( "highlighted", highlighted ) ] ] [ img [ class "gesture", src source ] [] ] viewGestureWheel : Maybe Gesture -> Maybe Gesture -> Html Msg viewGestureWheel maybeHighlightedGesture maybeGesture = let highlighted gesture = case maybeHighlightedGesture of Just aGesture -> aGesture == gesture Nothing -> False selected gesture = case maybeGesture of Just aGesture -> aGesture == gesture Nothing -> False clickable = maybeHighlightedGesture == Nothing && maybeGesture == Nothing classA = if maybeHighlightedGesture == Nothing then "user" else "computer" in li [ classList [ ( "gesture-wheel", True ), ( classA, True ), ( "selected", maybeGesture /= Nothing ) ] ] [ viewGesture Rock (selected Rock) (highlighted Rock) clickable , viewGesture Paper (selected Paper) (highlighted Paper) clickable , viewGesture Scissors (selected Scissors) (highlighted Scissors) clickable , viewGesture Lizard (selected Lizard) (highlighted Lizard) clickable , viewGesture Spock (selected Spock) (highlighted Spock) clickable ] -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions _ = Sub.none
elm
[ { "context": "\n-- GabDecker top-level\n-- Copyright (c) 2018-2019 Bill St. Clair <billstclair@gmail.com>\n-- Some rights reserved.\n", "end": 149, "score": 0.9998722076, "start": 135, "tag": "NAME", "value": "Bill St. Clair" }, { "context": "-level\n-- Copyright (c) 2018-2019 Bill St. Clair <billstclair@gmail.com>\n-- Some rights reserved.\n-- Distributed under th", "end": 172, "score": 0.9999266863, "start": 151, "tag": "EMAIL", "value": "billstclair@gmail.com" }, { "context": "Cmd Msg )\ninit _ url key =\n { text = \"I love my @Angel\"\n , selection = Nothing\n , complete = ", "end": 3891, "score": 0.5523523688, "start": 3891, "tag": "USERNAME", "value": "" }, { "context": "d Msg )\ninit _ url key =\n { text = \"I love my @Angel\"\n , selection = Nothing\n , complete = \"\"\n ", "end": 3898, "score": 0.9113986492, "start": 3893, "tag": "USERNAME", "value": "Angel" }, { "context": " url = packageUrl\n , label = text \"billstclair/elm-id-search\"\n }\n ]\n ", "end": 12101, "score": 0.7523033619, "start": 12090, "tag": "USERNAME", "value": "billstclair" }, { "context": "geUrl =\n \"http://package.elm-lang.org/packages/billstclair/elm-id-search/latest\"\n\n\n\n---\n--- Read and parse t", "end": 12443, "score": 0.9990566373, "start": 12432, "tag": "USERNAME", "value": "billstclair" } ]
example/src/Main.elm
billstclair/elm-id-search
1
--------------------------------------------------------------------- -- -- Main.elm -- GabDecker top-level -- Copyright (c) 2018-2019 Bill St. Clair <billstclair@gmail.com> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE.txt -- -- Search for TODO to see remaining work. -- Also see ../TODO.md -- ---------------------------------------------------------------------- module Main exposing (main) import Browser exposing (Document, UrlRequest(..)) import Browser.Navigation as Navigation exposing (Key) import Cmd.Extra exposing (withCmd, withCmds, withNoCmd) import CustomElement.TextAreaTracker as Tracker import Element exposing ( Attribute , Color , Element , alignBottom , alignLeft , alignRight , centerX , centerY , column , el , height , image , link , padding , paddingEach , paragraph , px , row , spacing , text , textColumn , width ) import Element.Background as Background import Element.Border as Border import Element.Font as Font import Element.Input as Input exposing (button) import Html exposing (Html) import Html.Attributes as Attributes exposing (class, href, rel) import Html.Events exposing (onClick) import Http import IdSearch import Json.Decode as JD exposing (Decoder) import String.Extra as SE import Task import Url exposing (Url) idAttribute : String -> Attribute msg idAttribute id = Element.htmlAttribute <| Attributes.id id main = Browser.application { init = init , view = view , update = update , subscriptions = \m -> Sub.none , onUrlRequest = HandleUrlRequest , onUrlChange = HandleUrlChange } type BoyGirl = Boy | Girl type alias Names = { boys : List String , girls : List String } emptyNames : Names emptyNames = { boys = [] , girls = [] } getNames : BoyGirl -> Names -> List String getNames boygirl names = case boygirl of Boy -> names.boys Girl -> names.girls setNames : BoyGirl -> List String -> Names -> Names setNames boygirl nameList names = case boygirl of Boy -> { names | boys = nameList } Girl -> { names | girls = nameList } type WhichTable = BoyTable | GirlTable | BothTable whichTable : BoyGirl -> WhichTable whichTable boygirl = case boygirl of Boy -> BoyTable Girl -> GirlTable type alias Table = IdSearch.Table String type alias Tables = { boys : Table , girls : Table , both : Table } dictCount : Int dictCount = 3 makeTable : Table makeTable = IdSearch.makeTable dictCount (String.toLower >> List.singleton) emptyTables : Tables emptyTables = { boys = makeTable , girls = makeTable , both = makeTable } getTable : WhichTable -> Tables -> Table getTable which tables = case which of BoyTable -> tables.boys GirlTable -> tables.girls BothTable -> tables.both setTable : WhichTable -> Table -> Tables -> Tables setTable which table tables = case which of BoyTable -> { tables | boys = table } GirlTable -> { tables | girls = table } BothTable -> { tables | both = table } type alias Model = { text : String , selection : Maybe Tracker.Selection , complete : String , completions : List String , completeWhich : WhichTable , triggerSelection : Int , names : Names , tables : Tables , receivedOne : Bool , error : Maybe Http.Error } init : () -> Url -> Key -> ( Model, Cmd Msg ) init _ url key = { text = "I love my @Angel" , selection = Nothing , complete = "" , completions = [] , completeWhich = BothTable , triggerSelection = 0 , names = emptyNames , tables = emptyTables , receivedOne = False , error = Nothing } |> withCmds [ getNameFile boyNamesFile (ReceiveNames Boy) , getNameFile girlNamesFile (ReceiveNames Girl) ] type Msg = Noop | HandleUrlRequest UrlRequest | HandleUrlChange Url | ReceiveNames BoyGirl (Result Http.Error (List String)) | ChooseTable WhichTable | OnSelection Tracker.Selection | TextChanged String update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Noop -> model |> withNoCmd HandleUrlRequest request -> ( model , case request of Internal url -> Navigation.load <| Url.toString url External urlString -> Navigation.load urlString ) HandleUrlChange _ -> model |> withNoCmd ReceiveNames boygirl result -> receiveNames boygirl result model ChooseTable completeWhich -> textChanged model.text { model | completeWhich = completeWhich } OnSelection selection -> onSelection selection model TextChanged text -> textChanged text model textChanged : String -> Model -> ( Model, Cmd Msg ) textChanged text model = { model | text = text , triggerSelection = if String.contains "@" text then model.triggerSelection + 1 else model.triggerSelection } |> withNoCmd onSelection : Tracker.Selection -> Model -> ( Model, Cmd Msg ) onSelection selection mdl = let cursor = selection.selectionEnd model = { mdl | selection = Nothing , complete = "" , completions = [] } in if cursor /= selection.selectionStart then model |> withNoCmd else case findAtName cursor model.text of Nothing -> model |> withNoCmd Just complete -> let table = getTable model.completeWhich model.tables completions = IdSearch.lookup complete table |> sortNames complete in { model | selection = Just selection , complete = complete , completions = completions } |> withNoCmd findAtName : Int -> String -> Maybe String findAtName cursor string = let beginning = String.left cursor string |> String.toLower |> String.replace "\n" " " in if String.startsWith "@" beginning && not (String.contains " " beginning) then Just <| String.dropLeft 1 beginning else let res = SE.rightOfBack " @" beginning in if res /= "" && not (String.contains " " res) then Just res else Nothing sortNames : String -> List String -> List String sortNames prefix names = let tuples = List.map (\name -> ( if String.startsWith prefix name then 0 else 1 , name ) ) names in List.sort tuples |> List.map Tuple.second doCompletion : Model -> Cmd Msg doCompletion model = Task.perform TextChanged <| Task.succeed model.text receiveNames : BoyGirl -> Result Http.Error (List String) -> Model -> ( Model, Cmd Msg ) receiveNames boygirl result model = case result of Ok namelist -> let which = whichTable boygirl tables = model.tables newTable = IdSearch.insertList namelist <| getTable which tables newBoth = IdSearch.insertList namelist <| getTable BothTable tables in { model | names = setNames boygirl namelist model.names , receivedOne = True , tables = setTable which newTable tables |> setTable BothTable newBoth } |> withCmds [ if model.receivedOne then doCompletion model else Cmd.none ] Err error -> let err = Debug.log ("Error reading " ++ boygirlToString boygirl ++ " names: ") error in { model | error = Just err } |> withNoCmd boygirlToString : BoyGirl -> String boygirlToString boygirl = case boygirl of Boy -> "boy" Girl -> "girl" pageTitle : String pageTitle = "billstclair/elm-id-search Example" view : Model -> Document Msg view model = { title = pageTitle , body = [ Element.layout [] <| mainPage model , Tracker.textAreaTracker [ Tracker.textAreaId textAreaId , Tracker.triggerSelection model.triggerSelection , Tracker.onSelection OnSelection ] [] ] } scaled : Int -> Float scaled = Element.modular 16 1.25 fontSize : Int -> Attribute Msg fontSize scale = Font.size (round <| scaled scale) pad : Int pad = 10 textAreaId : String textAreaId = "textarea" mainPage : Model -> Element Msg mainPage model = column [ spacing pad , padding pad , fontSize 2 ] [ row [ fontSize 3 , Font.bold ] [ text pageTitle ] , paragraph [] [ text <| "Type some text below." ++ " Names beginning with \"@\" will show completions." ] , row [] [ Input.radioRow [ spacing pad ] { onChange = ChooseTable , selected = Just model.completeWhich , label = Input.labelLeft [] (text "Use names: ") , options = [ Input.option BoyTable (text "Boys") , Input.option GirlTable (text "Girls") , Input.option BothTable (text "Both") ] } ] , Input.multiline [ width <| px 600 , height <| px 300 , idAttribute textAreaId ] { onChange = TextChanged , text = model.text , placeholder = Nothing , label = Input.labelHidden "Text" , spellcheck = True } , paragraph [] [ case model.complete of "" -> text "Not completing." complete -> text <| ("Completing \"" ++ complete ++ "\": ") ++ (String.replace "," ", " <| stringListToString model.completions ) ] , row [] [ text <| String.fromInt (List.length model.names.boys) ++ " boy's names." , text <| String.fromInt (List.length model.names.girls) ++ " girl's names." ] , row [] [ link [ Font.underline , Element.mouseOver [ Font.color blue ] ] { url = packageUrl , label = text "billstclair/elm-id-search" } ] ] stringListToString : List String -> String stringListToString list = List.foldl (\s res -> res ++ ", " ++ s) "" list |> String.dropLeft 2 blue : Color blue = Element.rgb 0 0 1 packageUrl : String packageUrl = "http://package.elm-lang.org/packages/billstclair/elm-id-search/latest" --- --- Read and parse the names files --- namesDir : String namesDir = "names/" boyNamesFile : String boyNamesFile = namesDir ++ "boy-names.json" girlNamesFile : String girlNamesFile = namesDir ++ "girl-names.json" getNameFile : String -> (Result Http.Error (List String) -> Msg) -> Cmd Msg getNameFile file tagger = Http.get { url = file , expect = Http.expectJson tagger decodeNames } decodeNames : Decoder (List String) decodeNames = JD.field "names" <| JD.list JD.string
4059
--------------------------------------------------------------------- -- -- Main.elm -- GabDecker top-level -- Copyright (c) 2018-2019 <NAME> <<EMAIL>> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE.txt -- -- Search for TODO to see remaining work. -- Also see ../TODO.md -- ---------------------------------------------------------------------- module Main exposing (main) import Browser exposing (Document, UrlRequest(..)) import Browser.Navigation as Navigation exposing (Key) import Cmd.Extra exposing (withCmd, withCmds, withNoCmd) import CustomElement.TextAreaTracker as Tracker import Element exposing ( Attribute , Color , Element , alignBottom , alignLeft , alignRight , centerX , centerY , column , el , height , image , link , padding , paddingEach , paragraph , px , row , spacing , text , textColumn , width ) import Element.Background as Background import Element.Border as Border import Element.Font as Font import Element.Input as Input exposing (button) import Html exposing (Html) import Html.Attributes as Attributes exposing (class, href, rel) import Html.Events exposing (onClick) import Http import IdSearch import Json.Decode as JD exposing (Decoder) import String.Extra as SE import Task import Url exposing (Url) idAttribute : String -> Attribute msg idAttribute id = Element.htmlAttribute <| Attributes.id id main = Browser.application { init = init , view = view , update = update , subscriptions = \m -> Sub.none , onUrlRequest = HandleUrlRequest , onUrlChange = HandleUrlChange } type BoyGirl = Boy | Girl type alias Names = { boys : List String , girls : List String } emptyNames : Names emptyNames = { boys = [] , girls = [] } getNames : BoyGirl -> Names -> List String getNames boygirl names = case boygirl of Boy -> names.boys Girl -> names.girls setNames : BoyGirl -> List String -> Names -> Names setNames boygirl nameList names = case boygirl of Boy -> { names | boys = nameList } Girl -> { names | girls = nameList } type WhichTable = BoyTable | GirlTable | BothTable whichTable : BoyGirl -> WhichTable whichTable boygirl = case boygirl of Boy -> BoyTable Girl -> GirlTable type alias Table = IdSearch.Table String type alias Tables = { boys : Table , girls : Table , both : Table } dictCount : Int dictCount = 3 makeTable : Table makeTable = IdSearch.makeTable dictCount (String.toLower >> List.singleton) emptyTables : Tables emptyTables = { boys = makeTable , girls = makeTable , both = makeTable } getTable : WhichTable -> Tables -> Table getTable which tables = case which of BoyTable -> tables.boys GirlTable -> tables.girls BothTable -> tables.both setTable : WhichTable -> Table -> Tables -> Tables setTable which table tables = case which of BoyTable -> { tables | boys = table } GirlTable -> { tables | girls = table } BothTable -> { tables | both = table } type alias Model = { text : String , selection : Maybe Tracker.Selection , complete : String , completions : List String , completeWhich : WhichTable , triggerSelection : Int , names : Names , tables : Tables , receivedOne : Bool , error : Maybe Http.Error } init : () -> Url -> Key -> ( Model, Cmd Msg ) init _ url key = { text = "I love my @Angel" , selection = Nothing , complete = "" , completions = [] , completeWhich = BothTable , triggerSelection = 0 , names = emptyNames , tables = emptyTables , receivedOne = False , error = Nothing } |> withCmds [ getNameFile boyNamesFile (ReceiveNames Boy) , getNameFile girlNamesFile (ReceiveNames Girl) ] type Msg = Noop | HandleUrlRequest UrlRequest | HandleUrlChange Url | ReceiveNames BoyGirl (Result Http.Error (List String)) | ChooseTable WhichTable | OnSelection Tracker.Selection | TextChanged String update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Noop -> model |> withNoCmd HandleUrlRequest request -> ( model , case request of Internal url -> Navigation.load <| Url.toString url External urlString -> Navigation.load urlString ) HandleUrlChange _ -> model |> withNoCmd ReceiveNames boygirl result -> receiveNames boygirl result model ChooseTable completeWhich -> textChanged model.text { model | completeWhich = completeWhich } OnSelection selection -> onSelection selection model TextChanged text -> textChanged text model textChanged : String -> Model -> ( Model, Cmd Msg ) textChanged text model = { model | text = text , triggerSelection = if String.contains "@" text then model.triggerSelection + 1 else model.triggerSelection } |> withNoCmd onSelection : Tracker.Selection -> Model -> ( Model, Cmd Msg ) onSelection selection mdl = let cursor = selection.selectionEnd model = { mdl | selection = Nothing , complete = "" , completions = [] } in if cursor /= selection.selectionStart then model |> withNoCmd else case findAtName cursor model.text of Nothing -> model |> withNoCmd Just complete -> let table = getTable model.completeWhich model.tables completions = IdSearch.lookup complete table |> sortNames complete in { model | selection = Just selection , complete = complete , completions = completions } |> withNoCmd findAtName : Int -> String -> Maybe String findAtName cursor string = let beginning = String.left cursor string |> String.toLower |> String.replace "\n" " " in if String.startsWith "@" beginning && not (String.contains " " beginning) then Just <| String.dropLeft 1 beginning else let res = SE.rightOfBack " @" beginning in if res /= "" && not (String.contains " " res) then Just res else Nothing sortNames : String -> List String -> List String sortNames prefix names = let tuples = List.map (\name -> ( if String.startsWith prefix name then 0 else 1 , name ) ) names in List.sort tuples |> List.map Tuple.second doCompletion : Model -> Cmd Msg doCompletion model = Task.perform TextChanged <| Task.succeed model.text receiveNames : BoyGirl -> Result Http.Error (List String) -> Model -> ( Model, Cmd Msg ) receiveNames boygirl result model = case result of Ok namelist -> let which = whichTable boygirl tables = model.tables newTable = IdSearch.insertList namelist <| getTable which tables newBoth = IdSearch.insertList namelist <| getTable BothTable tables in { model | names = setNames boygirl namelist model.names , receivedOne = True , tables = setTable which newTable tables |> setTable BothTable newBoth } |> withCmds [ if model.receivedOne then doCompletion model else Cmd.none ] Err error -> let err = Debug.log ("Error reading " ++ boygirlToString boygirl ++ " names: ") error in { model | error = Just err } |> withNoCmd boygirlToString : BoyGirl -> String boygirlToString boygirl = case boygirl of Boy -> "boy" Girl -> "girl" pageTitle : String pageTitle = "billstclair/elm-id-search Example" view : Model -> Document Msg view model = { title = pageTitle , body = [ Element.layout [] <| mainPage model , Tracker.textAreaTracker [ Tracker.textAreaId textAreaId , Tracker.triggerSelection model.triggerSelection , Tracker.onSelection OnSelection ] [] ] } scaled : Int -> Float scaled = Element.modular 16 1.25 fontSize : Int -> Attribute Msg fontSize scale = Font.size (round <| scaled scale) pad : Int pad = 10 textAreaId : String textAreaId = "textarea" mainPage : Model -> Element Msg mainPage model = column [ spacing pad , padding pad , fontSize 2 ] [ row [ fontSize 3 , Font.bold ] [ text pageTitle ] , paragraph [] [ text <| "Type some text below." ++ " Names beginning with \"@\" will show completions." ] , row [] [ Input.radioRow [ spacing pad ] { onChange = ChooseTable , selected = Just model.completeWhich , label = Input.labelLeft [] (text "Use names: ") , options = [ Input.option BoyTable (text "Boys") , Input.option GirlTable (text "Girls") , Input.option BothTable (text "Both") ] } ] , Input.multiline [ width <| px 600 , height <| px 300 , idAttribute textAreaId ] { onChange = TextChanged , text = model.text , placeholder = Nothing , label = Input.labelHidden "Text" , spellcheck = True } , paragraph [] [ case model.complete of "" -> text "Not completing." complete -> text <| ("Completing \"" ++ complete ++ "\": ") ++ (String.replace "," ", " <| stringListToString model.completions ) ] , row [] [ text <| String.fromInt (List.length model.names.boys) ++ " boy's names." , text <| String.fromInt (List.length model.names.girls) ++ " girl's names." ] , row [] [ link [ Font.underline , Element.mouseOver [ Font.color blue ] ] { url = packageUrl , label = text "billstclair/elm-id-search" } ] ] stringListToString : List String -> String stringListToString list = List.foldl (\s res -> res ++ ", " ++ s) "" list |> String.dropLeft 2 blue : Color blue = Element.rgb 0 0 1 packageUrl : String packageUrl = "http://package.elm-lang.org/packages/billstclair/elm-id-search/latest" --- --- Read and parse the names files --- namesDir : String namesDir = "names/" boyNamesFile : String boyNamesFile = namesDir ++ "boy-names.json" girlNamesFile : String girlNamesFile = namesDir ++ "girl-names.json" getNameFile : String -> (Result Http.Error (List String) -> Msg) -> Cmd Msg getNameFile file tagger = Http.get { url = file , expect = Http.expectJson tagger decodeNames } decodeNames : Decoder (List String) decodeNames = JD.field "names" <| JD.list JD.string
true
--------------------------------------------------------------------- -- -- Main.elm -- GabDecker top-level -- Copyright (c) 2018-2019 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE.txt -- -- Search for TODO to see remaining work. -- Also see ../TODO.md -- ---------------------------------------------------------------------- module Main exposing (main) import Browser exposing (Document, UrlRequest(..)) import Browser.Navigation as Navigation exposing (Key) import Cmd.Extra exposing (withCmd, withCmds, withNoCmd) import CustomElement.TextAreaTracker as Tracker import Element exposing ( Attribute , Color , Element , alignBottom , alignLeft , alignRight , centerX , centerY , column , el , height , image , link , padding , paddingEach , paragraph , px , row , spacing , text , textColumn , width ) import Element.Background as Background import Element.Border as Border import Element.Font as Font import Element.Input as Input exposing (button) import Html exposing (Html) import Html.Attributes as Attributes exposing (class, href, rel) import Html.Events exposing (onClick) import Http import IdSearch import Json.Decode as JD exposing (Decoder) import String.Extra as SE import Task import Url exposing (Url) idAttribute : String -> Attribute msg idAttribute id = Element.htmlAttribute <| Attributes.id id main = Browser.application { init = init , view = view , update = update , subscriptions = \m -> Sub.none , onUrlRequest = HandleUrlRequest , onUrlChange = HandleUrlChange } type BoyGirl = Boy | Girl type alias Names = { boys : List String , girls : List String } emptyNames : Names emptyNames = { boys = [] , girls = [] } getNames : BoyGirl -> Names -> List String getNames boygirl names = case boygirl of Boy -> names.boys Girl -> names.girls setNames : BoyGirl -> List String -> Names -> Names setNames boygirl nameList names = case boygirl of Boy -> { names | boys = nameList } Girl -> { names | girls = nameList } type WhichTable = BoyTable | GirlTable | BothTable whichTable : BoyGirl -> WhichTable whichTable boygirl = case boygirl of Boy -> BoyTable Girl -> GirlTable type alias Table = IdSearch.Table String type alias Tables = { boys : Table , girls : Table , both : Table } dictCount : Int dictCount = 3 makeTable : Table makeTable = IdSearch.makeTable dictCount (String.toLower >> List.singleton) emptyTables : Tables emptyTables = { boys = makeTable , girls = makeTable , both = makeTable } getTable : WhichTable -> Tables -> Table getTable which tables = case which of BoyTable -> tables.boys GirlTable -> tables.girls BothTable -> tables.both setTable : WhichTable -> Table -> Tables -> Tables setTable which table tables = case which of BoyTable -> { tables | boys = table } GirlTable -> { tables | girls = table } BothTable -> { tables | both = table } type alias Model = { text : String , selection : Maybe Tracker.Selection , complete : String , completions : List String , completeWhich : WhichTable , triggerSelection : Int , names : Names , tables : Tables , receivedOne : Bool , error : Maybe Http.Error } init : () -> Url -> Key -> ( Model, Cmd Msg ) init _ url key = { text = "I love my @Angel" , selection = Nothing , complete = "" , completions = [] , completeWhich = BothTable , triggerSelection = 0 , names = emptyNames , tables = emptyTables , receivedOne = False , error = Nothing } |> withCmds [ getNameFile boyNamesFile (ReceiveNames Boy) , getNameFile girlNamesFile (ReceiveNames Girl) ] type Msg = Noop | HandleUrlRequest UrlRequest | HandleUrlChange Url | ReceiveNames BoyGirl (Result Http.Error (List String)) | ChooseTable WhichTable | OnSelection Tracker.Selection | TextChanged String update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Noop -> model |> withNoCmd HandleUrlRequest request -> ( model , case request of Internal url -> Navigation.load <| Url.toString url External urlString -> Navigation.load urlString ) HandleUrlChange _ -> model |> withNoCmd ReceiveNames boygirl result -> receiveNames boygirl result model ChooseTable completeWhich -> textChanged model.text { model | completeWhich = completeWhich } OnSelection selection -> onSelection selection model TextChanged text -> textChanged text model textChanged : String -> Model -> ( Model, Cmd Msg ) textChanged text model = { model | text = text , triggerSelection = if String.contains "@" text then model.triggerSelection + 1 else model.triggerSelection } |> withNoCmd onSelection : Tracker.Selection -> Model -> ( Model, Cmd Msg ) onSelection selection mdl = let cursor = selection.selectionEnd model = { mdl | selection = Nothing , complete = "" , completions = [] } in if cursor /= selection.selectionStart then model |> withNoCmd else case findAtName cursor model.text of Nothing -> model |> withNoCmd Just complete -> let table = getTable model.completeWhich model.tables completions = IdSearch.lookup complete table |> sortNames complete in { model | selection = Just selection , complete = complete , completions = completions } |> withNoCmd findAtName : Int -> String -> Maybe String findAtName cursor string = let beginning = String.left cursor string |> String.toLower |> String.replace "\n" " " in if String.startsWith "@" beginning && not (String.contains " " beginning) then Just <| String.dropLeft 1 beginning else let res = SE.rightOfBack " @" beginning in if res /= "" && not (String.contains " " res) then Just res else Nothing sortNames : String -> List String -> List String sortNames prefix names = let tuples = List.map (\name -> ( if String.startsWith prefix name then 0 else 1 , name ) ) names in List.sort tuples |> List.map Tuple.second doCompletion : Model -> Cmd Msg doCompletion model = Task.perform TextChanged <| Task.succeed model.text receiveNames : BoyGirl -> Result Http.Error (List String) -> Model -> ( Model, Cmd Msg ) receiveNames boygirl result model = case result of Ok namelist -> let which = whichTable boygirl tables = model.tables newTable = IdSearch.insertList namelist <| getTable which tables newBoth = IdSearch.insertList namelist <| getTable BothTable tables in { model | names = setNames boygirl namelist model.names , receivedOne = True , tables = setTable which newTable tables |> setTable BothTable newBoth } |> withCmds [ if model.receivedOne then doCompletion model else Cmd.none ] Err error -> let err = Debug.log ("Error reading " ++ boygirlToString boygirl ++ " names: ") error in { model | error = Just err } |> withNoCmd boygirlToString : BoyGirl -> String boygirlToString boygirl = case boygirl of Boy -> "boy" Girl -> "girl" pageTitle : String pageTitle = "billstclair/elm-id-search Example" view : Model -> Document Msg view model = { title = pageTitle , body = [ Element.layout [] <| mainPage model , Tracker.textAreaTracker [ Tracker.textAreaId textAreaId , Tracker.triggerSelection model.triggerSelection , Tracker.onSelection OnSelection ] [] ] } scaled : Int -> Float scaled = Element.modular 16 1.25 fontSize : Int -> Attribute Msg fontSize scale = Font.size (round <| scaled scale) pad : Int pad = 10 textAreaId : String textAreaId = "textarea" mainPage : Model -> Element Msg mainPage model = column [ spacing pad , padding pad , fontSize 2 ] [ row [ fontSize 3 , Font.bold ] [ text pageTitle ] , paragraph [] [ text <| "Type some text below." ++ " Names beginning with \"@\" will show completions." ] , row [] [ Input.radioRow [ spacing pad ] { onChange = ChooseTable , selected = Just model.completeWhich , label = Input.labelLeft [] (text "Use names: ") , options = [ Input.option BoyTable (text "Boys") , Input.option GirlTable (text "Girls") , Input.option BothTable (text "Both") ] } ] , Input.multiline [ width <| px 600 , height <| px 300 , idAttribute textAreaId ] { onChange = TextChanged , text = model.text , placeholder = Nothing , label = Input.labelHidden "Text" , spellcheck = True } , paragraph [] [ case model.complete of "" -> text "Not completing." complete -> text <| ("Completing \"" ++ complete ++ "\": ") ++ (String.replace "," ", " <| stringListToString model.completions ) ] , row [] [ text <| String.fromInt (List.length model.names.boys) ++ " boy's names." , text <| String.fromInt (List.length model.names.girls) ++ " girl's names." ] , row [] [ link [ Font.underline , Element.mouseOver [ Font.color blue ] ] { url = packageUrl , label = text "billstclair/elm-id-search" } ] ] stringListToString : List String -> String stringListToString list = List.foldl (\s res -> res ++ ", " ++ s) "" list |> String.dropLeft 2 blue : Color blue = Element.rgb 0 0 1 packageUrl : String packageUrl = "http://package.elm-lang.org/packages/billstclair/elm-id-search/latest" --- --- Read and parse the names files --- namesDir : String namesDir = "names/" boyNamesFile : String boyNamesFile = namesDir ++ "boy-names.json" girlNamesFile : String girlNamesFile = namesDir ++ "girl-names.json" getNameFile : String -> (Result Http.Error (List String) -> Msg) -> Cmd Msg getNameFile file tagger = Http.get { url = file , expect = Http.expectJson tagger decodeNames } decodeNames : Decoder (List String) decodeNames = JD.field "names" <| JD.list JD.string
elm
[ { "context": "le of using Custom Elements.\n-- Copyright (c) 2018 Bill St. Clair <billstclair@gmail.com>\n-- Some rights reserved.\n", "end": 159, "score": 0.9998668432, "start": 145, "tag": "NAME", "value": "Bill St. Clair" }, { "context": "m Elements.\n-- Copyright (c) 2018 Bill St. Clair <billstclair@gmail.com>\n-- Some rights reserved.\n-- Distributed under th", "end": 182, "score": 0.9999338388, "start": 161, "tag": "EMAIL", "value": "billstclair@gmail.com" }, { "context": " \"https://lisplog.org/\" ]\n [ text \"Bill St. Clair\" ]\n , br\n , text \"Source co", "end": 10360, "score": 0.9485813975, "start": 10346, "tag": "NAME", "value": "Bill St. Clair" }, { "context": "ode: \"\n , a [ href \"https://github.com/billstclair/elm-custom-element\" ]\n [ text \"git", "end": 10470, "score": 0.9959429502, "start": 10459, "tag": "USERNAME", "value": "billstclair" }, { "context": "tom-element\" ]\n [ text \"github.com/billstclair/elm-custom-element\" ]\n ]\n ]\n", "end": 10539, "score": 0.9974749684, "start": 10528, "tag": "USERNAME", "value": "billstclair" } ]
src/Main.elm
elm-review-bot/elm-custom-element
8
---------------------------------------------------------------------- -- -- Main.elm -- Example of using Custom Elements. -- Copyright (c) 2018 Bill St. Clair <billstclair@gmail.com> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE.txt -- ---------------------------------------------------------------------- module Main exposing (main) import Browser import Browser.Dom as Dom import Char import CustomElement.CodeEditor as Editor import CustomElement.FileListener as File exposing (File) import CustomElement.TextAreaTracker as Tracker exposing (Coordinates, Selection) import Html exposing ( Html , a , button , div , h1 , h2 , img , input , p , pre , text , textarea ) import Html.Attributes exposing ( accept , cols , href , id , rows , size , src , style , type_ , value , width ) import Html.Events exposing (onClick, onInput) import Iso8601 import Json.Encode as JE exposing (Value) import Task import Time main = Browser.element { init = init , update = update , view = view , subscriptions = \_ -> Sub.none } type alias Model = { file : Maybe File , value : String , text : String , coordinates : Maybe Coordinates , selection : Maybe Selection , selectionStart : String , selectionEnd : String , setSelection : Int , triggerCoordinates : Int , triggerSelection : Int } type Msg = Noop | SetFile File | CodeChanged String | SetText String | SetStart String | SetEnd String | SetSelection | TriggerCoordinates | TriggerSelection | Coordinates Coordinates | Selection Selection init : () -> ( Model, Cmd Msg ) init () = ( { file = Nothing , value = "module Main exposing (main)" ++ "\n\n" ++ "import Html" ++ "\n\n" ++ "main = Html.text \"Hello, World!\"" , text = "Four score and seven years ago,\nOur forefathers set forth..." , coordinates = Nothing , selection = Nothing , selectionStart = "1" , selectionEnd = "10" , setSelection = 0 , triggerCoordinates = 0 , triggerSelection = 0 } , Cmd.none ) focusId : String -> Cmd Msg focusId id = Task.attempt (\_ -> Noop) <| Dom.focus id update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Noop -> ( model, Cmd.none ) SetFile file -> ( { model | file = Just file } , Cmd.none ) CodeChanged value -> ( { model | value = value } , Cmd.none ) SetText text -> ( { model | text = text } , Cmd.none ) SetStart string -> ( { model | selectionStart = string } , Cmd.none ) SetEnd string -> ( { model | selectionEnd = string } , Cmd.none ) SetSelection -> ( { model | setSelection = model.setSelection + 1 } , focusId textAreaId ) TriggerCoordinates -> ( { model | triggerCoordinates = model.triggerCoordinates + 1 } , Cmd.none ) TriggerSelection -> ( { model | triggerSelection = model.triggerSelection + 1 } , Cmd.none ) Coordinates value -> ( { model | coordinates = Just value } , Cmd.none ) Selection value -> ( { model | selection = Just value } , Cmd.none ) coordinatesToString : Maybe Coordinates -> String coordinatesToString coordinates = case coordinates of Nothing -> "Click 'Trigger Coordinates' to update." Just c -> let cc = c.caretCoordinates in ("{ id = \"" ++ c.id ++ "\"\n") ++ (", selectionStart = " ++ String.fromInt c.selectionStart ++ "\n") ++ (", selectionEnd = " ++ String.fromInt c.selectionEnd ++ "\n") ++ ", caretCoordinates = \n" ++ (" { top = " ++ String.fromInt cc.top ++ "\n") ++ (" , left = " ++ String.fromInt cc.left ++ "\n") ++ " }\n" ++ "}" selectionToString : Maybe Selection -> String selectionToString selection = case selection of Nothing -> "Click 'Trigger Selection' to update." Just s -> ("{ id = \"" ++ s.id ++ "\"\n") ++ (", selectionStart = " ++ String.fromInt s.selectionStart ++ "\n") ++ (", selectionEnd = " ++ String.fromInt s.selectionEnd ++ "\n") ++ "}" copyright : String copyright = String.fromList [ Char.fromCode 169 ] br : Html msg br = Html.br [] [] b : String -> Html msg b string = Html.b [] [ text string ] borderStyle = "1px solid black" borderAttributes = [ style "border" borderStyle , style "vertical-align" "top" ] table rows = Html.table borderAttributes rows tr columns = Html.tr [] columns th elements = Html.th borderAttributes elements td elements = Html.td borderAttributes elements textAreaId : String textAreaId = "textarea" view : Model -> Html Msg view model = div [] [ h1 [] [ text "CustomElement Example" ] , p [] [ text "Examples of custom elements, used by Elm." ] , h2 [] [ text "text-area-tracker Custom Element" ] , p [] [ text "Edit the text below and click a 'Trigger' button." , br , text "Or change 'Start' and 'End' and click 'Set Selection'." ] , div [] [ textarea [ id textAreaId , rows 10 , cols 80 , onInput SetText ] [ text model.text ] , p [] [ text "Start: " , input [ type_ "text" , size 3 , onInput SetStart , value model.selectionStart ] [] , text " End: " , input [ type_ "text" , size 3 , onInput SetEnd , value model.selectionEnd ] [] , text " " , button [ onClick SetSelection ] [ text "Set Selection" ] , br , button [ onClick TriggerCoordinates ] [ text "Trigger Coordinates" ] , text " " , button [ onClick TriggerSelection ] [ text "Trigger Selection" ] ] , table [ tr [ th [ text "Coordinates" ] , th [ text "Selection" ] ] , tr [ td [ pre [] [ text <| coordinatesToString model.coordinates ] ] , td [ pre [] [ text <| selectionToString model.selection ] ] ] ] , let start = Maybe.withDefault 0 <| String.toInt model.selectionStart end = Maybe.withDefault 0 <| String.toInt model.selectionEnd count = model.setSelection in Tracker.textAreaTracker [ Tracker.textAreaId textAreaId , Tracker.setSelection start end count , Tracker.triggerCoordinates model.triggerCoordinates , Tracker.triggerSelection model.triggerSelection , Tracker.onCoordinates Coordinates , Tracker.onSelection Selection , id "tracker" ] [] ] , h2 [] [ text "file-listener Custom Element" ] , p [] [ text "Click the 'Choose File' button and choose an image file." , text " Information about the file and the image will appear." ] , div [] [ File.fileInput "fileid" [ accept "image/*" ] [ File.onLoad SetFile ] , br , case model.file of Nothing -> text "" Just file -> p [] [ b "Name: " , text file.name , br , b "Last Modified: " , text <| Iso8601.fromTime (Time.millisToPosix file.lastModified) , br , b "Mime Type: " , text file.mimeType , br , b "Size: " , text <| String.fromInt file.size , br , img [ src file.dataUrl , width 500 ] [] ] ] , h2 [] [ text "code-editor Custom Element" ] , p [] [ text "Edit the text below." , text " Notice that your edits appear in the area below that." ] , Editor.codeEditor [ Editor.editorValue model.value , Editor.onEditorChanged CodeChanged ] [] , p [] [ text "Text above echoed below:" ] , pre [] [ text model.value ] , p [] [ text <| copyright ++ " 2018 " , a [ href "https://lisplog.org/" ] [ text "Bill St. Clair" ] , br , text "Source code: " , a [ href "https://github.com/billstclair/elm-custom-element" ] [ text "github.com/billstclair/elm-custom-element" ] ] ]
22490
---------------------------------------------------------------------- -- -- Main.elm -- Example of using Custom Elements. -- Copyright (c) 2018 <NAME> <<EMAIL>> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE.txt -- ---------------------------------------------------------------------- module Main exposing (main) import Browser import Browser.Dom as Dom import Char import CustomElement.CodeEditor as Editor import CustomElement.FileListener as File exposing (File) import CustomElement.TextAreaTracker as Tracker exposing (Coordinates, Selection) import Html exposing ( Html , a , button , div , h1 , h2 , img , input , p , pre , text , textarea ) import Html.Attributes exposing ( accept , cols , href , id , rows , size , src , style , type_ , value , width ) import Html.Events exposing (onClick, onInput) import Iso8601 import Json.Encode as JE exposing (Value) import Task import Time main = Browser.element { init = init , update = update , view = view , subscriptions = \_ -> Sub.none } type alias Model = { file : Maybe File , value : String , text : String , coordinates : Maybe Coordinates , selection : Maybe Selection , selectionStart : String , selectionEnd : String , setSelection : Int , triggerCoordinates : Int , triggerSelection : Int } type Msg = Noop | SetFile File | CodeChanged String | SetText String | SetStart String | SetEnd String | SetSelection | TriggerCoordinates | TriggerSelection | Coordinates Coordinates | Selection Selection init : () -> ( Model, Cmd Msg ) init () = ( { file = Nothing , value = "module Main exposing (main)" ++ "\n\n" ++ "import Html" ++ "\n\n" ++ "main = Html.text \"Hello, World!\"" , text = "Four score and seven years ago,\nOur forefathers set forth..." , coordinates = Nothing , selection = Nothing , selectionStart = "1" , selectionEnd = "10" , setSelection = 0 , triggerCoordinates = 0 , triggerSelection = 0 } , Cmd.none ) focusId : String -> Cmd Msg focusId id = Task.attempt (\_ -> Noop) <| Dom.focus id update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Noop -> ( model, Cmd.none ) SetFile file -> ( { model | file = Just file } , Cmd.none ) CodeChanged value -> ( { model | value = value } , Cmd.none ) SetText text -> ( { model | text = text } , Cmd.none ) SetStart string -> ( { model | selectionStart = string } , Cmd.none ) SetEnd string -> ( { model | selectionEnd = string } , Cmd.none ) SetSelection -> ( { model | setSelection = model.setSelection + 1 } , focusId textAreaId ) TriggerCoordinates -> ( { model | triggerCoordinates = model.triggerCoordinates + 1 } , Cmd.none ) TriggerSelection -> ( { model | triggerSelection = model.triggerSelection + 1 } , Cmd.none ) Coordinates value -> ( { model | coordinates = Just value } , Cmd.none ) Selection value -> ( { model | selection = Just value } , Cmd.none ) coordinatesToString : Maybe Coordinates -> String coordinatesToString coordinates = case coordinates of Nothing -> "Click 'Trigger Coordinates' to update." Just c -> let cc = c.caretCoordinates in ("{ id = \"" ++ c.id ++ "\"\n") ++ (", selectionStart = " ++ String.fromInt c.selectionStart ++ "\n") ++ (", selectionEnd = " ++ String.fromInt c.selectionEnd ++ "\n") ++ ", caretCoordinates = \n" ++ (" { top = " ++ String.fromInt cc.top ++ "\n") ++ (" , left = " ++ String.fromInt cc.left ++ "\n") ++ " }\n" ++ "}" selectionToString : Maybe Selection -> String selectionToString selection = case selection of Nothing -> "Click 'Trigger Selection' to update." Just s -> ("{ id = \"" ++ s.id ++ "\"\n") ++ (", selectionStart = " ++ String.fromInt s.selectionStart ++ "\n") ++ (", selectionEnd = " ++ String.fromInt s.selectionEnd ++ "\n") ++ "}" copyright : String copyright = String.fromList [ Char.fromCode 169 ] br : Html msg br = Html.br [] [] b : String -> Html msg b string = Html.b [] [ text string ] borderStyle = "1px solid black" borderAttributes = [ style "border" borderStyle , style "vertical-align" "top" ] table rows = Html.table borderAttributes rows tr columns = Html.tr [] columns th elements = Html.th borderAttributes elements td elements = Html.td borderAttributes elements textAreaId : String textAreaId = "textarea" view : Model -> Html Msg view model = div [] [ h1 [] [ text "CustomElement Example" ] , p [] [ text "Examples of custom elements, used by Elm." ] , h2 [] [ text "text-area-tracker Custom Element" ] , p [] [ text "Edit the text below and click a 'Trigger' button." , br , text "Or change 'Start' and 'End' and click 'Set Selection'." ] , div [] [ textarea [ id textAreaId , rows 10 , cols 80 , onInput SetText ] [ text model.text ] , p [] [ text "Start: " , input [ type_ "text" , size 3 , onInput SetStart , value model.selectionStart ] [] , text " End: " , input [ type_ "text" , size 3 , onInput SetEnd , value model.selectionEnd ] [] , text " " , button [ onClick SetSelection ] [ text "Set Selection" ] , br , button [ onClick TriggerCoordinates ] [ text "Trigger Coordinates" ] , text " " , button [ onClick TriggerSelection ] [ text "Trigger Selection" ] ] , table [ tr [ th [ text "Coordinates" ] , th [ text "Selection" ] ] , tr [ td [ pre [] [ text <| coordinatesToString model.coordinates ] ] , td [ pre [] [ text <| selectionToString model.selection ] ] ] ] , let start = Maybe.withDefault 0 <| String.toInt model.selectionStart end = Maybe.withDefault 0 <| String.toInt model.selectionEnd count = model.setSelection in Tracker.textAreaTracker [ Tracker.textAreaId textAreaId , Tracker.setSelection start end count , Tracker.triggerCoordinates model.triggerCoordinates , Tracker.triggerSelection model.triggerSelection , Tracker.onCoordinates Coordinates , Tracker.onSelection Selection , id "tracker" ] [] ] , h2 [] [ text "file-listener Custom Element" ] , p [] [ text "Click the 'Choose File' button and choose an image file." , text " Information about the file and the image will appear." ] , div [] [ File.fileInput "fileid" [ accept "image/*" ] [ File.onLoad SetFile ] , br , case model.file of Nothing -> text "" Just file -> p [] [ b "Name: " , text file.name , br , b "Last Modified: " , text <| Iso8601.fromTime (Time.millisToPosix file.lastModified) , br , b "Mime Type: " , text file.mimeType , br , b "Size: " , text <| String.fromInt file.size , br , img [ src file.dataUrl , width 500 ] [] ] ] , h2 [] [ text "code-editor Custom Element" ] , p [] [ text "Edit the text below." , text " Notice that your edits appear in the area below that." ] , Editor.codeEditor [ Editor.editorValue model.value , Editor.onEditorChanged CodeChanged ] [] , p [] [ text "Text above echoed below:" ] , pre [] [ text model.value ] , p [] [ text <| copyright ++ " 2018 " , a [ href "https://lisplog.org/" ] [ text "<NAME>" ] , br , text "Source code: " , a [ href "https://github.com/billstclair/elm-custom-element" ] [ text "github.com/billstclair/elm-custom-element" ] ] ]
true
---------------------------------------------------------------------- -- -- Main.elm -- Example of using Custom Elements. -- Copyright (c) 2018 PI:NAME:<NAME>END_PI <PI:EMAIL:<EMAIL>END_PI> -- Some rights reserved. -- Distributed under the MIT License -- See LICENSE.txt -- ---------------------------------------------------------------------- module Main exposing (main) import Browser import Browser.Dom as Dom import Char import CustomElement.CodeEditor as Editor import CustomElement.FileListener as File exposing (File) import CustomElement.TextAreaTracker as Tracker exposing (Coordinates, Selection) import Html exposing ( Html , a , button , div , h1 , h2 , img , input , p , pre , text , textarea ) import Html.Attributes exposing ( accept , cols , href , id , rows , size , src , style , type_ , value , width ) import Html.Events exposing (onClick, onInput) import Iso8601 import Json.Encode as JE exposing (Value) import Task import Time main = Browser.element { init = init , update = update , view = view , subscriptions = \_ -> Sub.none } type alias Model = { file : Maybe File , value : String , text : String , coordinates : Maybe Coordinates , selection : Maybe Selection , selectionStart : String , selectionEnd : String , setSelection : Int , triggerCoordinates : Int , triggerSelection : Int } type Msg = Noop | SetFile File | CodeChanged String | SetText String | SetStart String | SetEnd String | SetSelection | TriggerCoordinates | TriggerSelection | Coordinates Coordinates | Selection Selection init : () -> ( Model, Cmd Msg ) init () = ( { file = Nothing , value = "module Main exposing (main)" ++ "\n\n" ++ "import Html" ++ "\n\n" ++ "main = Html.text \"Hello, World!\"" , text = "Four score and seven years ago,\nOur forefathers set forth..." , coordinates = Nothing , selection = Nothing , selectionStart = "1" , selectionEnd = "10" , setSelection = 0 , triggerCoordinates = 0 , triggerSelection = 0 } , Cmd.none ) focusId : String -> Cmd Msg focusId id = Task.attempt (\_ -> Noop) <| Dom.focus id update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of Noop -> ( model, Cmd.none ) SetFile file -> ( { model | file = Just file } , Cmd.none ) CodeChanged value -> ( { model | value = value } , Cmd.none ) SetText text -> ( { model | text = text } , Cmd.none ) SetStart string -> ( { model | selectionStart = string } , Cmd.none ) SetEnd string -> ( { model | selectionEnd = string } , Cmd.none ) SetSelection -> ( { model | setSelection = model.setSelection + 1 } , focusId textAreaId ) TriggerCoordinates -> ( { model | triggerCoordinates = model.triggerCoordinates + 1 } , Cmd.none ) TriggerSelection -> ( { model | triggerSelection = model.triggerSelection + 1 } , Cmd.none ) Coordinates value -> ( { model | coordinates = Just value } , Cmd.none ) Selection value -> ( { model | selection = Just value } , Cmd.none ) coordinatesToString : Maybe Coordinates -> String coordinatesToString coordinates = case coordinates of Nothing -> "Click 'Trigger Coordinates' to update." Just c -> let cc = c.caretCoordinates in ("{ id = \"" ++ c.id ++ "\"\n") ++ (", selectionStart = " ++ String.fromInt c.selectionStart ++ "\n") ++ (", selectionEnd = " ++ String.fromInt c.selectionEnd ++ "\n") ++ ", caretCoordinates = \n" ++ (" { top = " ++ String.fromInt cc.top ++ "\n") ++ (" , left = " ++ String.fromInt cc.left ++ "\n") ++ " }\n" ++ "}" selectionToString : Maybe Selection -> String selectionToString selection = case selection of Nothing -> "Click 'Trigger Selection' to update." Just s -> ("{ id = \"" ++ s.id ++ "\"\n") ++ (", selectionStart = " ++ String.fromInt s.selectionStart ++ "\n") ++ (", selectionEnd = " ++ String.fromInt s.selectionEnd ++ "\n") ++ "}" copyright : String copyright = String.fromList [ Char.fromCode 169 ] br : Html msg br = Html.br [] [] b : String -> Html msg b string = Html.b [] [ text string ] borderStyle = "1px solid black" borderAttributes = [ style "border" borderStyle , style "vertical-align" "top" ] table rows = Html.table borderAttributes rows tr columns = Html.tr [] columns th elements = Html.th borderAttributes elements td elements = Html.td borderAttributes elements textAreaId : String textAreaId = "textarea" view : Model -> Html Msg view model = div [] [ h1 [] [ text "CustomElement Example" ] , p [] [ text "Examples of custom elements, used by Elm." ] , h2 [] [ text "text-area-tracker Custom Element" ] , p [] [ text "Edit the text below and click a 'Trigger' button." , br , text "Or change 'Start' and 'End' and click 'Set Selection'." ] , div [] [ textarea [ id textAreaId , rows 10 , cols 80 , onInput SetText ] [ text model.text ] , p [] [ text "Start: " , input [ type_ "text" , size 3 , onInput SetStart , value model.selectionStart ] [] , text " End: " , input [ type_ "text" , size 3 , onInput SetEnd , value model.selectionEnd ] [] , text " " , button [ onClick SetSelection ] [ text "Set Selection" ] , br , button [ onClick TriggerCoordinates ] [ text "Trigger Coordinates" ] , text " " , button [ onClick TriggerSelection ] [ text "Trigger Selection" ] ] , table [ tr [ th [ text "Coordinates" ] , th [ text "Selection" ] ] , tr [ td [ pre [] [ text <| coordinatesToString model.coordinates ] ] , td [ pre [] [ text <| selectionToString model.selection ] ] ] ] , let start = Maybe.withDefault 0 <| String.toInt model.selectionStart end = Maybe.withDefault 0 <| String.toInt model.selectionEnd count = model.setSelection in Tracker.textAreaTracker [ Tracker.textAreaId textAreaId , Tracker.setSelection start end count , Tracker.triggerCoordinates model.triggerCoordinates , Tracker.triggerSelection model.triggerSelection , Tracker.onCoordinates Coordinates , Tracker.onSelection Selection , id "tracker" ] [] ] , h2 [] [ text "file-listener Custom Element" ] , p [] [ text "Click the 'Choose File' button and choose an image file." , text " Information about the file and the image will appear." ] , div [] [ File.fileInput "fileid" [ accept "image/*" ] [ File.onLoad SetFile ] , br , case model.file of Nothing -> text "" Just file -> p [] [ b "Name: " , text file.name , br , b "Last Modified: " , text <| Iso8601.fromTime (Time.millisToPosix file.lastModified) , br , b "Mime Type: " , text file.mimeType , br , b "Size: " , text <| String.fromInt file.size , br , img [ src file.dataUrl , width 500 ] [] ] ] , h2 [] [ text "code-editor Custom Element" ] , p [] [ text "Edit the text below." , text " Notice that your edits appear in the area below that." ] , Editor.codeEditor [ Editor.editorValue model.value , Editor.onEditorChanged CodeChanged ] [] , p [] [ text "Text above echoed below:" ] , pre [] [ text model.value ] , p [] [ text <| copyright ++ " 2018 " , a [ href "https://lisplog.org/" ] [ text "PI:NAME:<NAME>END_PI" ] , br , text "Source code: " , a [ href "https://github.com/billstclair/elm-custom-element" ] [ text "github.com/billstclair/elm-custom-element" ] ] ]
elm