Skip to content

Instantly share code, notes, and snippets.

Avatar

masterdezign

View GitHub Profile
View Haskell-Disappointment.md

Introduction

I was recently asked to explain why I felt disappointed by Haskell, as a language. And, well. Crucified for crucified, I might as well criticise Haskell publicly.

First though, I need to make it explicit that I claim no particular skill with the language - I will in fact vehemently (and convincingly!) argue that I'm a terrible Haskell programmer. And what I'm about to explain is not meant as The Truth, but my current understanding, potentially flawed, incomplete, or flat out incorrect. I welcome any attempt at proving me wrong, because when I dislike something that so many clever people worship, it's usually because I missed an important detail.

Another important point is that this is not meant to convey the idea that Haskell is a bad language. I do feel, however, that the vocal, and sometimes aggressive, reverence in which it's held might lead people to have unreasonable expectations. It certainly was my case, and the reason I'm writing this.

Type classes

I love the concept of type class

View Pipeline.hs
module Pipeline where
import Clash.Prelude
(<@>)
:: ( HiddenClockResetEnable dom
, Undefined b
, Default b
)
=> (a -> b)
@kritzcreek
kritzcreek / random-numbers.md
Last active May 9, 2020
Collections of random numbers in PureScript
View random-numbers.md

Generating collections of random numbers in PureScript

A problem that I've seen beginners run into in Haskell or PureScript a couple of times now is how to generate a List of random numbers. It's a common requirement for little games (which make for great first projects) to generate these, and it definitely seems to be a stumbling block.

Why are random numbers hard?

Randomness is considered a side effect in purely functional languages, which means that to generate them you usually need access to Eff/IO, which in turn means we need to deal with Monads. And while generating a single random number is usually pretty easy with do-notation, the typical intuition beginners have built when going from single values to a collection is to use map, but that fails.

Type-Directed-Search to the rescue

@ifesdjeen
ifesdjeen / Haskell Simplification 1.hs
Last active Feb 11, 2018
I've got that piece of code that looks extremely overcomplicated to me. Even though every operation by itself is simple, the "sum" of operations is simply insane.
View Haskell Simplification 1.hs
data Query = Query
data SomeObj = SomeObj
data IoOnlyObj = IoOnlyObj
data Err = Err
-- There's a decoder function that makes some object from String
decodeFn :: String -> Either Err SomeObj
decodeFn = undefined
-- There's a query, that runs against DB and returns array of strings
View gist:7800423
# Based on https://gist.github.com/fernandoaleman/5083680
# Start the old vagrant
$ vagrant init ubuntu_saucy
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
@stbuehler
stbuehler / hackage-upload-docs.sh
Last active Oct 6, 2017
Generate and upload docs for hackage packages
View hackage-upload-docs.sh
#!/bin/bash
# Options / Usage
# put this script in the same directory as your *.cabal file
# it will use the first line of "cabal info ." to determine the package name
# custom options for "cabal haddock" (cabal haddock --help,
# http://www.haskell.org/haddock/doc/html/invoking.html)
CUSTOM_OPTIONS=(--haddock-options='-q aliased')
# hackage server to upload to (and to search uploaded versions for)
@KillerGoldFisch
KillerGoldFisch / Vector3D.py
Last active May 18, 2017
3D Vector utils for Python
View Vector3D.py
#!/usr/bin/env python
# coding: utf8
"""Vector3D.py: Usefull 3D Vector utils."""
import math
__author__ = "Kevin Gliewe aka KillerGoldFisch"
__copyright__ = "Copyright 2014, Kevin Gliewe"
__credits__ = ["kevin Gliewe",]
@jkriss
jkriss / gist:276717
Created Jan 14, 2010
an example env.rb file for cucumber, safariwatir, and machinist
View gist:276717
# Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "cucumber"
require 'safariwatir'
require File.expand_path(File.dirname(__FILE__) + '/../../../config/environment')
require 'machinist'
require File.expand_path(File.dirname(__FILE__) + "/../../../test/blueprints")
ActionMailer::Base.default_url_options[:host] = "localhost"
You can’t perform that action at this time.