const Identity = x => ({
map: f => Identity(f(x)),
fold: f => f(x),
inspect: () => `Identity(${x})`
});
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module UserMutations | |
| // removed for brevity, see the rest | |
| // here: https://github.com/RyanCCollins/meetup-event-planner/blob/master/app/graph/mutations/user_mutations.rb | |
| UpdateProfile = GraphQL::Relay::Mutation.define do | |
| name 'UpdateProfile' | |
| description 'Update the user profile' | |
| input_field :auth_token, !types.String | |
| input_field :profile, ProfileInputType | |
| return_field :user, AuthUserType |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const authenticateUser = (user) => ({ | |
| type: types.AUTHENTICATE_USER, | |
| user, | |
| }); | |
| export const invalidateUser = () => ({ | |
| type: types.INVALIDATE_USER, | |
| }); | |
| export const logoutUser = () => (dispatch) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // From https://github.com/RyanCCollins/ryancollinsio/blob/feat_rc_elm/client/webpack.config.babel.js | |
| const webpack = require('webpack'); | |
| const path = require('path'); | |
| const ROOT_PATH = path.resolve(__dirname); | |
| module.exports = { | |
| devtool: 'eval', | |
| entry: [ | |
| 'react-hot-loader/patch', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import Elm from 'react-elm-components'; | |
| import Heading from 'grommet-udacity/components/Heading'; | |
| import Section from 'grommet-udacity/components/Section'; | |
| import Markdown from 'grommet-udacity/components/Markdown'; | |
| import Box from 'grommet-udacity/components/Box'; | |
| import { StyledWrapper, StyledArticle } from './styles'; | |
| import { Main } from 'elm/src/Main'; | |
| import { Divider } from 'components'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Main.elm | |
| module Main exposing (main) | |
| import AppModel exposing (..) | |
| import View exposing (view) | |
| import Html exposing (Html) | |
| main : Program Never Model Msg | |
| main = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const initialState = { | |
| error: null, | |
| message: null, | |
| isSubmitting: false, | |
| modal: { | |
| isVisible: false, | |
| }, | |
| }; | |
| const feedbackReducer = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type alias Model = | |
| { error: Maybe String | |
| , message: Maybe String | |
| , isSubmitting: Bool | |
| } | |
| type alias Error = | |
| { message: String } | |
| type Msg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type FeedbackAction = 'FEEDBACK_SUBMISSION_INITIATION' | 'FEEDBACK_SUBMISSION_MESSAGE' | 'FEEDBACK_SUBMISSION_ERROR'; // etc. etc. | |
| interface IAction<P> { | |
| type: FeedbackAction; | |
| payload: P; | |
| }; | |
| interface IFeedbackState { | |
| error: Error; | |
| message: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* @flow */ | |
| type Maybe<T,U> = (pattern: { | |
| some(x: T): U; | |
| none(): U; | |
| }) => U; | |
| function map<A,B,C>(maybe: Maybe<A,C>, f: (a: A) => B): Maybe<B,C> { | |
| return function(pattern) { | |
| return maybe({ |