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
| #[derive(Debug)] | |
| enum Coin { | |
| FiftyCents | |
| } | |
| #[derive(Debug)] | |
| enum Candy { | |
| Lollypop | |
| } |
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 Test where | |
| import Data.Maybe | |
| import Data.List | |
| --import Control.Applicative | |
| func :: Maybe (Int -> String) | |
| func = Just (\i -> show i) |
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
| object Singleton |
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
| case class PostalDE(code:Int) | |
| case class City(name:String) | |
| val zipToCity = Map( | |
| PostalDE(40213) -> City("Düsseldorf"), | |
| PostalDE(11011) -> City("Berlin"), | |
| PostalDE(20095) -> City("Hamburg") | |
| ) | |
| //zipToCity: scala.collection.immutable.Map[PostalDE,City] = Map(PostalDE(40213) -> City(Düsseldorf), PostalDE(11011) -> City(Berlin), PostalDE(20095) -> City(Hamburg)) |
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
| val prefixes2 = Map( 40200 -> "Düsseldorf", 10117 -> "Berlin", 80331 -> "München", "SE1 7PB" -> "London") | |
| // prefixes2: scala.collection.immutable.Map[Any,String] = Map(40200 -> Düsseldorf, 10117 -> Berlin, 80331 -> München, SE1 7PB -> London) |
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
| val city = prefixes.get(40200) | |
| //city: Option[String] = Some(Düsseldorf) |
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
| val zipToCity = Map( 40200 -> "Düsseldorf", 10117 -> "Berlin", 80331 -> "München") |
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
| CREATE FUNCTION `addDuration`(startDate DATE, duration DATE) RETURNS date | |
| DETERMINISTIC | |
| BEGIN | |
| DECLARE endDate date; | |
| SET endDate = startDate; | |
| SELECT date_add(endDate, INTERVAL EXTRACT(YEAR FROM duration) YEAR) INTO endDate; | |
| SELECT date_add(endDate, INTERVAL EXTRACT(MONTH FROM duration) MONTH) INTO endDate; | |
| SELECT date_add(endDate, INTERVAL EXTRACT(DAY FROM duration) DAY) INTO endDate; | |
| RETURN endDate; | |
| END |
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
| val meta = """META.INF(.)*""".r | |
| mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) => | |
| { | |
| case PathList("javax", "servlet", xs @ _*) => MergeStrategy.first | |
| case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first | |
| case "application.conf" => MergeStrategy.concat | |
| case meta(_) => MergeStrategy.discard | |
| case x => old(x) | |
| } |