background preloader

Haskell

Facebook Twitter

Preparing for Simulation: Player AI — Monday Morning Haskell. Our goal for the next couple of weeks will be to run our game as a simulation, without any kind of player input.

Preparing for Simulation: Player AI — Monday Morning Haskell

This means we'll be able to run through rapid iterations of the game and see the results. We can tune parameters and see what makes the game more competitive. But if we don't have player input, we have to move the main character somehow! This means writing an AI for our player like we have for the enemies. The "player" has more possible actions and inputs, so it will be a little more complicated.

If you've never programmed in Haskell before, take a look at our Beginners Checklist and read our Liftoff Series! Basic Rules For the first iteration of our AI, we won't use the drill power up at all. The choice depends on the state of the world. MakePlayerMove :: World -> PlayerMove ... Once we have the player's move, we'll leave it up to the main update function to determine the result. One long-term goal is to machine-learn this function. Game Infrastructure Wrapping the Player Move. Haskell monad for simulation. When to use Haskell monads.

Program design in Haskell: how to do simulation without mutability.

Category Theory

Concurrency and parallelism. Research papers/Functional pearls. [Haskell-beginners] Expert systems using Haskell. [Haskell-beginners] Expert systems using Haskell Rustom Mody rustompmody at gmail.com Fri Jul 6 16:59:14 CEST 2012 On Fri, Jul 6, 2012 at 1:55 PM, Ramesh Kumar < rameshkumar.techdynamics at ymail.com> wrote: > Hello Folks, >> 1) Is it practical, if at all possible, to build rule-based expert systems > using Haskell in comparison with Prolog?

[Haskell-beginners] Expert systems using Haskell

Here are some examples of papers which I found incredibly useful as a beginner/intermediate Haskeller: - Wadler, Monads for functional prog… In industry. Using Difference Lists. I posted my enthusiasm about difference lists for Haskell earlier this month, but then became sidetracked by combinators and reading lists, so, let's get back on track.

Using Difference Lists

Difference lists are a (very) useful data structure in Prolog, particularly when it comes to parsing with definite clause grammars (DCGs) and when it comes to list construction (again, using DCGs). Why? Well, to answer that question, let's examine the structure of difference lists. The Prolog (or relational) representation of a difference list is of the form: What that relation describes is that X is the difference of the pair of lists of (first) [1,2,3] appended with the list Yminus (second) the list Y.

Well, what is the value of the list Y? "Big deal! " "Good point! " With all their flexibility and power, in certain situations, a zipper is not the correct choice for some list processing tasks; the difference list's simplicity shines in these situations. Can’t see the FOUR-est for the trees. 2 June 2017 I was recently reading an excellent book about math education, What’s Math Got to Do with It by Jo Boaler which included the following puzzle called “The Four 4s”.

Can’t see the FOUR-est for the trees.

Try to make every number between 0 and 20 using only four 4s and any mathematical operation (such as multiplication, division, addition, subtraction, raising to a power, or finding a square root), with all four 4s being used each time. For example 5=√4+√4+44 How many of the numbers between 0 and 20 can be found? It’s a fun puzzle so you may want to take a crack at it yourself before reading on. But this isn’t really about that puzzle. When I tried to do the puzzle I pretty quickly worked out expressions for the numbers zero to ten. So back to the scrap paper. For Beginners. Tutorial for C Programmers. Haskell Tutorial for C Programmers, by Eric Etheridge version 3.0 - please increment with major updates original author: Eric Etheridge last major update by the original author: August 28, 2011 year of original release (on old haskell.org site): 2005.

Tutorial for C Programmers

How to desugar Haskell code. Haskell's core language is very small, and most Haskell code desugars to either: lambdas / function application,algebraic data types / case expressions,recursive let bindings,type classes and specialization, or:Foreign function calls Once you understand those concepts you have a foundation for understanding everything else within the language.

How to desugar Haskell code

As a result, the language feels very small and consistent. I'll illustrate how many higher-level features desugar to the same set of lower-level primitives. MiniKanren in Haskell. This year at Strange Loop I was totally blown away by the miniKanren talk by Daniel Friedman and William Byrd.

miniKanren in Haskell

