Skip to content

Instantly share code, notes, and snippets.

View CremboC's full-sized avatar

Paulius Imbrasas CremboC

  • Permutive
  • United Kingdom
View GitHub Profile
data: {
basket: [
{
item: ..
price: ..
},
{
item: ..
price: ..
},
@CremboC
CremboC / why.js
Created September 30, 2015 11:13
event.preventDefault();
var subjectIndex = event.dataTransfer.getData('index');
var session = this.sessions[sessionIndex];
if (session.delegates === undefined) {
session.delegates = [];
}
server {
listen 80;
server_name frame.cscorp.eu;
root /opt/nginx/html/_framework;
index index.php index.html index.htm;
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index _framework/index.php;

I'm completely new to Haskell and I've been using in Advent of Code. I'm loving everything about the languages except regex.

Why do we need like 10 different (yet the same) libraries for regex? It's fair if the wiki mentions "hey look there are other regex libraries you may want to use", but instead it talk about them all in detail. All I care about when I google "haskell regex" is examples of how to use regex in Haskell: finding all matching strings, whether there is a match or not, etc. All the basic stuff you'd expect with regex.

Afterwards I managed to find an example for "Text.Regex.Posix". I do know what POSIX is, but I'm afraid I have no idea what's the difference between the different regexes is. Well, I found out this one barely supports anything you'd expect in a modern regex library: even \d is not supported. I know, I know, that's a limitation of POSIX regex, but I'm using Haskell, and I expect the built-in library to support all (what's considered nowadays) basic regex features.

So somehow I m

Error:scalac: Error: Overlapping trees (1646,1657)
scala.reflect.internal.Positions$ValidateException: Overlapping trees (1646,1657)
at scala.reflect.internal.Positions.validate$1(Positions.scala:102)
at scala.reflect.internal.Positions.validatePositions(Positions.scala:147)
at scala.reflect.internal.Positions.validatePositions$(Positions.scala:83)
at scala.reflect.internal.SymbolTable.validatePositions(SymbolTable.scala:16)
import scala.meta._
// this is the original source
val source = q"""
trait A {
def a(): Int = 5
}
def someFunc(): Unit = {
val af: Af = magic[A](..)
import scala.meta._
val source = q"""
def test2(): Unit = IWantToBeAClass()
def test(): Unit = {
val d = IWantToBeAClass()
val other = 5
other + 5
Error:scalac: Error: 2:Illegal character in opaque part at index 7: file:D:\Projects\sbt-semantic-example\app\src\main\scala\Main.scala
[7..12): scala => _root_.scala.
java.lang.RuntimeException: 2:Illegal character in opaque part at index 7: file:D:\Projects\sbt-semantic-example\app\src\main\scala\Main.scala
[7..12): scala => _root_.scala.
at scala.sys.package$.error(package.scala:27)
at scala.meta.semantic.v1.Database$.readSection$1(Database.scala:83)
Exception in thread "main" java.lang.RuntimeException: classpath must be non-empty. This may indicate that Mirror is badly configured. If you use sbt-scalahost, make sure your project defines `dependsOn(<projectname> % Scalameta)` for at least one <projectname>.
at scala.sys.package$.error(package.scala:27)
at scala.meta.internal.scalahost.v1.offline.Mirror.fail(Mirror.scala:31)
at scala.meta.internal.scalahost.v1.offline.Mirror.<init>(Mirror.scala:32)
at scala.meta.Mirror$.apply(Mirror.scala:13)
at scala.meta.Mirror$.apply(Mirror.scala:15)
at Main$.main(Main.scala:15)
at Main.main(Main.scala)
object Methods {
def one(p: Any): Boolean = ???
def two(p: Any): Boolean = ???
def three(p: Any): Boolean = ???
def four(p: Any): Boolean = ???
def combined(p: Any): Boolean = Seq(one, two, three, four).any(p)
}