This file contains 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
actor ProcedureUseActor() int In ==> int Out : | |
int val; | |
action In:[x] ==> Out:[out] | |
var int out | |
do | |
sqrtLookup(x); | |
out := val; | |
end |
This file contains 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
#include <stdio.h> | |
int add(int i, int j) | |
{ | |
return (i + j); | |
} | |
int sub(int i, int j) | |
{ | |
return (i - j); |
This file contains 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
[18:27] <trumanshow19> Would someone mind help iron out the | |
inconsistencies in my head with respect to purity in | |
Haskell. Statement 1: Haskell is a purely functional lanugage, S2: | |
Haskell is not impure, but... S3: f :: a -> a is a "pure" function as | |
opposed to a -> IO a. | |
[18:27] <trumanshow19> If a -> is pure, to distinguish a -> IO a, then | |
how do I describe the latter, is there is no impurity in Haskell ? | |
[18:28] <trumanshow19> The only opposite of pure I know is impure. |
This file contains 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
cabal-helper-wrapper: Installing a private copy of Cabal because we couldn't | |
find the right version in your global/user package-db, this might take a | |
while but will only happen once per Cabal version you're using. | |
If anything goes horribly wrong just delete this directory and try again: | |
/home/rob/.ghc-mod/cabal-helper | |
If you want to avoid this automatic installation altogether install | |
version 1.18.1.3 of Cabal manually (into your user or global package-db): | |
$ cabal install Cabal --constraint "Cabal == 1.18.1.3" |
This file contains 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 = do | |
let a = enumFromN (index2 2 3) 1 :: Acc (Array DIM2 Int) | |
let b = enumFromStepN (index2 2 3) 6 (-1) :: Acc (Array DIM2 Int) | |
run $ A.zipWith (+) a b |
This file contains 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
stack -v install criterion | |
Version 1.1.0, Git revision 0e9430aad55841b5ff2c6c2851f0548c16bce7cf (3540 commits) x86_64 hpack-0.13.0 | |
2016-05-14 11:43:24.717228: [debug] Checking for project config at: /home/rob/code/haskell/bones-knapsack/stack.yaml @(stack_4KUX0HKhK5M2TdLcUMZ5Rt:Stack.Config src/Stack/Config.hs:792:9) | |
2016-05-14 11:43:24.717568: [debug] Loading project config file stack.yaml @(stack_4KUX0HKhK5M2TdLcUMZ5Rt:Stack.Config src/Stack/Config.hs:810:13) | |
2016-05-14 11:43:24.719575: [debug] Checking whether stack was built with libgmp4 @(stack_4KUX0HKhK5M2TdLcUMZ5Rt:Stack.Config src/Stack/Config.hs:327:5) | |
2016-05-14 11:43:24.719792: [debug] Run process: ldd /usr/bin/stack @(stack_4KUX0HKhK5M2TdLcUMZ5Rt:System.Process.Read src/System/Process/Read.hs:283:3) | |
2016-05-14 11:43:24.729313: [debug] Stack was not built with libgmp4 @(stack_4KUX0HKhK5M2TdLcUMZ5Rt:Stack.Config src/Stack/Config.hs:331:14) | |
2016-05-14 11:43:24.729605: [debug] Trying to decode /home/rob/.stack/build-plan-cache/x86_64-linux/lts-5.12.ca |
This file contains 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
consider this Haskell: | |
import Prelude hiding (sum,length) | |
mean_good :: [Int] -> Double | |
mean_good xs = go 0 0 xs | |
where | |
go !accum !denom [] = | |
fromIntegral accum / fromIntegral denom | |
go !accum !denom (!x:xs) = |
This file contains 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 Data.Vect | |
-- earlier in the docs: | |
-- http://docs.idris-lang.org/en/latest/tutorial/typesfuns.html#case-expressions | |
-- | |
-- Another way of inspecting intermediate values of simple types is to | |
-- use a case expression. | |
my_filter_case : (a -> Bool) -> Vect n a -> (p ** Vect p a) | |
my_filter_case p [] = ( _ ** [] ) |
This file contains 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
-- works nicely. | |
headEq'' : DecEq a => (x : a) -> (ys : List a) -> NonEmpty ys -> Dec (x = head ys) | |
headEq'' x (y :: ys) IsNonEmpty = | |
-- just return the result of `decEq` | |
decEq x y | |
-- see: | |
headEq'' 1 [1, 2] : NonEmpty [1, 2] -> Dec (1 = 1) | |
-- what about just pattern matching on the result |
This file contains 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
data Foo : Vect m (Nat,Type) -> Vect n (Nat,Type) -> Type where | |
Bar : {x:List Nat} | |
-> {y:List Nat} | |
-> (Vect m x -> Vect n y) | |
-> Foo ?rhs1 ?rhs2 | |
-- examples: | |
f : Foo [(2,Nat),(1,Nat)] [(1,Nat)] | |
f = Bar (\[ [x,y] , [z] ] => [ [x+y+z] ]) |