I highly recommend watching the presentation. It is simultaneously entertaining and mind blowing. Friedman and Byrd used an extended version of miniKanren, a logic programming language (a la prolog) embedded in scheme, to do several remarkable things: This was something that I clearly did not know enough about yet. Usually when I want to really learn and understand something in CS, I try to implement it. Tutorial for C Programmers. Using Difference Lists. Functional programming - Getting started with Haskell. Writing A Lisp Interpreter In Haskell. Haskell/Zippers - Wikibooks, open books for an open world. Using Difference Lists. Publicstuff/boids.hs at master · mjsottile/publicstuff. Haskell, list of natural number. Video presentations. Collected videos of Haskell tutorials and conference presentations, sorted by topic.

Video presentations

For more recent videos, check: Maintained by the community. How to desugar Haskell code. Haskell/XML. There are several Haskell libraries for XML work, and additional ones for HTML.

Haskell/XML

For more web-specific work, you may want to refer to the Haskell/Web programming chapter. Libraries for parsing XML[edit] The Haskell XML Toolbox (hxt) is a collection of tools for parsing XML, aiming at a more general approach than the other tools.HaXml is a collection of utilities for parsing, filtering, transforming, and generating XML documents using Haskell.HXML is a non-validating, lazy, space efficient parser that can work as a drop-in replacement for HaXml.xml-conduit provides parsing and rendering functions for XML.

For a tutorial see [1]. Haskell XML Toolbox 9.2.0. Contents Introduction The Haskell XML Toolbox is a collection of tools for processing XML with Haskell.

Haskell XML Toolbox 9.2.0

It is purely written in Haskell. The Haskell XML Toolbox is a project of the University of Applied Sciences Wedel, The main design goal of the Haskell XML Toolbox is the support of various XML standards including Extensible Markup Language (XML) 1.0 (Second Edition) with DTD processing and Validation, Namespaces in XML 1.0 (Second Edition), XML Path Language (XPath), XSL Transformations (XSLT), RELAX NG Specification, as well as HTML/XHTML processing.

DCG's compared to Haskell monads. In article 062.7... @news20.bellglobal.com>, - show quoted text - Alan Baljeu <aba... @sympatico.deleteme.ca> wrote:>Monads are a tool to make the state of a computation implicit. Combinators in Haskell. In this article, instead of continuing along my path of shoving Prolog (predicate logic) into Haskell, I'll take a break from that and shove Haskell into Haskell. This turn comes by way of my recent professional experience working with Prolog — I found myself oftentimes needing to write some purely functional code, but I found the Prolog semantics getting in my way, so, borrowing some of the ideas from my previous professional programming experiences with Mercury and Dylan (when Harlequin was still a going concern, and had picked up the Dylan ball that Apple, then CMU, dropped, making a really sweet Dylan programming environment), I implemented a set of libraries for Prolog, including basic ZF-set operations, propositional logic syntax, list/set/bag utilities, and the combinator logic of Schönfinkel.

"geophf! " You exclaim, horrified, "you don't really use combinators to write working production code, do you? " That was quite a trip down memory lane. Life is good. fix f = let x = f x in x. Haskelliseasy. To make it more true that Haskell is easy, here's a list of curated libraries. In the personality descriptions matching you to a library, be honest with yourself about where you're at and what your needs are. This isn't listing for listing's sake. I've either used it or someone whose taste and experience I really trust has used it. If you list everything, the list is useless to somebody that can't sniff test the API quickly. Bitemyapp/learnhaskell. Haskell and XML: Generic Combinators or Type-Based Translation?

Malcolm Wallace and Colin Runciman Abstract: We present two complementary approaches to writing XML document-processing applications in a functional language.In the first approach, the generic tree structure of XML documents is used as the basis for the design of a library of combinators for generic processing: selection, generation, and transformation of XML trees.The second approach is to use a type-translation framework for treating XML document type definitions (DTDs) as declarations of algebraic data types, and a derivation of the corresponding functions for reading and writing documents as typed values in Haskell.Published in the Proceedings of the International Conference on Functional Programming, Paris, Sept 1999.

