Skip to content

Instantly share code, notes, and snippets.

View rahulmutt's full-sized avatar

Rahul Muttineni rahulmutt

View GitHub Profile
@rahulmutt
rahulmutt / Results.md
Created January 30, 2017 07:04
Monad Transformer Benchmark Results
Setting phasers to stun... (port 3000) (ctrl-c to quit)
Setting phasers to stun... (port 3003) (ctrl-c to quit)
Setting phasers to stun... (port 3002) (ctrl-c to quit)
Setting phasers to stun... (port 3001) (ctrl-c to quit)
benchmarking renderText
time                 6.612 ms   (6.528 ms .. 6.686 ms)
                     0.999 R²   (0.999 R² .. 1.000 R²)
mean                 6.563 ms   (6.546 ms .. 6.585 ms)
std dev              58.50 μs   (43.10 μs .. 75.69 μs)
@rahulmutt
rahulmutt / Main.hs
Created March 3, 2017 05:07
Length of HList
{-# LANGUAGE DataKinds, TypeFamilies, ScopedTypeVariables, TypeOperators, GADTs, UndecidableInstances, FlexibleContexts #-}
module Main where
import GHC.TypeLits
import Data.Proxy
main :: IO ()
main = print $ hlength (HCons "Hello" (HCons (1 :: Int) HNil))
hlength :: forall xs. KnownNat (Length xs) => HList xs -> Integer
@rahulmutt
rahulmutt / Trace.md
Created April 27, 2017 09:55
Trace of text bug
objc[11695]: Class JavaLaunchHelper is implemented in both /Users/rahulmuttineni/.jenv/versions/1.8/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
[main] INFO eta.main - >> main(1=[])
[main] INFO eta.runtime.RtsConfig - >> getDefault()
[main] INFO eta.runtime.RtsFlags$RtsOptsEnabled - >> <clinit>()
[main] INFO eta.runtime.RtsFlags$RtsOptsEnabled - >> RtsFlags$RtsOptsEnabled(1=RtsOptsNone, 2=0)
[main] INFO eta.runtime.RtsFlags$RtsOptsEnabled - << RtsFlags$RtsOptsEnabled(1=RtsOptsNone, 2=0)
[main] INFO eta.runtime.RtsFlags$RtsOptsEnabled - >> RtsFlags$RtsOptsEnabled(1=RtsOptsSafeOnly, 2=1)
[main] INFO eta.runtime.RtsFlags$RtsOptsEnabled - << RtsFlags$RtsOptsEnabled(1=RtsOptsSafeOnly, 2=1)
[main] INFO eta.runtime.RtsFlags$RtsOptsEnabled - >> RtsFlags$RtsOptsEnabled(1=RtsOptsAll, 2=2)
@rahulmutt
rahulmutt / Hello.hs
Last active August 2, 2017 01:17
Test Medium
module Main where
main :: IO ()
main = putStrLn "Hello World!"
@rahulmutt
rahulmutt / 5-Lens.hs
Created August 2, 2017 03:07
Lens Example in Eta
module Main where
import Control.Lens
import Data.Aeson
import Data.Aeson.Lens
import Data.Aeson.Encode.Pretty
import qualified Data.ByteString.Lazy.Char8 as BS
main :: IO ()
main = do
@rahulmutt
rahulmutt / data.json
Created August 8, 2017 23:40
eta-scala-1
{
"id": 1,
"first_name": "Jerrold",
"last_name": "Hache",
"email": "[email protected]",
"gender": "Male",
"ip_address": "149.180.165.206",
"events": {
"clicks": 99
}
@rahulmutt
rahulmutt / Transform.hs
Last active August 9, 2017 02:47
Code for Eta <-> Scala blog post
module Example.Transform where
import Java
import Control.Lens
import Data.Aeson
import Data.Aeson.Lens
import Data.Text (Text)
import qualified Data.Text as T
@rahulmutt
rahulmutt / Main.hs
Last active October 1, 2020 04:44
Fast coproducts for Haskell & Eta
#!/usr/bin/env stack
{- stack
--resolver lts-6.27
--install-ghc
runghc
--package containers
-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}
@rahulmutt
rahulmutt / Main-Decompiled.java
Last active September 12, 2017 04:34
Polymorphism in Eta via Type Erasure
public static class id extends Function {
public Closure enter(StgContext context) {
// context.R(2) is the first argument of the function
// All id simply does is evaluate the argument -
// it cannot do much more!
return context.R(2).evaluate(context);
}
public int arity() { return 1; }
}
@rahulmutt
rahulmutt / Spec.md
Last active January 12, 2018 01:11
Eta FFI Specification

Eta FFI Specification

Architecture

The Eta FFI Generator will consist of support from three components:

  • The Eta compiler
  • The Etlas build tool
  • The eta-ffi tool

Eta Compiler