If only Overcast had achievements

2x speed on Overcast

Since I started using Overcast I've been slowly increasing the playback speed and now I've arrived at the sacred 2x. I've gotten used to people talking quite fast so it almost makes me fall a sleep to listen to stuff at 1x.

I feel like Overcast should give users a special achievement when they've listened to enough stuff at 2x.

Cortex

I discovered the podcast Cortex last week and I've been listening to it pretty much non stop. The basic concept is that Myke Hurley and CGP Grey talk about how they get work done.

What really captivates me is how Grey has carefully evaluated and thought through everything he does (even as far as putting sleep on his calendar). Even though not everything he says would work for me, I found in extremely interesting to listen to people who care a lot about what they're talking about.

If you're a geek who likes "personal productivity" I highly recommend you listen to this.

Jurassic Park Theme (1000% Slower)

I head this mentioned on an episode of Cortex and I found it oddly satisfying.

I listened to it through part of my work day today and I did a good at keeping me focused on the task at hand.

Making a magical inbox folder

This is almost magic. Hook a folder on your desktop up to your OmniFocus inbox through Hazel. That way anything you put in there will appear in your inbox. I use this to capture everything from documents, to YouTube videos, and links from Twitter.

Dotfiles are meant to be stolen from

I wouldn't say dotfiles are meant to be forked but rather you're meant to steal stuff from other's. So in the interest of making your job a bit easier I thought I would talk about some of the things from my dotfiles that I think are worth stealing.

First things is the following aliases:

  • ee: Edit environment file. This is where my $PATH is configured as well as other shell variables.
  • ea: Edit aliases. I keep all my aliases in one file. This command opens that file.
  • ef: Edit functions. As for aliases, I keep all my shell functions in one file. This commands opens that file.

I find these mighty useful. If you're gonna fiddle, might as well make yourself more efficient at it.

The Rails Doctrine

This is a phenomenal piece by DHH about the core values behind Ruby on Rails. I believe everyone should read this, whether or not you're developing with Rails.

A wish for Haskell documentation

I guess that most of the Haskell community are more comfortable with types than typography (self included), but there has to be someone out there. If not, we could have a whip-round and hire someone to make a better design.

I think this is the primary reason people have a hard time learning Haskell. They read Learn You a Haskell for Great Good! and think "this is not too bad" and then they start building a real project only to hit a brick wall that is the lack of beginner friendly documentation.

Data.String.Conversions

When I first started writing bigger projects in Haskell there was one thing that really annoyed me. That is that Haskell has at least 5 different types of strings! In Ruby we have 2 kinds (strings and symbol) but Haskell has 5... And because Haskell is statically typed you constantly have to convert between these different types. I found myself spending more time googling for how to convert between string types than actually getting work done.

The 5 types of strings are:

  • String
  • Strict ByteString
  • Lazy ByteString
  • Strict Text
  • Lazy Text

However a few weeks ago I found this amazing library called string-conversions. This module exposes one function you need to care about and that function is called cs. cs has type cs :: ConvertibleStrings a b => a -> b. You can read that as "it takes a string like thing and converts it into another string like thing". The reason this is so great is that you never need to worry about which type you're converting from and which type you're converting too. The magic of type inference and "dynamic dispatch" figures it out for you.

So whenever you need to convert a string like type you just stick cs in there and the compiler figures out the rest. So great.

Getting started with Haskell development

Some time ago I wrote post about configuring Vim for Haskell development. Two things have changed then that makes the process a little bit, so I thought I would write a follow-up post.

The major changes that have happened is:

  • Neovim is now stable enough to replace Vim.
  • Stack is fixing Haskell's tooling problem and it recently hit 1.0.

The steps I outline below are for people on OS X, but should be simple enough to adapt them to whatever Linux distro you might have.

Installing Neovim

Installing neovim is easy.

$ brew install neovim

I recommend you alias vim to nvim. Putting this in your zshrc/bashrc will do the trick

alias vim='nvim'
alias vi='nvim'

Something that wasn't immediately obvious to me was that Neovim's configuration files aren't "~/.vim" and "~/.vimrc" but rather "~/.config/nvim" and "~/.config/nvim/init.vim". Run these commands if you wanna symlink your old configuration to the new location

mkdir -p $HOME/.config
ln -s $HOME/.vim $HOME/.config/nvim
ln -s $HOME/.vimrc $HOME/.config/nvim/init.vim

Installing Stack

Again super easy:

$ brew install stack
$ cd ~
$ stack setup

Running stack setup will pull down the latest GHC and install it in an isolated location.

When you install packages with stack install and those packages contain executables those executables will be put in "~/.local/bin" so you should add that to your path.

export PATH="$HOME/.local/bin:$PATH"

Be sure to run stack install ... from a directory that isn't a stack project. I recommend just using your home directory. I've read in various GitHub issues that this might prevent weird behaviour.

I also recommend you alias ghc and ghci to use the stack versions. I had some issues with module that couldn't be imported even though they were installed. Doing this fixed the issue.

alias ghc='stack exec -- ghc'
alias ghci='stack exec -- ghci'

The Vim plugins we'll be installing soon depend on a few packages. Go ahead and install them with:

$ stack install hdevtools
$ stack install pointfree
$ stack install hlint
  • Hdevtools delivers super fast type checking.
  • Pointfree allows you get to quickly convert functions to pointfree form. I find is a great way to learn more about how to compose functions. Don't overdo it though.
  • hlint is the best linting tool I've seen for any language.

Installing Vim plugins

The plugins I'm using at moment are:

  • vim2hs, syntax highlighting and converting functions to pointfree.
  • vim-hdevtools, lightning fast type checking
  • neomake, run hdevtools and hlint whenever you save a file and show errors in-line. Much like Syntastic but uses Neovim's async processing features.

These plugins should work pretty much out of the box. To run Neomake whenever you save a Haskell file add the following to your "init.vim".

augroup NeomakeHaskell
  autocmd!
  autocmd! BufWritePost *.hs Neomake
augroup END

Conclusion

Thats pretty much what it would take to recreate my Haskell environment.

I've been really impressed with Stack. Its amazing how much more enjoyable it makes using Haskell. Go ahead and run stack new next-awesome-haskell-thing and let the types lead the way.

Previously

← Archive