module Query = [%graphql | |
{| | |
query { | |
someFieldWithInterfaceType { | |
id | |
...on ImplA { | |
a_only | |
} | |
...on ImplB { | |
b_only |
(* SIMPLE FUNCTIONS OVER INTEGERS *) | |
let multiple_of n d = | |
n mod d = 0;; | |
let integer_square_root n = | |
int_of_float (sqrt (float n));; | |
(* PRIME NUMBERS *) | |
let rec gcd n m = | |
match (n, m) with |
module type Set = sig | |
type 'a t | |
val empty : 'a t | |
val isEmpty : 'a t -> bool | |
end | |
module ListSet : Set = struct | |
type 'a t = 'a list | |
let empty = [] | |
let isEmpty l = l == [] |
Hi folks, I just wanna share my story on my first day trying Cabal/Stack.
So I was learning Haskell for half a semester but only live within ghci
and runhaskell
. But today I was thinking of playing with /write-you-a-haskell/chapter4/untyped so I pulled it down.
I was first trying to follow the README.md which asked me to do cabal run
. It failed and gave me errors on the ambiguous usage of <>
, I realized cabal
is using my global GHC version and it might be some breaking changes there. (since it's Haskell)
I heard stack
can solve this problem by having multiple GHC so I changed to looking into that. So I run stack build
, see the new GHC being downloaded, but failed. The resolver
of the project is 7.8.4
and the problem is ar
permission errors on OS X 10.11 El Capitan
with GHC 7.8.4 . I tried several workarounds posted in the issue page but none of them works.
Aft
{-# LANGUAGE | |
GADTs, | |
ExistentialQuantification | |
#-} | |
import Control.Monad | |
import Data.IORef | |
import Data.Sequence | |
import Data.Foldable |
import 'package:flutter/material.dart'; | |
/// A TextField that maintain selection state like React Native | |
class TextInput extends StatefulWidget { | |
TextInput({@required this.decoration, @required this.text, @required this.onChanged}); | |
final String text; | |
final InputDecoration decoration; | |
final Function onChanged; |
A Pen by Anonasaurus Rex on CodePen.
// 试了两种方式模拟: | |
class Super { | |
constructor() { | |
this.x = "super" | |
} | |
}; | |
// 这样的话也是 own property | |
new Super().hasOwnProperty('x') // true |
/** | |
class Super { | |
x = "super" | |
} | |
*/ | |
class Super { | |
constructor() { |