This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.

Elchemy.XDebug

Module with helper functions for debugging

Debug

log : String -> a -> a

Log to console in title: object format

log "Title" (1,2,3) == (1,2,3)
crash : String -> a

Raise an exception to crash the runtime. Should be avoided at all costs. Helpful for crashing at not yet implelented functionality

module Elchemy.XDebug
    exposing
        ( log
        , crash
        )

{-| Module with helper functions for debugging


# Debug

@docs log, crash

-}

import Elchemy exposing (..)


type Device
    = Stdio


{-| Log to console in `title: object` format

    log "Title" (1,2,3) == (1,2,3)

-}
log : String -> a -> a
log title a =
    let
        _ =
            puts_ Stdio "#{title}: #{format a}"
    in
        a


format : a -> String
format =
    ffi "Elchemy.Format" "inspect"


puts_ : Device -> a -> a
puts_ =
    ffi "IO" "puts"



{- We don't verify since it's a macro -}
{- flag noverify:+crash -}


{-| Raise an exception to crash the runtime. Should be avoided at all
costs. Helpful for crashing at not yet implelented functionality
-}
crash : String -> a
crash =
    ffi "Kernel" "raise"