ACM Copyright. 1 Introduction 1.1 Document markup languages. Introduction to HaXml. I was looking for a HaXml tutorial or some code examples on the web but I could not find any description of the basic idea behind the library. There is a tutorial here icfp99, but its focus is more on the power of combinators than on the library basics. There is also a code fragment in realworldhaskell but (at the time of writing this post) it is outdated. The aim of this tutorial is to describe the basic HaXml functionality - reading XML data from a file into custom types and saving the data from these types back to another file. Your First Haskell Application (with Gloss) - Andrew Gibiansky. Lesson 1: Getting Started - Graphical Haskell for Beginners. Topics. Write Yourself a Scheme in 48 Hours. Overview.

Monads

[ny-haskell] Abstractions for the Functional Roboticist with Anthony Cowley. Functional flocks. One of my favorite topics is Artificial Life – how can we build simple computational models of things that we would consider to be living. Often, this focuses on finding simple models for behavior. I’m a member of the International Society of Artificial Life, which has an interesting journal that (in my opinion) justifies my yearly membership fee.

Two topics in ALife that I have found consistently interesting are artificial chemistries and flocking behavior. This post focuses on flocking. Haskel boids. The premiere Mathematica package for computational Category Theory. Diagrams in Category Theory – Good Math, Bad Math. One of the things that I find niftiest about category theory is category diagrams. A lot of things that normally turn into complex equations or long-winded logical statements can be expressed in diagrams by capturing the things that you’re talking about in a category, and then using category diagrams to express the idea that you want to get accross. A category diagram is a directed graph, where the nodes are objects from a category, and the edges are morphisms.

Category theorists say that a graph commutes if, for any two paths through arrows in the diagram from node A to node B, the composition of all edges from the first path is equal to the composition of all edges from the second path. As usual, an example will make that clearer. MIT18 712F10 ch6. Converting object oriented to functional. Oop - Explaining functional programming to object-oriented programmers and less technical people.

Object oriented - How to refactor an OO program into a functional one? Haskell Programming Language. Db utwente 40501F46. Category Theory State Monad. In pure functional programs we can't have functions that depend on something other than the parameters of the function, or any 'side effects', that means that we can't have variables, input or output. If we followed this rigidly then functional programs would not be very useful. However, the monad gives us a workaround for this, a way to encapsulate these side effects so that most of the program is pure functional code. As a simple example imagine we want to model the situation where we have a variable 'x' and we want to do operations to it like 'add 3 to it' or 'double it'.

Rosetta. Does category theory make you a better programmer ? Category Theory. Haskell. Typeclassopedia. By Brent Yorgey, byorgey@cis.upenn.edu Originally published 12 March 2009 in issue 13 of the Monad.Reader. A Haskell Implementation Reading List. A Haskell Reading List. Composing Reactive Animations. Haskell-operatorer.pdf. View topic - Haskell vs Prolog, or "Giving Haskell a choice" Category Theory for Programmers: The Preface. Haskell/Category theory. Untitled. HaXml: Haskell and XML. Maclanecat. The Curry-Howard Correspondence in Haskell.

Curry–Howard correspondence. HXT/Conversion of Haskell data from/to XML - HaskellWiki. HXT - HaskellWiki. The days of coding high adventure: Introduction to HaXml. Haskell and XML: Generic Combinators or Type-Based Translation? Text.XML.HaXml.Combinators. Ghcjs/ghcjs. Reactive-banana/Animation.hs at master · HeinrichApfelmus/reactive-banana.

Tutorials - HaskellWiki. XML Matters: Transcending the limits of DOM, SAX, and XSLT. HaXml: Utilities for manipulating XML documents. Parallel and Concurrent Programming in Haskell. MIT18_S996S13_textbook. MIT18_S996S13_chapter4.pdf. Tools09_pres. Is Category Theory similar to Graph Theory? Arrows.pdf. Arrows: A General Interface to Computation. CPS based functional references. Parser_pearl.pdf. Haskell for Mainstream Programmers - State. Haskell/Applicative functors. Hackage: Introduction. The Haskell 98 Language Report. Why Functional Programming Matters. Haskell. Introduction. Real World Haskell. Haskell/Applicative functors.

Haskell/The Functor class. Post-rfc/sotu.md at master · Gabriel439/post-rfc. Keera Studios. Diagrams - About Diagrams. The functor design pattern.