Making a choice from a list in Haskell, Vty (part 5, the last one)

The time has come for the final installment of this series of “discussions of a refactoring”. These are the earlier installments. This is where I finally add the ability to collapse a list item. This is a rather terse description of the changes, since I feel all of them are fairly obvious, and hence require …

Continue reading ‘Making a choice from a list in Haskell, Vty (part 5, the last one)’ »

Share

Making a choice from a list in Haskell, Vty (part 4)

After part 3 in this series, which might have been the longest post I’ve ever put on this blog, follows a much short post. In fact it’s so short it’s rather silly. In this post I’ll modify the Option type to render into multiple lines; two in fact (it’s easy to see that it would …

Continue reading ‘Making a choice from a list in Haskell, Vty (part 4)’ »

Share

Making a choice from a list in Haskell, Vty (part 3)

This is the third part, and it’s likely to be the longest one in the series. The three previous parts have been rather short, but now it’s time for a longer post because in this one I completely change the representation of the options that are rendered. Instead of using a list and an integer …

Continue reading ‘Making a choice from a list in Haskell, Vty (part 3)’ »

Share

Making a choice from a list in Haskell, Vty (part 2)

Following on the previous part is another baby step. This just changes the options from a list of strings to a list of objects (the only requirement that they implement Pretty): data Option = Option { optionValue::String } deriving (Show)   instance Pretty Option where pretty (Option s) = string s After this it’s an …

Continue reading ‘Making a choice from a list in Haskell, Vty (part 2)’ »

Share

Making a choice from a list in Haskell, Vty (part 1)

After posting the zeroth part of this series I realised I hadn’t said anything about the final goal of this exercise. The first post contained code for choosing one one-line string (String) out of a list of one-line strings ([String]). What I really want is the ability to choose one item out of a list …

Continue reading ‘Making a choice from a list in Haskell, Vty (part 1)’ »

Share

Making a choice from a list in Haskell, Vty (part 0)

I haven’t had much free time lately, which means I haven’t written much non-work code. The only exception is some experiments with a small piece of Haskell code using the Vty module. Many moons ago I wrote a small piece of code that let’s the user choose options from a list in a terminal. Somewhat …

Continue reading ‘Making a choice from a list in Haskell, Vty (part 0)’ »

Share