Sebastian Graf

@sgraf1337

Talk to me about Haskell, GHC, general CS or my trumpet

Karlsruhe, Baden-Württemberg
Vrijeme pridruživanja: srpanj 2014.

Medijski sadržaj

  1. 22. stu 2019.
    Odgovor korisniku/ci

    Ha, I was about to show you this snippet , but it elicits a linker error. This must be the first program where I actually tried to *build* a data structure rather than just consuming it

    {-# LANGUAGE UnliftedDatatypes #-}

import GHC.Exts

data unlifted SList a = Cons a (SList a) | Nil

-- Sadly no IsList (SList a) or Show a => Show (SList a),
-- because type classes require lifted rep
sfromList :: [a] -> SList a
sfromList []     = Nil
sfromList (x:xs) = Nil
stoList (Cons x xs) = x:stoList xs
stoList Nil         = []

sreverse :: SList a -> SList a
sreverse = go Nil
  where
    go acc Nil         ...
  2. 22. stu 2019.
    Odgovor korisniku/ci

    Yes and ... yes? Not completely sure what you mean by that. Here is an unlifted GADT:

    {-# LANGUAGE UnliftedDatatypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE GADTs #-}

module Lib where

import GHC.Exts

data family Foo a :: TYPE 'UnliftedRep

data instance unlifted Foo Int = FooInt Int

data unlifted SBool (a :: Bool) where
  STrue  :: SBool 'True
  SFalse :: SBool 'False
  3. 21. stu 2019.

    Also this is what I can compile right now

    {-# LANGUAGE UnliftedDatatypes #-}
{-# LANGUAGE MagicHash #-}

module Lib where

import GHC.Exts

pack :: Bool -> Bool -> Int#
pack False False = 0#
pack False True  = 1#
pack True  False = 2#
pack True  True  = 3#

data unlifted SBool = STrue | SFalse

spack :: SBool -> SBool -> Int#
spack SFalse SFalse = 0#
spack SFalse STrue  = 1#
spack STrue  SFalse = 2#
spack STrue  STrue  = 3#

data Tree a
  = Branch !(Tree ...
    Prikaži ovu nit
  4. 2. ruj 2019.

    Found this in an alley around Glasgow University... Feed!

  5. 27. kol 2019.

    Me declaring victory over "the last bug" in my patch

  6. 15. kol 2019.
    Prikaži ovu nit
  7. 4. srp 2019.

    Todays gem That ToDo has been there since GHC adopted a VCS

    Prikaži ovu nit
  8. 28. ruj 2018.

    TAPL on programming languages with pure type systems

  9. 21. lis 2017.
    Odgovor korisniku/ci

Čini se da učitavanje traje već neko vrijeme.

Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.

    Možda bi vam se svidjelo i ovo:

    ·