Profile

Cover photo
Nathan Howell
Works at Alpha Heavy Industries
39,639 views
AboutPostsPhotosVideos

Stream

Nathan Howell

Announcement  - 
 
I recently released a Protocol Buffers package that works with GHC.Generics. It's come along pretty far since the prototype I blogged about last spring, but it's useable despite a few rough edges.
Last year I spent some time exploring GHC.Generics as a language for describing Protocol Buffers messages. Steve and I pushed just hard enough to get …
8
Zaki Manian's profile photoEdward Kmett's profile photoNathan Howell's profile photo
11 comments
 
+Zaki Manian I do use lens a bit now. The protobuf package doesn't take an explicit lens dependency since there is no need.

Not much of our codebase is very performance sensitive, probably less than 10%. Most of our services scale pretty well horizontally... it's the core strategies and matching engines (for simulation) that are most critical.
Add a comment...

Nathan Howell

Shared publicly  - 
 
A little GHC hacking on an extended train ride home this evening... working on adding symbols for all the STG registers. BaseReg is functioning now, and the StgRegTable definition comes out of the C headers as it should.


$ gdb /tmp/dwarf
GNU gdb (GDB) 7.3.1

Reading symbols from /private/tmp/dwarf...Reading symbols from /private/tmp/dwarf.dSYM/Contents/Resources/DWARF/dwarf...done.
done.

(gdb) break dwarf.hs:2
Breakpoint 1 at 0x1000013da: file /tmp/dwarf.hs, line 2. (3 locations)

(gdb) run
Starting program: /private/tmp/dwarf

Breakpoint 1, Main_main1_info (Base_Arg=0x1003dcb98) at /tmp/dwarf.hs:2
2 main = putStrLn "ok"

(gdb) print Main_main1_info
$1 = {void (struct StgRegTable_ *)} 0x1000014b0 <Main_main1_info>

(gdb) info address Base_Arg
Symbol "Base_Arg" is multi-location:
Range 0x1000014b0-0x1000014bc: a complex DWARF expression:
1: DW_OP_reg13 [$r13]

(gdb) print Base_Arg->rCurrentTSO
$2 = (struct StgTSO_ *) 0x101205390

(gdb) print Base_Arg->rCurrentTSO->cap->in_haskell
$3 = rtsTrue
1
Add a comment...

Nathan Howell

Shared publicly  - 
 
I hacked together a little example of how clang can be used to write (very much unsupported!) external primops for GHC in C/C++... for those very special occasions when unboxed Haskell and C-- just don't cut it.

Note: This particular example hasn't been thoroughly tested and should only be used for personal amusement. It probably won't even run on your computer.
From time to time, I have the need to parse relatively small, fixed width binary messages. Like a ITCH v4.1 MoldUDP64 packet from our buddies over …
4
1
Simon Marlow's profile photo
Add a comment...

Nathan Howell

Discussion  - 
 
Something I've wondered for a while now... could the Cabal description language be replaced with an equivalent embedded DSL?
While I’m working on more radical ideas about Hackage and Cabal, I thought I’d stick out a couple more palatable ones now. Cabal (almost …
4
John Millikin's profile photoNathan Howell's profile photo
10 comments
 
+John Millikin Cool, thanks. I'll try to address these in my next post.
Add a comment...

Nathan Howell

Shared publicly  - 
 
I've been considering a few options to (hopefully) make Protocol Buffers easier to use from Haskell...

http://breaks.for.alienz.org/blog/2012/05/20/generics-and-protocol-buffers/
We use Protocol Buffers extensively, and from talking to some folks at BayHac’12 it may be time to revisit the state of protobuf in Haskell. To …
3
1
Ben Ford's profile photoNathan Howell's profile photoChris Kuklewicz's profile photoDavid Leuschner's profile photo
9 comments
 
Protocol buffers allows message Q to reserve field id numbers for future extensions. Later a different proto file can (in some other namespace) declare new field F for message Q. The code was generated for Q before F was defined but the old code should do the right thing and still be able to store F inside Q and let users access it. This is only active if the message reserved field id numbers.

Unknown is when the runtime library is deserializing message Q and unexpected fields G are in there, perhaps a later revision of Q has more fields. The old code for Q can store these unknown fields G and faithfully write them out when later serialized. This capability is only active for messages generated with the '-u' or '--unkown_fields' switch to hprotoc.

Extensions were particularly challenging for immutable Haskell messages. If the extension F is visible when Q is generated then the code handles it in a type specific way, otherwise it handles extensions in a type unspecific way.
Add a comment...

Nathan Howell

Shared publicly  - 
 
I feel like we're finally getting somewhere with this stack walking business.

(gdb) where
#0 Main_main_info () at dwarf.hs:2
#1 0x00000001001b439c in s2xo_info () at libraries/base/GHC/Base.lhs:620
#2 0x0000000000000000 in ?? ()

(gdb) frame 0
#0 Main_main_info () at dwarf.hs:2
2 main = return ()

(gdb) frame 1
#1 0x00000001001b439c in s2xo_info () at libraries/base/GHC/Base.lhs:620
620 bindIO (IO m) k = IO $ \ s -> case m s of (# new_s, a #) -> unIO (k a) new_s

(gdb) info frame
Stack level 1, frame at 0x7fff5fbfae90:
rip = 0x1001b439c in s2xo_info (libraries/base/GHC/Base.lhs:620); saved rip 0x0
called by frame at 0x7fff5fbfae98, caller of frame at 0x7fff5fbfae80
source language unknown.
Arglist at 0x7fff5fbfae78, args:
Locals at 0x7fff5fbfae78, Previous frame's sp is 0x7fff5fbfae90
Saved registers:
rip at 0x7fff5fbfae88
2
Lucas Parker's profile photoNathan Howell's profile photo
2 comments
 
+Lucas Parker I'm trying to have gdb walk the stack, that's the hard part :-) GHC doesn't use a C-like stack, so the stack walking code has to be written as a DWARF expression in the debug symbols.
Add a comment...
Work
Employment
  • Alpha Heavy Industries
    Principal, 2011 - present
  • eBay
    Principal Developer, 2009 - 2011
  • Positronic (acquired by eBay)
    Software Developer, 2008 - 2008
  • Microsoft
    Senior Developer, 1999 - 2008
Links
Contributor to
Basic Information
Gender
Male