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
List("one", "two", "three") map (_.length) | |
trait Functor[F[_]] { | |
def fmap[A,B](f: A => B, fa:F[A]): F[B] | |
} | |
class ListFunctor extends Functor[List] { | |
def fmap[A,B](f: A => B, fa:List[A]): List[B] = fa match { | |
case Nil => Nil | |
case x::xs => f(x) :: fmap(f, 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
case class Person(name:String) | |
fmap((_:Person).name, Holder(Person("Harry Potter"))) | |
11: error: could not find implicit value for parameter functor: Functor[Holder] |
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
List -> is a type constructor | |
List[Long] -> is a type |
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
scala> val ar:List[Int] = Nil | |
ar: List[Int] = List() | |
scala> "blah" :: 5 :: 6 :: ar | |
res21: List[Any] = List(blah, 5, 6) | |
//how did I add a String to a List[Int]? | |
//how do you keep the type within the List fixed at Int? | |
//can I only do that at declaration time as opposed to when I call the :: method? | |
//This works: |
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
;; Load the ensime lisp code... | |
(add-to-list 'load-path "ENSIME_ROOT/elisp/") | |
(require 'ensime) | |
;; This step causes the ensime-mode to be started whenever | |
;; scala-mode is started for a buffer. You may have to customize this step | |
;; if you're not using the standard scala mode. | |
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook) | |
;; MINI HOWTO: |
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
Chain INPUT (policy ACCEPT) | |
target prot opt source destination | |
Chain FORWARD (policy ACCEPT) | |
target prot opt source destination | |
Chain OUTPUT (policy ACCEPT) | |
target prot opt source destination |
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
sudo iptables -A CHAIN_NAME |
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
sudo chmod +x /etc/network/if-pre-up.d/iptablesload |
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 install hlint | |
Resolving dependencies... | |
[1 of 1] Compiling Main ( /var/folders/zn/7pk0j2jd3d5b35n46ybls6s80000gn/T/haskell-src-exts-1.11.15274/haskell-src-exts-1.11.1/Setup.hs, /var/folders/zn/7pk0j2jd3d5b35n46ybls6s80000gn/T/haskell-src-exts-1.11.15274/haskell-src-exts-1.11.1/dist/setup/Main.o ) | |
/var/folders/zn/7pk0j2jd3d5b35n46ybls6s80000gn/T/haskell-src-exts-1.11.15274/haskell-src-exts-1.11.1/Setup.hs:1:0: | |
Warning: In the use of `runTests' | |
(imported from Distribution.Simple, but defined in Distribution.Simple.UserHooks): | |
Deprecated: "Please use the new testing interface instead!" | |
Linking /var/folders/zn/7pk0j2jd3d5b35n46ybls6s80000gn/T/haskell-src-exts-1.11.15274/haskell-src-exts-1.11.1/dist/setup/setup ... | |
Configuring haskell-src-exts-1.11.1... |
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
Given: uncurry id | |
the result is: (b -> c, b) -> c | |
How does this result come about? | |
uncurry :: (a-> b -> c) -> (a,b) -> c | |
id :: a -> a | |
How can you use id (a -> a) as the first parameter to uncurry, which requires a (a -> b -> c) function? |
OlderNewer