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 alertsStore from '../alerts/store'; | |
import { alert } from '../alerts/types'; | |
alertsStore.push(alert("Those aren't valid credentials!", 'error')); | |
alertsStore.push(alert("You've successfully logged in", 'success')); |
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
// -- 1 -- | |
import { IconButton, SnackbarContent } from '@material-ui/core'; | |
import { amber, green } from '@material-ui/core/colors'; | |
import { createStyles, Theme, withStyles } from '@material-ui/core/styles'; | |
import { ClassNameMap } from '@material-ui/core/styles/withStyles'; | |
import CloseIcon from '@material-ui/icons/Close'; | |
import React, { StatelessComponent } from 'react'; | |
import alertsStore from './store'; | |
import { Alert } from './types'; |
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
// -- 1 -- | |
import Snackbar from '@material-ui/core/Snackbar'; | |
import { observer } from 'mobx-react'; | |
import React from 'react'; | |
import AlertContent from './content'; | |
import alertsStore from './store'; | |
const Alerts = () => { | |
// -- 2 -- | |
return alertsStore.current.cata({ |
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
// - 1 - | |
import { just, Maybe, nothing } from 'maybeasy'; | |
import { action, computed, observable } from 'mobx'; | |
import { Alert } from './types'; | |
class AlertsStore { | |
// - 2 - | |
@observable | |
alerts: Alert[] = []; |
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
interface BaseAlert { | |
message: string; | |
display: boolean; | |
} | |
export interface Success extends BaseAlert { | |
kind: 'success'; | |
} | |
export interface Info extends BaseAlert { |
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 { just, Maybe, nothing } from 'maybeasy'; | |
import { action, computed, observable } from 'mobx'; | |
import { Alert } from './types'; | |
class AlertsStore { | |
@observable | |
alerts: Alert[] = []; | |
@computed | |
get current(): Maybe<Alert> { |
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
Configuring stack-1.7.0... | |
Preprocessing library for stack-1.7.0.. | |
Building library for stack-1.7.0.. | |
[ 1 of 129] Compiling System.Terminal ( src\windows\System\Terminal.hs, .stack-work\dist\ca59d0ab\build\System\Terminal.o ) | |
[ 2 of 129] Compiling RIO.Prelude ( subs\rio\src\RIO\Prelude.hs, .stack-work\dist\ca59d0ab\build\RIO\Prelude.o ) | |
[ 3 of 129] Compiling RIO.Logger ( subs\rio\src\RIO\Logger.hs, .stack-work\dist\ca59d0ab\build\RIO\Logger.o ) | |
[ 4 of 129] Compiling RIO ( subs\rio\src\RIO.hs, .stack-work\dist\ca59d0ab\build\RIO.o ) | |
[ 5 of 129] Compiling Path.Extra ( subs\rio\src\Path\Extra.hs, .stack-work\dist\ca59d0ab\build\Path\Extra.o ) | |
[ 6 of 129] Compiling RIO.Process ( subs\rio\src\RIO\Process.hs, .stack-work\dist\ca59d0ab\build\RIO\Process.o ) | |
[ 7 of 129] Compiling Stack.Prelude ( src\Stack\Prelude.hs, .stack-work\dist\ca59d0ab\build\Stack\Prelude.o ) |
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
// Given this | |
interface One { | |
kind: 'one'; | |
value: 1; | |
} | |
interface Two { | |
kind: 'two'; | |
value: 2; |
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 the flow docs: https://flow.org/en/docs/types/any/#toc-avoid-leaking-any | |
// @flow | |
function fn(obj: any) /* (:any) */ { | |
let foo /* (:any) */ = obj.foo; | |
let bar /* (:any) */ = foo * 2; | |
return bar; | |
} | |
// returns an any type (implicitly) |
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
andThen<B>(f: (a: A) => Decoder<B>): Decoder<B>; |
NewerOlder