- Plain Functional Programming by Martin Odersky
- https://youtu.be/YXDm3WHZT5g
- IMPLICIT FUNCTION TYPES
- scala/scala3#1775
- https://contributors.scala-lang.org/t/implicit-function-types/219
- https://www.google.ru/search?q=implicit+function+type+vs+kleisli+arrow
- https://www.google.com/search?q=implicit+function+types+abstract+over+context
- Implicit Implications (part 3): The Future is Functional (implicitly)
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
package org.apache.spark.sql.fizzbuzz.udf | |
import org.apache.spark.sql.api.java.UDF1 | |
import scala.util.Try | |
import org.scalatest._ | |
import flatspec._ | |
class FizzBuzz extends UDF1[Any, String] { | |
def dbg(s: => String): Unit = println(s) |
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
#!/usr/bin/env python | |
# -*- mode: python; coding: utf-8 -*- | |
# (c) Valik mailto:vasnake@gmail.com | |
r""" Global storage Flask extension. | |
In Flask, it's possible to store data across many requests. | |
But you must be aware of threading issues in that case. | |
Thanks to flask_sqlalchemy | |
https://github.com/mitsuhiko/flask-sqlalchemy/blob/master/flask_sqlalchemy.py |
Miles Sabin recently opened a pull request fixing the infamous SI-2712. First off, this is remarkable and, if merged, will make everyone's life enormously easier. This is a bug that a lot of people hit often without even realizing it, and they just assume that either they did something wrong or the compiler is broken in some weird way. It is especially common for users of scalaz or cats.
But that's not what I wanted to write about. What I want to write about is the exact semantics of Miles's fix, because it does impose some very specific assumptions about the way that type constructors work, and understanding those assumptions is the key to getting the most of it his fix.
For starters, here is the sort of thing that SI-2712 affects:
def foo[F[_], A](fa: F[A]): String = fa.toString
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 TelEventRecord(bts: Int, ets: Int, | |
transport: String, | |
zid: Int = -1, | |
enter: Boolean = false, exit: Boolean = false) | |
/* | |
Надо обработать последовательность таких событий, чтобы получить последовательность "поездок" |
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
// type classes example | |
// based on material from SICP 1.3.1 high-order procedures | |
// inspired by | |
// The Neophyte's Guide to Scala Part 12: Type Classes | |
// http://danielwestheide.com/blog/2013/02/06/the-neophytes-guide-to-scala-part-12-type-classes.html | |
// scala.math.Numeric is a type class | |
// that define an interface |
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
--- core.py.orig 2014-01-14 19:37:27.287907299 +0400 | |
+++ core.py 2014-01-14 19:45:17.137864423 +0400 | |
@@ -87,14 +87,18 @@ | |
# Note: All libtorrent python bindings to set plugins/extensions need to be disabled | |
# due to GIL issue. https://code.google.com/p/libtorrent/issues/detail?id=369 | |
# Setting session flags to 1 enables all libtorrent default plugins | |
- self.session = lt.session(lt.fingerprint("DE", *version), flags=1) | |
+ self.session = lt.session(lt.fingerprint("DE", *version), flags=0) | |
+ self.session.add_extension("ut_pex") | |
+ self.session.add_extension("ut_metadata") |
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
// deprecated. using meapp.coffee now | |
console.log('meapp enter'); | |
var vappFactory = null; | |
define( | |
["dojo/_base/declare", "dojo/dom", 'dojo/has', | |
"vs/mpvlib"], | |
function(declare, dom, has, mpvlib) { | |
console.log('meapp dojo/define. define app classes'); |
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
--- rpcserver.py.orig 2014-10-25 19:03:15.841366375 +0400 | |
+++ rpcserver.py 2014-10-25 19:05:40.753392389 +0400 | |
@@ -131,7 +131,8 @@ | |
SSL transport. | |
""" | |
ssl_dir = deluge.configmanager.get_config_dir("ssl") | |
- ctx = SSL.Context(SSL.SSLv3_METHOD) | |
+ ctx = SSL.Context(SSL.SSLv23_METHOD) | |
+ ctx.set_options(SSL.OP_NO_SSLv2 & SSL.OP_NO_SSLv3) | |
ctx.use_certificate_file(os.path.join(ssl_dir, "daemon.cert")) |
NewerOlder